Use Magic SysRq combination key to recover from a frozen system in Linux | Ubuntu

by
Share this Article: Facebook2Google+0Twitter1LinkedIn0Reddit0Pinterest0StumbleUpon0Digg

In our previous post we talked about the magic sysRq key ” RSEIUS” a key combination to be used for emergencies when the system absolutely locks up and freeze, in other word when the systems has already died a horrible linux-logodeath. Today i will show another magic SysRq keys combination to be used to recover from freezes in linux (Ubuntu, Fedora, CentOS..). Note that these keys wont work if your system is in kernel panic.

” 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. The key combination consists of Alt, SysRq and another key, which controls the command issued “

1- 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 

 

2- List of SysRq magic key combination to recover from a Frozen system:

First, Some keyboards may not provide a separate SysRq key. In this case, a separate “Print” key should be present. Under graphical environments (such as Gnome or KDE) ‘Alt’+'PrintScrn/SysRq’+key combination generally only leads to a screenshot to be dumped. To avoid this Print Screen feature the magic SysRq combination should be additionally prefixed by Ctrl, becoming ‘Ctrl’+'Alt’+'SysRq’+key.

++Send the SIGTERM signal to all processes asking them to exit except init
++ Send the KILL signal to all running processes except init.
++Kill all processes on the current virtual console (Can be used to kill X and svgalib programs)
++>Turn off keyboard raw mode. This can be useful when your X session hangs. After issueing this command you may be able to use
++Send the KILL signal to all processes, including init. The system will not be functional.
++ >Reboot immediately without syncing or unmounting your disks. Your will likely end up with filesystem errors.

++

++

++

Sync all mounted filesystems. This is helpfull because it can prevent data loss.

Shut the system off (if configured and supported).

Display help. Also, any other unsupported combination will display the same help.

 

To perform a safe reboot of a Linux computer, use  RSEIUB magic SysRq Magic combination key:

Hold Alt+PrtSc then type R+S+E+I+U+B , you need to press each key for 2-3 seconds.

In practice, each command may require a few seconds to complete, especially if feedback is unavailable from the screen due to a freeze or display corruption. For example, sending SIGKILL to processes which have not yet finished terminating can cause data loss.

Useful Links : wikipedia, about

For questions please refer to our Q/A forum at : http://ask.unixmen.com/

Share this Article: Facebook2Google+0Twitter1LinkedIn0Reddit0Pinterest0StumbleUpon0Digg