Sunday, October 4, 2009

Linux "Safe" Restart

Many people (especially linux newcomers) don't know that there is a "safe" way to reboot your system, in case everything else fails in order to get your system unstuck and running.

Raising Skinny Elephants Is Utterly Borring

Sounds confusing?



We are going to use a little thing called System Request (or SysRq). This is a key combination you can use to perform various low level system functions such as sending signals to your operating system.

The SysRq key on your keyboard is also used as the PrtScn (Print Screen) key.

So, whenever you find yourself in a completely messed up situation and restarting the X server does not work (Ctrl+Alt+Backspace) you can use this technique.

We are going to call some low level OS functions holding the "Alt" and the "SysRq/PrtScn" keys.
So:
ALT + SysRq + r
ALT + SysRq + s
ALT + SysRq + e
ALT + SysRq + i
ALT + SysRq + u
ALT + SysRq + b

(r,s,e,i,u,b) = (Raising Skinny Elephants Is Utterly Boring) = Good mnemonic

r is for setting the keyboard into RAW mode.
s syncs the mounted filesystems
e terminates all processes sending the SIGTERM signal
i kills all processes by sending the SIGKILL signal
u remounts all "read-only" filesystems
b induces an immediate reboot of the system

Remember, use it with caution, when all else fails!

2 comments: