The Magic SysRq Key

October 24, 2007

[ignore]

One day I’ll stop apologizing for ignoring this blog for so long…

I’ve upgraded to Gutsy and it flies! I like Dolphin, the new file manager, and I’m sure it will get even better for KDE4.

There is one annoying glitch however. After waking up from STD (hibernate), all USB devices are dead. This has been fixed already in the latest kernel, and I’m just waiting for it to finally reach *Ubuntu repositories. Reading about the bug, I came across an interesting peculiarity of the Linux kernel. Sometimes I’m surprised at how much I don’t know ;)

[/ignore]

OK, here’s the deal. You can use the SysRq key to send requests directly to the Linux kernel. Why would you want to do that? Well, for starters, Linux may crash. WHAAAAT? Well, it may. Seldom, but it may. Especially if you mess around where you’re not supposed to :P

What can you ask the kernel to do using the SysRq key? Many things. One I find particularly useful is the Alt+SysRq+f. It kills the process which is using the most memory on your system. So when your system thrashes to death because of a runaway process, you don’t need to switch to the console (which may take ages) and use kill anymore. Just use the shortcut.

A few notes:

  • It’s Alt+SysRq and not just SysRq because the SysRq key shares a button with Print Screen, and without the Alt it would be interpreted as such.
  • IT DOESN’T WORK!! It may not work because you have a certain kernel option disabled. There’s not much you can do in that case, short of recompiling the kernel…
  • Be careful what you do. This is a gate directly into the kernel, and it allows you to do things like rebooting immediately without syncing disks, which could seriously screw up your file system.

Follow

Get every new post delivered to your Inbox.

Join 26 other followers