Using Linux's magic SysRq feature
December 7, 2007
The 'magic SysRq' is a feature of the Linux kernel where you can directly invoke certain kernel commands, regardless of what happens to be going on at user level and often even if the system is fairly broken otherwise. Commands are conventionally described by the key that's used to invoke them.
There are three ways of invoking magic SysRq commands:
The first method always works, but the latter two are controlled
(Red Hat seems to turn it off, but Ubuntu leaves it alone and thus
enabled. Check your
The magic SysRq keys that I find most useful are:
(This is in roughly the frequency that I actually use them. The full list of available commands is in Documentation/sysrq.txt in the kernel source tree.)
A number of sources will give you involved sequences for rebooting a machine through magic SysRq commands. I tend to just sync, unmount, and then reboot; if a machine is damaged enough that I have to reboot it through magic SysRq, it is generally damaged enough that processes can't shut down cleanly if you send them signals.
(The case that's happened to us several times is a server's system disk
going partly read-only and partly inaccessible; many things that weren't
in active enough use to be in the kernel's cache were unavailable,
A number of magic SysRq commands are basically kernel diagnostic aids,
(If the system is moderately intact but not able to log things,
perhaps because your
A trivia note: magic SysRq stuff always works on the physical console, whether or not it is a kernel console. It only works on serial ports if they are actual serial consoles.
Written on 07 December 2007.
* * *
Atom feeds are available; see the bottom of most pages.