Linux Guide/Freezes

This page describes how to get out of problems when programs go wrong. The most common way is by killing the process - an individual program or one of its parts. If you kill a process, you'll probably lose any unsaved data in that program, and possibly from other programs it has spawned or is communicating with..

This page also describes what to do if the computer is completely frozen.

These suggestions have more adverse consequences the further down the list you go. For example killing a window in KDE will lose the unsaved data in that program, whereas pressing the reset button could corrupt all data on a hard drive (in extreme cases). Don't resort to extreme measures unless you have no other choice.

In X-Window (general)
The default easy-to-use application for killing frozen pieces of software when using an X environment is xkill. When executed, the mouse cursor will change to an icon of a skull and crossbones, and the next window you click will be killed. xkill

Sometimes this can be done by doing Control+Alt+Escape, or alternatively by bringing up the "Run" dialog box with ALT+F2 and typing in "xkill" followed by RETURN.

In KDE
KDE System Guard (installed by default) can be used to kill troublesome processes. Ctrl+Esc is the default key combination for starting it, or run ksysguard.

In GNOME
The gnome-system-monitor GUI program is one way to view active processes, end processes, and kill them too. There is also a "Force Quit" widget which can be added to a panel which replicates the function of xkill.

Killing at the Console
The easiest way of stopping a program running on the terminal you are using is pressing Ctrl+C, which asks a program to stop (sends SIGINT) - but the program can ignore this. Ctrl+C also works on programs like XTerm or Konsole. See also Alt+SysRq+K below.

In addition, there are several commands to kill processes from any terminal window, not just the one a program is running from. You can use a program like XTerm or Konsole to provide a fake terminal, or you can switch to a terminal by pressing ctrl+alt+function key; ie Ctrl+Alt+F2 to Ctrl+Alt+F6 (depending on your system). Ctrl+Alt+F7 gets you back to the desktop (again, depending on your system).

The Guide to UNIX/Commands/Process Management page has more information on process management commands, but a few popular ones are below: pkill -TERM program_name
 * pkill and killall are the most useful program-killing commands, and they do similar things. Just type
 * or

killall program_name
 * In addition, pgrep can be used to list running processes.

Forcing the X Window System to Quit
shutdown -r now
 * To kill and restart the X Window System, press Ctrl+Alt+Backspace. Lots of programs need X-Window, so using this will cause most running programs to quit or crash.
 * You should probably try to reset your computer after this: type
 * to do this. You may need to be root.

sudo /etc/init.d/(gdm or kdm or xdm) shutdown
 * If you have access to the command line, you can also type
 * to stop X.


 * Note that the ability to restart X by pressing Ctrl+Alt+Backspace can be disabled from X's configuration file. In the X.Org implementation, a "DontZap" option can be added to xorg.conf to do this. If Ctrl+Alt+Backspace is not working, this may be the reason why.

If you do Ctrl+Alt+Backspace and you have a login manager like XDM enabled usually you will be thrown back to that after x RESTARTS. If you started X by typing startx this will usually throw you back to the command line

Ctrl+Alt+Backspace is useful for restarting X after changing the resolution, for example, too.

Alt+SysRq
If all else fails, you may still be able to communicate with the Kernel.

To use, just press the Alt and SysRq (PrintScreen) keys and one of the keys listed below, all together. You should try switch into a terminal window, if possible, first by pressing Ctrl+Alt+F2 (use Ctrl+Alt+F7 to return to the desktop).

If your computer is not responding you can use the following steps to perform a reboot with less chance of fscking your files. This is a suggested method:
 * 1) Press Ctrl+Alt+F2 to switch to a terminal window. Sometimes, this is not possible.
 * 2) Press Alt+SysRq+R to get the keyboard
 * 3) If pressing Ctrl+Alt+F2 before failed, try it again now.
 * 4) Press Alt+SysRq+E to term all processes.
 * 5) Press Alt+SysRq+I to kill all processes.
 * 6) Press Alt+SysRq+S to sync your disks.
 * 7) Wait for OK or Done message. If you don't see a message, look at your HDD light to see if Sync made a difference.
 * 8) Press Alt+SysRq+U to umount all disk drives.
 * 9) Wait for OK or Done message. If you don't see a message, in 15-30 seconds, assume disks are unmounted (or that an unmount is not posssible) and proceed.
 * 10) Press Alt+SysRq+B to reboot.

The Letters used spell REISUB - use the mnemonic Reboot Even If System Utterly Broken. Another popular one is Raising Elephants Is So Utterly Boring, or just spell BUSIER backwards.

The Full list of available commands is shown below. It's largely taken from Documentation/sysrq.txt in the Linux Kernel Sources.

Certain systems (systems administrated by a department or group other than yourself, e.g. a corporate or government location) may remove the ability to use the SysRq key combinations in order to secure their system from low level commands. If you try a few commands and notice nothing is happening, or error messages occur, this may be the case.

The Big Red Button
The final option is, of course, the power button on your computer's physical exterior. Modern PCs have ACPI buttons, which just send the shutdown request to the kernel. If the ACPI daemon is listening and correctly configured, it can signal  and perform a clean shutdown.

If ACPI doesn't work, you will need to cut off electrical power. This is done through a "hard switch" (generally labeled "reset"), possibly using the same button as before but holding it pressed for 5 or so seconds. Taking out the battery (on laptops) and physically disconnecting all power cables is, of course, the only method guaranteed to work. (Make sure no other method listed above works. Even as a last resort, unplugging your computer while it is running is still not recommended.)

Resetting without shutting down can cause problems with the file system. To try and fix this problem, fsck will be run when you next boot up, and journaling filesystems will attempt to complete or rollback files which were changing.