Magic SysRq Key

Posted by zbrom on August 01, 2013 · 3 mins read

Magic SysRq key is a key combination which directly provides instructions to the Linux kernel. Itllows the user to perform various low-level commands regardless of the system’s state. It may be used to recover from freezes, allowing the user to reboot a computer without corrupting the filesystem.


SysRq Key Location

Action
QWERTY
Set the console log level, which controls the types of kernel
messages that are output to the console
0 through 9
Immediately reboot the system, without unmounting or syncing
filesystems
b
Reboot kexec and output a crashdump c
Display all currently held Locks
(CONFIG_LOCKDEP kernel option is required)
d
Send the SIGTERM
signal to all processes except init (PID 1)
e
Call oom_kill, which kills a process to alleviate an OOM
condition
f
When using Kernel Mode Setting, provides emergency support for
switching back to the kernel’s framebuffer console[3]
If the in-kernel debugger ‘kdb’ is present, enter the debugger.
g
Output a terse help document to the console
Any key which is
not bound to a command should also perform this action
h
Send the SIGKILL
signal to all processes except init
i
Forcibly “Just thaw it” – filesystems frozen by the
FIFREEZE ioctl.
j
Kill all processes on the current virtual console
(Can be used to kill X and svgalib programs, see below)
This was originally designed to imitate a secure attention key
k
Shows a stack backtrace for all active CPUs. l
Shows a stack backtrace for all active CPUs. m
Reset the nice level of all high-priority and real-time tasks n
Shut off the system o
Output the current registers and flags to the console p
Display all active high-resolution timers and clock sources. q
Switch the keyboard from raw mode, the mode used by
programs such as X11 and svgalib, to XLATE mode
r
Sync all mounted filesystems s
Output a list of current tasks and their information to the console t
Remount all mounted filesystems in read-only mode u
Forcefully restores framebuffer console, except for ARM
processors, where this key causes ETM buffer dump
v
Display list of blocked (D state) tasks w
Used by xmon interface on PPC/PowerPC platforms. x
Show global CPU registers (SPARC-64 specific) y
Dump the ftrace buffer z