The Magic SysRq Key

Today I came across (via Digg) some stuff on Linux’s Magic SysRq key. I’m yet to be able to try it, but it’s apparently a low-level way of controlling the system when it goes haywire. You do need to enable it in the kernel, but I’m under the impression it’s enabled by default*.

I’ve been running Compiz on XGL, both of which are experimental software. Certain obscure combinations of activities will freeze it, and the system appears locked up. I strongly suspect that it’s not ‘truly’ frozen, though, but since it’s my user interface, short of pulling up another computer and remotely logging in, there’s not much I can do. Traditionally I just turn the machine off. The “REISUB” method will hopefully let you ‘cleanly’ shut down the system, by getting the kernel to terminate all processes, unmount disks, and then reboot.

It looks like there’s more, though… You could regain control of the keyboard and then just kill everything on the current VT, in theory, at least, letting you just restart X.

  • You can check if it’s enabled by checking for a /proc/sys/kernel/sysrq, which should contain “1” if enabled. This page also covers making the command ‘sticky’ so you’re not in the awkward situation of trying hold down Alt + SysRq + another key. (And in my case, SysRq is a ‘function’ key, so it’d be Alt+SysRq+Fn+r, for example.)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.