Crash Recovery


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.

Note 

Ctrl+Alt+Delete is familiar to all Windows users. It's the magical key combination that either restarts the system or brings up the Task Manager, which you can use to restart the system or terminate wayward programs. Under SUSE Linux, Ctrl+Alt+Delete has a different effect: it brings up the shutdown dialog box, which you can use to log out, restart, or shut down your system.

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 13-1. 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.

image from book
Figure 13-1. 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!

Tip 

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.

Salvaging Lock-Ups

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!).

However, if you do find your system has apparently locked up just as you were editing a vital file that you haven't saved, there's another less drastic trick you can try:

  1. 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.

  2. At the login prompt, type root, and then enter your root password when it's requested, as shown in Figure 13-2.

    image from book
    Figure 13-2. Type root as your username and then enter your root password.

  3. 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).

  4. 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).

  5. Type k (lowercase) and type in the PID number. Then press Enter. See Figure 13-3 for an example.

    image from book
    Figure 13-3. Find the misbehaving program in the list, press k, then type its PID number.

  6. Now switch back to the GUI by pressing Ctrl+Alt+F7. With any luck, you should find the crashed program has disappeared, and you now have control of your computer again.

Unfreezing by Connecting over a Network

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.

Note 

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 root@[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 13-4 shows an example of this procedure.

image from book
Figure 13-4. You can attempt to unfreeze a crashed machine by connecting to it over the network.

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!

image from book
File System Maintenance

Under Windows, you might be used to regularly defragmenting your disk and also running the Scandisk program to check the file system for errors.

SUSE Linux includes a Scandisk-like program, called fsck, but the system is configured so that this runs automatically if your system shuts down unexpectedly. Running it manually is possible but requires the use of a rescue disk, because a file system that is currently in use (booted into) cannot be scanned.

If you feel that your partition needs to be scanned manually, insert your SUSE Linux installation DVD-ROM and boot from it. At the boot menu, select Rescue System. Select your keyboard layout when prompted. When the username prompt appears, type root. You won't be prompted for a password. Then type the following:

fsck –p /dev/hda3

This assumes SUSE Linux is installed on the third partition of your hard disk, which is usually the case if you're dual-booting with Windows. You can check to see which partition number your SUSE Linux partition is by typing this:

fdisk –l /dev/hda

Alternatively, if you installed SUSE Linux on a second hard disk installed specifically for the purpose, it's likely SUSE Linux will be installed on the /dev/hdb2 partition, so you should type that with the fsck command. As for defragmenting the hard disk, this is unnecessary under SUSE Linux because a different methodology is used to store data compared to Windows. On a well-used system, fragmentation might still occur, but not in the extreme levels found on Microsoft file systems and certainly not enough to cause performance issues.

image from book




Beginning SUSE Linux from Novice to Professional
Beginning SUSE Linux: From Novice to Professional
ISBN: 1590594584
EAN: 2147483647
Year: 2005
Pages: 293
Authors: Keir Thomas

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net