Tuesday, February 9, 2010

Recover from a frozen system with the magic SysRq key (zz)

What is The magic SysRq key ?

The magic SysRq is a key combination understood by the Linux kernel, which allows the user to perform various low level commands regardless of the system's state. It is often used to recover from freezes, or to reboot a computer without corrupting the filesystem.
 
How to use the magic SysRq to recover from a frozen system ?

If you see that using Ctrl+Alt+Backspace does nothing, then is the time to use The magic SysRq key.

1. Hold down the Alt and SysRq (Print Screen) keys.
2. While holding those down, type the following in order. Nothing will appear to happen until the last letter is pressed: REISUB
3. Watch your computer reboot magically.

To remember the word REISUB the mnemonic is "Raising Elephants Is So Utterly Boring", "Reboot Even If System Utterly Broken" or simply remembering the word "BUSIER" .

The magic SysRq to recover is advised to be used for emergencies only, for example when the system absolutely locks up and freeze This is not to be used on potentially still busy machines which are still writing stuff to disk for example or on machines that could still do a proper shutdown if you only were patient enough to wait. This is only for systems which have already died a horrible death.
 
Activate The magic SysRq key in Ubuntu/Debian/CentOS/RHEL/Fedora
If you are using Ubuntu,Debian you can not use The magic SysRq key because it is desactivated by default.
If you want to activate it, you have to edit the file /etc/sysctl.conf :

vi /etc/sysctl.conf
and then add this line :
kernel.sysrq = 1

save and close

 If you are using Fedora /CentOS/ Redhat, edit the file /etc/sysctl.config and change the value of kernel.sysrq to 1
# Controls the System Request debugging functionality of the kernel
# kernel.sysrq = 1

and is done.

No comments: