SysRq: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
(Copy from old)
 
m (SysRq list into different order; corrected SysRq+I definition error; added mnemonics.)
 
Line 49: Line 49:


   <tt>Alt+SysRq+R</tt> :Attempts to remove keyboard from Raw mode
   <tt>Alt+SysRq+R</tt> :Attempts to remove keyboard from Raw mode
   <tt>Alt+SysRq+K</tt> :Kills all processes (SIGKILL / kill -9)
   <tt>Alt+SysRq+E</tt> :Terminate request sent to all processes (SIGTERM / kill -15)
   <tt>Alt+SysRq+E</tt> :Terminates all processes (SIGTERM / kill -15)
   <tt>Alt+SysRq+I</tt> :Kills all processes (SIGKILL / kill -9)
   <tt>Alt+SysRq+I</tt> :Interrupts all processes (SIGINT / kill -2)
   <tt>Alt+SysRq+S</tt> :Syncs all disks 
   <tt>Alt+SysRq+U</tt> :Force unmount and remount of all filesystems readonly
   <tt>Alt+SysRq+U</tt> :Force unmount and remount of all filesystems readonly
  <tt>Alt+SysRq+S</tt> :Syncs all disks
   <tt>Alt+SysRq+B</tt> :Reboots (INIT 6)
   <tt>Alt+SysRq+B</tt> :Reboots (INIT 6)


and roughly in that order.  You should wait several seconds between each keystroke to let the system complete your request before you issue a new one.
There are several mnemonics to help you remember the key sequence:
    <tt>Raising Elephants Is So Utterly Boring</tt>
    <tt>Reboot Even If System Utterly Broken</tt>
    <tt>BUSIER, spelt backwards</tt>


An alternative method is to:
An alternative method is to:
Line 64: Line 69:


==Futher Information==
==Futher Information==
Further instructions and other options can be found in:
Further instructions and other options can be found at:


Wikipedia article on MagicSysRq [http://en.wikipedia.org/wiki/Magic_SysRq_key]


<pre>/usr/src/<linux-version>/Documentation/sysrq.txt</pre>
<pre>/usr/src/<linux-version>/Documentation/sysrq.txt</pre>

Latest revision as of 04:47, 14 August 2009

--Drijen 15:06, 22 September 2007 (EDT)

Recovering from a System Lock

Sometimes a process can go out to lunch, or the system will simply stop responding to user input. This could be from a process waiting for resources or a zombie, but in any case there is no reason to have to reach for that reset button!

The Magic SysRq

The SysRq can be used as a means to save your work, sync the file system(s) and reboot the computer in a clean manner. If you don't know where the SysRq key is, look for the "Prt Scr" (Print Screen) button on your keyboard. SysRq is generally assigned to the same keypress.

Enabling the SysRq Function

To enable the SysRq functionality, you must have a 2.6.15 or higher kernel, and it must be compiled directly in. Not as a Module!

To check that you have it enabled you may run this command:


cat /boot/config |grep CONFIG_MAGIC_SYSRQ


OR

zcat /proc/config.gz |grep SYSRQ


if you have /proc/.config support compiled in. (All base slack kernels do)


which should return:


CONFIG_MAGIC_SYSRQ=y


If you find that you need to compile it in, the option can be found under the heading Kernel Hacking on your make <(x)(menu)config> screen.


Once you are satisfied that you have the SysRq funtion correctly compiled, ensure that it has not been disabled at boot:


cat /proc/sys/kernel/sysrq


If the response is 0 :

echo 1 > /proc/sys/kernel/sysrq


Recovering from a Lock Up using SysRq

If your system has gone out to lunch, you can now use the Magic SysRq key to save your work and reboot. The basic commands are as follows:

  Alt+SysRq+R :Attempts to remove keyboard from Raw mode
  Alt+SysRq+E :Terminate request sent to all processes (SIGTERM / kill -15)
  Alt+SysRq+I :Kills all processes (SIGKILL / kill -9)
  Alt+SysRq+S :Syncs all disks  
  Alt+SysRq+U :Force unmount and remount of all filesystems readonly
  Alt+SysRq+B :Reboots (INIT 6)

and roughly in that order. You should wait several seconds between each keystroke to let the system complete your request before you issue a new one.

There are several mnemonics to help you remember the key sequence:

   Raising Elephants Is So Utterly Boring
   Reboot Even If System Utterly Broken
   BUSIER, spelt backwards

An alternative method is to:

Alt+SysRq+R CTRL+ALT+DEL

This command will move the keyboard out of raw mode, and attempt to issue a SHUTDOWN NOW command. However, this will not work under some configurations, or if tty1 is defunct.

Futher Information

Further instructions and other options can be found at:

Wikipedia article on MagicSysRq [1]

/usr/src/<linux-version>/Documentation/sysrq.txt