March 13, 2011, 9:20 p.m.
posted by bigfish
Crashes in SUSE Linux are not like crashes in Windows. A typical crash within Windows will usually take the rest of the system with it, or certainly damage the system so that it malfunctions until you reboot. You might be able to recover to some degree, and perhaps even keep on working, but in a lot of cases, you'll need to reboot.
In SUSE Linux, programs are far more independent and "clean." If a program crashes, it will usually leave the rest of the system intact. Even if the system appears to have completely locked up, there's a strong chance that you'll be able to recover and carry on as if nothing had gone wrong.
If an individual program crashes, it will usually do so in a fuss-free manner. The first thing you'll notice is that the program simply disappears. If it's a KDE application, it may crash, and then a window might appear asking you to file a bug report, as shown in Figure. This usually just sends an e-mail message to the developers, telling them what happened. It's a good idea to send these, because relaying this information will inevitably lead to better software in the future.
Figure. If a KDE program crashes, it will ask you to file a bug report. This will help produce better software in the future.
If a program crashes but its window lingers on screen, and the mouse cursor is still responsive, select K menu ® Run Command, and then type xkill in the box. The cursor should change into a skull and crossbones to indicate that the program is active. Then click on the program window that has crashed. You should find it disappears, and you can keep on working. Be very careful with this approach, because xkill can also destroy perfectly healthy programs. Make sure you click on the right program window!
To cancel xkill after it has started (if the crashed program disappears on its own accord before you can get to it, for example), simply right-click anywhere.
If a program crashes completely and seems to jam everything else, including the mouse (which may freeze on the spot or just stop being able to click anything), there's still no need to reach for your PC's reboot button yet.
The first potential cure is to try to terminate the graphical display completely. Doing so will cause it to instantly restart. It will also result in the loss of the data in any programs you have open, which might not be ideal. But it's a quick and efficient way of regaining control of your machine. You can kill the graphical display by pressing Ctrl+Alt+Backspace (not the Delete key!).
Press Ctrl+Alt+F2 (the function keys run along the top of most keyboards). This will switch you to a command-line prompt (technically speaking, it switches you to an alternative console, of which there are six available to be used at any one time). Don't worry, the GUI is still running in the background and you haven't killed it.
At the login prompt, type root, and then enter your root password when it's requested, as shown in Figure.
At the command-line prompt, type top. This will start a program in which you'll be shown all the running programs (the top program is covered in Chapter 17).
Look down the list and try to find the program that has crashed. Once you find it, look at the very left of its entry in the list. You should see a four- or five-digit number, which is the program's process ID (PID).
Type k (lowercase) and type in the PID number. Then press Enter. See Figure for an example.
But what if your entire system has completely locked up and none of the previous tricks work? To be honest, this is highly improbable and quite literally a once-in-a-lifetime event for most SUSE Linux users, unless they're using highly experimental software. But in this situation, there's one last trick you can attempt.
If the crashed machine is connected to a network, you can try connecting to it from another Linux machine. This is done via a program called Secure Shell (SSH). Effectively, this program lets you log in to the machine as if you were sitting in front of it. It's a very useful program that we'll discuss in Chapter 34. For the moment, however, we're only concerned with using SSH to try to salvage a crashed machine.
SSH will work only if it's activated (running) on the machine you want to connect to, and the remote machine's firewall has been previously opened to allow connections from outside.
On another Linux machine elsewhere on your network, open a command-line prompt (if the other machine is also running SUSE Linux, select K menu ® System ® Terminal ® Konsole). Then type the following:
ssh [email protected][IP address of crashed machine]
This will attempt to connect to the crashed computer. If it's not completely crashed, you should get a response asking if you want to save the computer's cryptographic key (a code by which you can authenticate the computer in future). Agree to do so, and then type in the root password for the crashed machine. Figure shows an example of this procedure.
With any luck, you should find yourself with a command prompt. From there, follow the instructions in the previous section to terminate the crashed program using the top program.
If SSH simply hangs and doesn't appear to be doing much, chances are the crashed machine is beyond salvaging. At this point, it's time to hit its reset button. You gave it your best shot!