Google Plus

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

Written by Mel Kham on . Posted in Linux tutorials

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

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.
  • http://fzero.ca Fabio

    Is it REISUB or RSEIUB after all?

  • bofiran

    Now is corrected .

  • Epictete

    There is a mnemonic for RSEIUB:
    Raising Skinny Elephants Is Uterly Boring.

    I think there is a mistake in the text for I got ++ on each line:
    ++ 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)

  • Epictete

    "If you are using Ubuntu,Debian you can not use The magic SysRq key because it is desactivated by default."

    This is wrong and, much more, you can’t find a line "kernel.sysrq = 1" in /etc/sysctl.conf.

    In Ubuntu 10.10 (and it’s was the same thing in previous versions).

  • Epictete

    RSEIUB =

    unRaw = takes control of the keyboard behind an X system
    Sync = copys datas from buffers to disks and USB keys
    tErminate = kill -15 : terminates the processes in the normal way
    kIll = kill -9 : kills the processes (even X server) that hadn’t terminated in the normal way
    Unmount = remount all the system in read only mode
    reBoot
    or shutdOwn

  • Zinovsky

    [quote=Epictete]"If you are using Ubuntu,Debian you can not use The magic SysRq key because it is desactivated by default."

    This is wrong and, much more, you can’t find a line "kernel.sysrq = 1" in /etc/sysctl.conf.

    In Ubuntu 10.10 (and it’s was the same thing in previous versions).[/quote]
    If you read good my post I said the line dosn`t exist and you have to add it to the file then save and exit :)

  • dakira

    better yet, do it the right way:

    echo 1 | sudo tee /proc/sys/kernel/sysrq

  • Epictete

    [quote=Zinovsky]If you read good my post I said the line dosn`t exist and you have to add it to the file[/quote]

    This is right but you don’t have to add the line for the magic SysRq key DOES work by default in Ubuntu without doing anything.
    I have been using it in several versions of Ubuntu, more precisely since the version in which Ctrl-Alt-Suppr has been desactivated.

  • nttp

    The easy mnemonic for this is "BUSIER", just backwards. And just so you know, this works for all POSIX systems, including mac, Freebsd, etc…

  • http://my.opera.com/bachkhois Quân

    I read that the key sequence is REISUB, which can be remembered as inversion of "BUSIER"

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

Snake

|

Wow, great. That’s what i’m waiting for too. I want to make DC with LDAP ( Active Directory alternative) and SAMBA on Ubuntu. :-)

Blawer

|

Thanks!!!!!!!!!!!!!!!!!! you rules!!! all the other “help” in google are useless… yours was very helpful. Thanks again

piCool

|

Great ! we have another another master trick :-)

Yilmaz Ulugtekin

|

Just delete the space after the slash (/) it will work.

Pat L

|

I tried it and it works with a regular zip file, but if you password-protect the .zip file it does NOT work.

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .