The magic SysRq Key

Posted by marc, Sun Sep 09 22:51:18 UTC 2007

http://en.wikipedia.org/wiki/Magic_SysRq_key
The magic SysRq key is a key combination in the Linux kernel which allows the user to perform various low level commands regardless of the system's state using the SysRq key. It is often used to recover from freezes, or to reboot a computer without corrupting the filesystem.

Magic commands: The key combination consists of Alt, SysRq and another key, which controls the command issued: 0 through 9 sets the console log level, which controls the types of kernel messages that are output to the console.

Example (Emergency Reboot):

  1. Alt + SysRq + R – takes the keyboard out of raw mode.
  2. Alt + SysRq + E – terminates all processes (except init).
  3. Alt + SysRq + I – kills all processes (except init).
  4. Alt + SysRq + S – synchronizes the disk.
  5. Alt + SysRq + U – remounts all filesystems read-only.
  6. Alt + SysRq + B – reboots the machine.
Here's an overview of the possible keys and their actions: The key combination consists of Alt, SysRq and another key, which controls the command issued: 0 through 9 sets the console log level, which controls the types of kernel messages that are output to the console.
  • b immediately reboots the system, without unmounting partitions or syncing.
  • c reboots kexec and outputs a crashdump.
  • e sends the SIGTERM signal to all processes except init (PID 1).
  • f calls oom_kill, which will kill a process that is consuming all available memory.
  • h, or any key which is not bound to a command, outputs a terse help document to the console.
  • i sends the SIGKILL signal to all processes except init.
  • k kills all processes on the current virtual console (and thus can be used to kill X and svgalib programs, see below). This was originally designed to imitate a Secure Access Key.
  • l sends the SIGKILL signal to all processes, including init.
  • m outputs current memory information to the console.
  • o shuts off the system.
  • p outputs the current registers and flags to the console.
  • r switches the keyboard from raw mode, the mode used by programs such as X11 and svgalib, to XLATE mode.
  • s attempts to sync all mounted filesystems.
  • t outputs a list of current tasks and their information to the console.
  • u attempts to remount all mounted filesystems in read-only mode.
  • v outputs Voyager SMP processor information.

| Filed Under: Nerdstuff Software tipps | Tags: