Error trying to use xdebug tunnel

Hi there,

I’m new to this community, so if I’m doing anything wrong or there is anything I’m missing (need more info? Not sure), please let me know.

I’m using Trellis with the regular setup (Bedrock, Sage) but using the Sage 9.0.0-beta for my theme. I encountered some sort of PHP problem when I most recently deployed my site to my staging environment , which wasn’t present on my development environment (deployment was successful). I wanted to use xdebug to try to figure out what’s going on, as per https://roots.io/trellis/docs/debugging-php/ guide.

However, when I run the command ./bin/xdebug-tunnel.sh open staging, I get this error at the TASK [xdebug : Install Xdebug] stage:

System info:
  Ansible 2.2.1.0; Linux
  Trellis 0.9.9: December 14th, 2016
---------------------------------------------------
'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options
::=--force-confold"     install 'php-xdebug'' failed: E: Could not open lock
file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you
root?

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you
root?

fatal: [<my staging server>]: FAILED! => {"cache_update_time": 1487225626, "cache_updated": false, "changed": false, "failed": true, "stdout": "", "stdout_lines": []}
        to retry, use: --limit @<my code path>/trellis/xdebug-tunnel.retry

PLAY RECAP *********************************************************************
<my staging server>          : ok=5    changed=0    unreachable=0    failed=1  

I really am not sure what is happening. The user I have configured is a sudoer, and deployment works fine with that user, so I’m not sure why it’s lacking permissions. I tried rebooting the remote machine (it’s a digitalocean droplet) and running again with no improvement.

Thanks for looking into this.

@chrissi Thanks for reporting this!

Could you see if roots#trellis761 resolves it for you?

Also, seeing that you’re on Ansible 2.2.1.0, you may want to be sure you have applied roots/trellis#758 (more notes here).

1 Like

Thanks @fullyint. I applied those two patches and now the error is slightly different:

TASK [xdebug : Install Xdebug] *************************************************
System info:
  Ansible 2.2.1.0; Linux
  Trellis 0.9.9: December 14th, 2016
---------------------------------------------------
'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options
::=--force-confold"     install 'php-xdebug'' failed: E: dpkg was
interrupted, you must manually run 'sudo dpkg --configure -a' to correct the
problem.

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to
correct the problem.

fatal: [<my staging server>]: FAILED! => {"cache_update_time": 1487710763, "cache_updated": false, "changed": false, "failed": true, "stdout": "", "stdout_lines": []}
        to retry, use: --limit @<my code path>/trellis/xdebug-tunnel.retry

PLAY RECAP *********************************************************************
<my staging server>          : ok=5    changed=0    unreachable=0    failed=1   

Is this what’s expected? Do I need to follow the instructions and manually run the dpkg command to continue?

Edit: Nevermind that. I’m not sure what caused that error, but it was a problem when I ssh’ed into the remote machine and tried to run apt-get update outside of the script anyway. I followed the instructions to manually run the dpkg command, and now the xdebug command works.

Thanks so much for your help!

1 Like