GNU/Linux: Emergency RestartPosted: July 14, 2009
There’s a cool shortcut to help us when shit happens, it’ll reboot the computer and it’s a little bit nicer than yanking out the power cord. You just need to remember REISUB and have some keyboard dexitry – holding down Ctrl – Alt – SysRQ/PrintScreen is required while typing REISUB (don’t do it now, it’ll reboot your computer!).
So, what’s REISUB all about? It’s a little bit better than a forced hard reboot because it’ll:
R: Restore console
E: Send SIGTERM to all processes
I: Send SIGKILL to all processes
S: Emergency sync of all filesystems (commit any changes to the phisical media)
U: Read only remount of all filesystems
B: Reboot now
So, off course, you’ll have to wait a little bit between every keystroke. Press Ctrl + Alt + PrntScreen + H on a console to get some help on every command.
Why does it work?
There’s a lot of magic involved to make this secret incantation work. It involves kernels, vectors and other mythical beasts. There’s a crazy thing called interruption vector; it’s the place where every (hardware) event gets dispatched to a handling function. There lives a function call to handle keyboard input, amongst other things. This function call will be executed always, though the SO may just decide to queue the keyboard input if it’s too busy handling something else.
Well, this key combination can’t be delayed ’till later, it must be handled NOW, therefore, even if there’s a stray process or a driver gone mad, it’ll always be caught and the computer will be rebooted.
What’s the catch? You won’t be saving that precious code you we’re hacking away when it all started, but at least you’ll save some fscking time on the next start up.