About this Guide
This guide is geared toward troubleshooting the suspend/resume function on a computer that fails to resume from suspend (i.e. you only get a black screen). The procedure outlined below may not work on all systems for all problems, depending on the source of the problem. I have attempted to write it so that beginners can use it, but in reality this is a process usually reserved for those who have at least a comfortable understanding of Ubuntu packages, video cards, networking, and using the terminal. Please feel free to ask questions.
Prerequisites
Install openssh-server
Of course, to do remote actions, you must be able to connect to the computer, so we install a SSH daemon:
Code:
sudo apt-get install openssh-server
Test your ability to SSH to the box from another machine, and configure your firewall and router accordingly (on LAN, no extra work should be needed). Note that SSH may be more reliable when attempting to resume if you are using a wired connection rather than wireless.
Write down the IP of this computer, which you can check with
Install Debug Packages
In order to debug, we need gdb and the debug packages for X and for your video driver. My video card uses the open source radeon drivers, so I will use the debug packages for the package xserver-xorg-video-radeon. Substitute your own.
Code:
sudo apt-get install gdb xserver-xorg-core-dbg libgl1-mesa-dri-dbg xserver-xorg-video-radeon-dbg
Starting the Debug Procedure
Switch to TTY1 (CTRL+ALT+F1), login, and start a screen session with a name (e.g. xcrash):
Now that you are inside of screen, get the pid (process ID) of Xorg. Write it down, or remember it for just a few seconds:
Now we start gdb:
Code:
sudo gdb /usr/bin/Xorg
Now you are in the gdb prompt - we will attach to the existing X, handle a couple of signals, and tell X to continue:
Code:
(gdb) attach <the process ID you found above>
(gdb) handle SIGUSR1 nostop
(gdb) handle SIGPIPE nostop
(gdb) cont
Now you can disconnect from the screen session with CTRL+A+D.
Switch back to X (CTRL+ALT+F7, or sometimes CTRL+ALT+F9). Suspend the computer, wait 10 seconds or so, then attempt to resume it.
Handling the Failed Resume-From-Suspend
If the screen fails to come back up, then we need to check gdb to see if a backtrace was obtained. Of course, if X is frozen up, you probably won't be able to switch back to TTY1, which is why we are using SSH here. Connect to the computer from another machine:
Code:
ssh <username>@<IP>
e.g.:
Code:
ssh rocket2dmn@192.168.1.100
Now you can attach to the screen session we started earlier:
NOTE: If you see messages about SIGUSR1 or SIGPIPE, you can probably ignore them, we specifically handled them earlier.
Code:
Program received signal SIGUSR1, User defined signal 1.
Program received signal SIGPIPE, Broken pipe.
Such messages as these should be OK.
Moving on. Now we have the gdb prompt again, so let's grab the backtrace and send it to a file:
Code:
(gdb) set logging on
(gdb) backtrace full
Enter your way through the backtrace until you are back at the gdb prompt.
Open another terminal from the computer you are using to SSH to the broken computer, and grab the backtrace. The easiest way is to use scp:
Code:
scp <username>@<ip>:gdb.txt .
e.g.:
Code:
scp rocket2dmn@192.168.1.100:gdb.txt .
Don't forget that final period, that places the file you are downloading into the working directory (usually your home directory).
You can now use the backtrace in this file in a bug report. For help with that, see Improving Ubuntu: A Beginners Guide to Filing Bug Reports. You will most likely want to file your bug against the xorg-server package.
To resume the X session (may be possible, depending on the problem), at the gdb prompt, run:
Alternatively you can just detach the gdb session from X and use the computer normally.
Code:
(gdb) detach
(gdb) quit
Troubleshooting
If you are unable to connect over SSH at all, try installing landscape-common:
Code:
sudo apt-get install landscape-common
I used this workaround in Karmic, as explained in this thread.
If you are having problems getting the backtrace, see X/Backtracing.
Resources
Bookmarks