Reset
Why do computers have reset buttons? Because they come with Microsoft Windows operating systems. That joke is so old I first heard it from a Stegosaurus. Are you saying that Linux programs never crash? The Linux kernel is very stable and application crashes usually don't affect the rest of the system by much. But occasionally a rogue process will muck things up, using up all your CPU or RAM (or both) and requiring a reset. Or a kernel panic will stop the boot process dead in its tracks. So we still need the dreaded reset button, don’t we? Well, no we don’t. Linux has a little magic in the kernel, whenever you press Alt, the SysRq key and a command key, the kernel will always respond to that command, unless it is completely locked up. Because this is a function of the kernel, it works as soon as the kernel is loaded, so you can use it during the boot process. I don’t have a SysRq key, what do I do? The SysRq key is also used for Print Screen, it can be marked as either, or both. What are these command keys I can use? There are several command keys to perform various operations, but the most useful ones are R,E, I, S, U and B, pressed in that order. R resets the keyboard driver to raw mode, E sends a TERM signal to all processes and I sends a KILL signal. Don’t use these two from a remote session as they will kill the network connection. S syncs all mounted filesystems, that is it writes all cached data to the disks immediately. U unmounts all mounted filesystems, then remounts them as read-only. The last two operations ensure that the contents of your disks are correctly written and cannot be corrupted. That makes it safe to press the third command key, B for reboot, which reboots the system immediately. Because your disks are synced you’ll see no warnings when you reboot and there’ll be no need to run fsck. How am I supposed to remember that sequence? There are various acronyms, some very silly. You could use Reboot Even If System Utterly Broken, which is quite appropriate, or remember that it is BUSIER spelled backwards.
That’s fine if I have access to a keyboard on the computer, but what if it is remote or headless? You can also run the magic commands like this echo s >/proc/sysrq-trigger
Providing you are able to shell into the computer, you can sync and shutdown. Are there other keys and commands I can use? You can find a full list and lots of other useful details in the kernel documentation at /usr/src/ linux/Documentation/sysrq.txt, or www.mjmwired.net/kernel/ Documentation/sysrq.txt.