From Fedora Project Wiki

< QA

Revision as of 09:54, 16 March 2009 by Johannbg (talk | contribs)



What is the magic SysRq key?

It is a 'magical' key combo you can hit which the kernel will respond to regardless of whatever else it is doing, unless it is completely locked up.

How do I enable the magic SysRq key?

You need to say "yes" to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when configuring the kernel. When running a kernel with SysRq compiled in, /proc/sys/kernel/sysrq controls the functions allowed to be invoked via the SysRq key. By default the file contains 1 which means that every possible SysRq request is allowed (in older versions SysRq was disabled by default, and you were required to specifically enable it at run-time but this is not the case any more). Here is the list of possible values in /proc/sys/kernel/sysrq:

  0 - disable sysrq completely
  1 - enable all functions of sysrq
 >1 - bitmask of allowed sysrq functions (see below for detailed function
         2 - enable control of console logging level
         4 - enable control of keyboard (SAK, unraw)
         8 - enable debugging dumps of processes etc.
        16 - enable sync command
        32 - enable remount read-only
        64 - enable signalling of processes (term, kill, oom-kill)
       128 - allow reboot/poweroff
       256 - allow nicing of all RT tasks

You can set the value in the file by the following command:

   echo "number" >/proc/sys/kernel/sysrq

Note that the value of /proc/sys/kernel/sysrq influences only the invocation via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always allowed (by a user with admin privileges).

How do I use the magic SysRq key?

On x86 - You press the key combo 'ALT-SysRq-<command key>'. Note - Some

          keyboards may not have a key labeled 'SysRq'. The 'SysRq' key is
          also known as the 'Print Screen' key. Also some keyboards cannot
          handle so many keys being pressed at the same time, so you might
          have better luck with "press Alt", "press SysRq", "release SysRq",
          "press <command key>", release everything.

On SPARC - You press 'ALT-STOP-<command key>', I believe.

On the serial console (PC style standard serial ports only) -

          You send a BREAK, then within 5 seconds a command key. Sending
          BREAK twice is interpreted as a normal BREAK.

On PowerPC

Press 'ALT - Print Screen (or F13) - <command key>

On all

Write a character to /proc/sysrq-trigger: echo t > /proc/sysrq-trigger

What are the 'command' keys?