Revision as of 12:24, 23 May 2014 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Official SysRq Documentation

There is a bit of a trick to using the Magic SysRq key sequence. The trick is to hold the Alt key during the entire process. Press Alt first; hold it; press the SysRq button; then press whatever key you want. Finally, you can release the Alt key.

If you are connected through a serial console (such as Xen's virtual console) then the SysRq key is often mapped by the console driver as Ctrl-O.

Output will not go to an X terminal. It will be printed on the console. Press Ctrl-Alt-F1 to switch view to the console.

Some manufacturers, such as Lenovo, have removed the SysRq print from the PrtScn key. This key still works as a SysRq.

One some keyboards (especially Microsoft), you may find a key called F Lock. This is a stupid key. It's almost like they added a new CapsLock key except that there is no indicator to show that it is turned on. Often you need to press this once before you start. If you switch to a text console you may find that you cannot switch back to the X Window platform. Press F Lock once again to restore the function of the function keys.

SysRq output

The output of SysRq is logged to the console. If you have debugging set very low then you might not see anything. You can run `dmesg` to see the output or you can increase log visibility by using a SysRq command. Press the following keys to set log visibility to a high level

Alt SysRq 9

Send SysRq without keyboard

You can bypass the keyboard magic keys simply be writing the command code that want to execute to the following file:

echo h > /proc/sysrq-trigger

Enable / Disable SysRq

Enable, write a 1. To disable, write 0:

echo 1 > /proc/sys/kernel/sysrq


Note: Sometimes called SysReq and Sys Request.

help (h)
;r: Switch the keyboard from raw mode to XLATE mode (the mode used by programs such as X11 and svgalib).
;e: Send SIGTERM to all processes except init.
;i: Send SIGKILL to all processes except init.
;s: sync all mounted filesystems.
;u: Remount all mounted filesystems in readonly mode.
;b: Immediately reboot the system, without syncing or unmounting filesystems.

;f: call OOM Killer to kill the process that takes the most memory.
;k: kill all processes running on the current virtual console.
;m: output memory information to the console.
;t: output a list of current tasks to the console.
;o: shutdown the system immediately.
;p: print the current registers and flags to the console.
;0-9: set the console log level, controlling which kernel messages will be printed to your console.

</pre> loglevel(0-9) reBoot Crash terminate-all-tasks(E) memory-full-oom-kill(F) kill-all-tasks(I) thaw-filesystems(J) saK show-backtrace-all-active-cpus(L) show-memory-usage(M) nice-all-RT-tasks(N) powerOff show-registers(P) show-all-timers(Q) unRaw Sync show-task-states(T) Unmount force-fb(V) show-blocked-tasks(W) dump-ftrace-buffer(Z) </pre>