This site is now 100% read-only, and retired.

The magic sysreq options introduced

Posted by chris on Wed 1 Nov 2006 at 13:32

Tags: ,

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.
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

What are the 'command' keys?

Turns off keyboard raw mode and sets it to XLATE.
Secure Access Key (SAK) Kills all programs on the current virtual console. NOTE: See important comments below in SAK section.
Will immediately reboot the system without syncing or unmounting your disks.
Will perform a kexec reboot in order to take a crashdump.
Will shut your system off (if configured and supported).
Will attempt to sync all mounted filesystems.
Will attempt to remount all mounted filesystems read-only.
Will dump the current registers and flags to your console.
Will dump a list of current tasks and their information to your console.
Will dump current memory info to your console.
Dumps Voyager SMP processor info to your console.
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.)
Will call oom_kill to kill a memory hog process
Send a SIGTERM to all processes, except for init.
Send a SIGKILL to all processes, except for init.
Send a SIGKILL to all processes, INCLUDING init. (Your system will be non-functional after this.)
Will display help ( actually any other key than those listed above will display help. but 'h' is easy to remember :-)



Re: The magic sysreq options introduced
Posted by Anonymous (88.161.xx.xx) on Wed 1 Nov 2006 at 14:20
Take a look on sysrqd if you want to use this via network.

[ Parent ]

Re: The magic sysreq options introduced
Posted by Steve (80.68.xx.xx) on Wed 1 Nov 2006 at 14:44
[ View Weblogs ]

Good tip.

Of course this does require the machine to still have a good networking stack/state .. otherwise it will fail.


[ Parent ]

Re: The magic sysreq options introduced
Posted by Federico2 (213.140.xx.xx) on Thu 2 Nov 2006 at 15:08
sysrqd can be very useful but be careful: the password is sent in clear text.

[ Parent ]

Re: The magic sysreq options introduced
Posted by Anonymous (67.95.xx.xx) on Wed 1 Nov 2006 at 16:32
Good idea re-posting this here, but you need to go through and replace your angle brackets with the HTML escapes:

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 ]