The magic sysreq options introduced
Posted by chris on Wed 1 Nov 2006 at 13:32
This content is taken from the linux kernel source documentation. I'm throwing it out here to make it easier for users to find. The sysreq key is a "magical" key combination to which your Linux kernel will respond, regardless of whatever it is doing.
For full details - see the file Documentation/sysrq.txt included in the Linux kernel source code.
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 use the magic SysRq key?
- On x86
- You press the key combo 'ALT-SysRq-
'. 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 Alt", "press ", release everything. - On SPARC
- You press 'ALT-STOP-
', 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) -
, Print Screen (or F13) - may suffice. - On other
- If you know of the key combos for other architectures, please let me know so I can add them to this section.
- On all
- write a character to /proc/sysrq-trigger. eg:
echo t > /proc/sysrq-trigger
- 'r'
- Turns off keyboard raw mode and sets it to XLATE.
- 'k'
- Secure Access Key (SAK) Kills all programs on the current virtual console. NOTE: See important comments below in SAK section.
- 'b'
- Will immediately reboot the system without syncing or unmounting your disks.
- 'c'
- Will perform a kexec reboot in order to take a crashdump.
- 'o'
- Will shut your system off (if configured and supported).
- 's'
- Will attempt to sync all mounted filesystems.
- 'u'
- Will attempt to remount all mounted filesystems read-only.
- '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.
- 'v'
- Dumps Voyager SMP processor info to your console.
- '0'-'9'
- 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.)
- 'f'
- Will call oom_kill to kill a memory hog process
- '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.)
- 'h'
- Will display help ( actually any other key than those listed above will display help. but 'h' is easy to remember :-)
What are the 'command' keys?
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Good tip.
Of course this does require the machine to still have a good networking stack/state .. otherwise it will fail.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Alt-SysRq-<command key>
You'll notice it currently shows as "Alt-SysRq-" or similar :)
Note #2: I put the escapes into this comment, and when I hit the preview function, it replaced my escape sequences with the actual characters, so I'm leaving the semicolons off (I guess I could experiment with multiple levels of & instead, but somehow I don't think it's necessary :p)
Note #3: Argh! It's adding the semicolon by itself and then converting _that_! OK, fine...just find the bug and fix it. :)
[ Parent | Reply to this comment ]
By a mistake I found on a box that pressing Ctrl-A F and then some letter dumped me a SysRq menu but unfortunately I can't experiment right now. Is there a documentation on that?
a bit offtopic: how to send a Ctrl-Alt-Del inside the minicom console?
[ Parent | Reply to this comment ]
[ Send Message | View dkg's Scratchpad | View Weblogs ]
I personally use screen instead of minicom for my serial console connections, invoked like this:
screen /dev/ttyS3 115200Screen will send a break with C-a b (again, assuming yer still using the default C-a esc. sequence for screen).
the canonical place to look up serial console stuff is the remote serial console HOWTO, which has a page about SysRq, which states:
The serial console uses the RS-232 break function as the "magic SysRq key". A "break" is a period of no transmission on the serial line, on traditional terminals it is activated by pressing a key labeled Break.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]