Tuesday, May 27, 2008

The Magic SysRq Key

Even though Ubuntu or Linux as a whole is stable there are times it can lock up due to a software problem or other coding error.

Pressing the Ctrl + Alt + Backspace to restart X doesn't work. Your system is locked up tight. Before pressing that power button try using the Magic SysRq key.

Just what is this magical key? Well it's a key combo that allows you to reboot your system without corrupting the file system.

Here's how;

Pressing the Alt + SysRq + B keys will cause your computer to reboot.
The SysRq key is the key with Print Screen on it.

Since this feature was compiled into the kernel it will over ride any system freeze or locked up software.

The above key combo will reboot your system but there is a much safer way that will help preserve data in any open files and prevent file system corruption.
All you need to remember is the word BUSIER backwards or Raising Elephants Is So Utterly Boring.

Start with the Ctrl + SysRq + R key combo. Wait a few seconds and press the
Ctrl + SysRq + E key combo. Continue with the remaining I , S , U and B keys making sure to wait a few seconds between each key combo.

The complete combo stands for;
Raw (take control of keyboard back from X)

tErminate (send SIGTERM to all processes, allowing them to terminate gracefully)

kIll (send SIGKILL to all processes, forcing them to terminate immediately)

Sync (flush data to disk), Unmount (remount all filesystems read-only)

reBoot.

These keystrokes should be entered a few seconds apart. This should prevent a fsck being required on reboot; it also gives some programs a chance to save emergency backups of unsaved work.


So next time you have a hard lock up and all other key combos don't work try this work around that will be easier on your hard drive and file system.

TaZMAn

2 comments:

Koselara said...

Just found this entry by hunting info on the Magic SysRq key, and thought I'd echo an even easier acronym for the combination:

Reboot
Even
If
System
Utterly
Borked

TaZMAn said...

Hi Koselara,

I like that! Much easier to remember and makes more sense.

Thanks!!