Posts Tagged ‘keyboard combination’

Linux instant safe (kernel level) reboot and more

December 10, 2007

Finally. Another post after weeks of ‘blog silence’ and constantly watching my ‘views’ count go up and down.

Anyway, this post is about how one can reboot a Linux machine instantly and safely when everything else has stopped responding (even the kernel). The reboot speed is only limited by how fast you type the keys of your keyboard, believe it or not.

Unlike the old-fashioned and not so safe ctrl+alt+del combo, this particular keyboard key combination reboots your machine safely, and more!

Now onto the main topic. First, we need to check if your system already allows this key combination. Issue

$> cat /proc/sys/kernel/sysrq

$>1

If the output (just like mine) is a ‘1’, then your system will respond to the combination. Otherwise, issue a command to input a ‘1’ in the aforementioned file whose contents we just viewed (sysrq) like opening it using vi or a text editor for example.

Moving on, the key combination is as follows:
hold down

ctrl + alt

then press your

sysrq

button and then the following letters/keys (shown with their corresponding meaning/effect):

r - force switch to keyboard mode (in case you can't even use your keyboard anymore)

e - send all processes the SIGTERM signal

i - sends all processes the SIGKILL signal

s - Sync filesystem (so you won't have to use 'fsck' next time you boot up)

u - Unmount all devices

b - Reboot immediately

Note that you can use each letter in ‘reisub’ with ctrl and alt to effect the desired task without the need to press the other combinations e.g. holding ctrl+alt then pressing sysrq buton then the b button to immediately reboot without unmounting your mounted disks, for example.

The point of the key combination show above is that when pressed in that manner, it ensures not only the fastest, but the safest way to reboot your machine. Cool huh?

The easy way to remember it, i.e. mnemonics, is it’s the inverse of ‘busier’. Nice!

One final tip: in case you don’t want to reboot and you just want to turn your machine off (either by going through the ‘safe’ key combination just mentioned or just turn it off instantly), you can hold down

 ctrl + alt

then press your

sysrq

button followed by

o

Comments and suggestions are always welcome!