While Linux is not known for its instability, every so often something can go wrong and leave you with a frozen system.
Usually, at least for me, a frozen system occurs when modifying core parts of the operating system, such as the kernel, X window system or when performing a complete upgrade such as debian’s dist-upgrade, which includes plenty of changes to core components.
The first thing to try when presented with a frozen screen is to see if just X has crashed and whether you can access a console via ctrl-alt-F1, if you’re presented with the console screen, you can login and relatively cleanly reboot by issuing, sudo reboot -f. If you swap to a console screen from a working X and wish to get back, on most distro’s this is ctrl-alt-F7, if not try the combo with other function keys.
Still stuck staring at a locked screen? Then it is time to try the magic sysreq key. The sysreq key is a kernel function, which must be compiled into the kernel, that allows low level commands to be run. This means you can clean up a system, and force it to reboot/shutdown with out corrupting the filesystem. To issue a magic sysreq key you hold down alt, Sysreq (also the PrintScreen key on most modern keyboards), then the selected key for which command you want issued.
The best series of sysreq keys to issue has luckily been solved by an acronym, created by some one far more creative than me and found on the wikipedia link below.
Raising Elephants Is So Utterly Boring, or BUSIER in reverse.
The series above will do the following:
- R: Switch the keyboard from RAW mode to XLATE mode (ASCII Mode, sort of.)
- E: Terminate all processes, applications should gracefully close
- I: Kill all processes, forcefully terminate all processses
- S: Sync/flush data to the disk
- U: Unmount all filesystems and remount as read only
- B: Reboot the system
A few second pause should be used between each sysreq command issued so they can take full effect.
You will also need to be aware if you’re using a different keyboard layout the keys are based on the QWERTY layout, the matching keys are in the wikipedia link below, which you can also take a look at if you’re interested in the fullset of available sysreq commands.
If nothing happens, unfortunately you’ll have to powercycle and hope for the best, fingers crossed you won’t need the magic sysreq key very often!
http://en.wikipedia.org/wiki/Magic_SysRq_key