Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I understand that the SysRq key can be used to execute low-level system commands on a crashed linux server.

Can someone explain how to use this feature, whether it works remotely over ssh or a vmware console window, and anything else it can be used for (besides rebooting a crashed system)?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

SysRq key commands are issued by holding down Alt+SysRq and typing any combination of keys. The most common combination that I'm aware of is Alt+SysRq+RSEIUB

R - Switch the keyboard from raw mode
S - Sync all mounted filesystems
E - Send the SIGTERM signal to all processes except init
I - Send the SIGKILL signal to all processes except init
U - Remount all mounted filesystems in read-only mode
B - Immediately reboot the system, without unmounting partitions or syncing

The wikipedia page has more information on the various keys and what they do.

To answer the rest of your question, yes it works remotely (as long as you still have communication with the system) and in a VMWare console. As long as the kernel is reading keystrokes, the SysRq inputs will be read and acted on. (It effectively sends commands directly to the kernel, bypassing the rest of the system)

share|improve this answer
    
en.wikipedia.org/wiki/Reisub –  Ian Kelling May 23 '09 at 4:02

You can run alt-sysrq-/ (alt-sysrq-? with shift not mattering) to get the list of available commands. New ones are being added all the time. Most are dangerous.

To run alt-sysrq-T, you can also "echo T > /proc/sysrq-trigger", or on a serial console break-T.

Some Linux distributions come with the magic sysrq disabled as a misguided security measure. You'll see "kernel.sysrq = 0" in /etc/sysctl.conf. Change this to "kernel.sysrq = 1" and run "sysctl -p". You should always check for this on a new Linux system before running into a freeze that makes you wish magic sysrq was working.

share|improve this answer

REISUB is used most often, to safely reboot a stuck up system. But it is not the only possible combination.

Normally sysrq does not work when X is running. If a ctrl+alt+fX does not work, you can try sending 'R' before it. If unsuccessful, sometimes a "saK" with 'K' fixes things; It kills all processes within current runlevel, including the X server. Then you can try other sysrq commands. After a saK to the X server, you can even login from a tty if the system is still running.

And sometimes when a silly process freezes the boot, when ctrl+C, ctrl+Z or ctrl+alt+del do naught, an 'E' followed by a ctrl+alt+del can do a safe and normal reboot.

'T' command prints a trace so you can inspect which process or function is causing problems.

See alt of the commands by pressing alt+sysrq+H

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.