Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
                      MAGIC SYSRQ KEY DOCUMENTATION v1.0
                     ------------------------------------
                        [Fri Apr  3 08:27:12 EST 1998]

1. What is the magic SysRQ key?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is a 'magical' key combo you can hit, and the kernel will respond to
regardless of anything else, unless it is hard-locked.

2. How do I enable the magic SysRQ key?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You need to say yes to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when
configuring the kernel. This option is only available it 2.1.x or later
kernels.

3. How do I use the magic SysRQ key?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You press the key combo 'ALT-SysRQ-<command key>'.

4. What are the 'command' keys?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'r'     - Turns off keyboard raw mode and sets it to XLATE.

'k'     - Kills all programs on the current virtual console.

'b'     - Will immediately reboot the system without syncing or unmounting
          your disks.

'o'     - Will shut your system off via APM (if configured and supported).

's'     - Will attempt to sync all mounted filesystems.

'u'     - Will attempt to remount all mounted file systems readonly.

'p'     - Will dump the current registers and flags to your console.

't'     - Will dump a list of current tasks and their information to your
          console.

'm'     - Will dump current memory info to your console.

'0'-'8' - Sets the console log level, controlling which kernel messages
          will be printed to your console. ('0', for example would make
          it so that only emergency messages like PANICs or OOPSes would
          make it to your console.)

'e'     - Send a SIGTERM to all processes, except for init.

'i'     - Send a SIGKILL to all processes, except for init.

'l'     - Send a SIGKILL to all processes, INCLUDING init. (Your system
          will be non-functional after this.)

5. Okay, so what can I use them for?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Well, un'R'aw is very handy when your X server or a svgalib program crashes.

sa'K' (system attention key) is useful when you want to exit a program
that will not let you switch consoles. (For example, X or a svgalib program.)

re'B'oot is good when you're unable to shut down. But you should also 'S'ync
and 'U'mount first.

'S'ync is great when your system is locked up, it allows you to sync your
disks and will certainly lessen the chance of data loss and fscking.

'U'mount is basically useful in the same ways as 'S'ync. I generally 'S'ync,
'U'mount, then re'B'oot when my system locks. It's saved me many a fsck.

The loglevel'0'-'8' is useful when your console is being flooded with
kernel messages you do not want to see. Setting '0' will prevent all but
the most urgent kernel messages from reaching your console. (They will
still be logged if syslogd/klogd are alive, though.)

t'E'rm and k'I'll are useful if you have some sort of runaway process you
are unable to kill any other way, especially if it's spawning other
processes.

6. Sometimes SysRQ seems to get 'stuck' after using it, what can I do?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
That happens to me, also. I've found that tapping shift, alt, and control
on both sides of the keyboard, and hitting an invalid sysrq sequence again
will fix the problem. (ie, something like alt-sysrq-z).

7. I have more questions, who can I ask?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You may feel free to send email to myrdraal@deathsdoor.com, and I will
respond as soon as possible.
 -Myrdraal