It happens: we're happily hacking on some code and out of nowhere X server freezes. It may be the latest Compiz whose at fault, or perhaps a stray program that decided it should start consuming all available CPU. Anyway, it's easier to reboot than trying to fix whatever got broken but Ctrl - Alt - Backspace is unresponsive and we can't drop to a console. It's not ussual but it happens. What can we do about it?
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.
Ctrl is not needed!
ReplyDeleteReally? All those years practicing yoga so I could reach that weird key combo, for nothing? Man, wish I knew that one sooner :)
ReplyDeleteI knew only about the B, thanks for the others.
ReplyDeleteAnd no, you don't have to press Ctrl :)
I have to keep a finger on my laptops Fn key to do this. It's most annoying. Almost snaps my fingers.
ReplyDeleteRESIUB, also remembered with the nice-to-know “Raising Skinny Elephants Is Utterly Boring”.
ReplyDeleteRESIUO will Power-Off instead of rebooting, which might sometimes also be useful.
You'd be surprised how many kiosks running Linux don't have this sequence disabled…
that will not work with kernels where the magic sysrq feature is not enabled
ReplyDelete> dsfadsfgafgf
ReplyDeleteIndeed. Luckly most laptops tend to have a smaller keyboard :)
> thisisabore
I'll have to try it next time I see one. There are not much of those over here, though. Most of the kiosks are Windows (it's fun to see the BSODs too)
Seems to me you don't need the first 3. "R" seems nice, though.
ReplyDelete"SUB" should be enough. I didn't know about "U". I've been doing "SSSSSSB" for years...
> David
ReplyDeleteMay be so may be not, but the look of awe when people look at you pressing a magical 18 key combo to reboot is priceless.
Why do people keep spelling fist f--king: "fscking"?
ReplyDeletethat's because they actually mean "fscking" - as in the verb "to run the fsck command"
ReplyDeletehttp://linux.die.net/man/8/fsck
the point of this article is to cleanly shutdown your computer when you cannot use conventional commands or menus to do so. this prevents data corruption or an inconsistent disk state, which can sometimes be fixed by running the fsck command on the disk.
"It's not usual but it happens."
ReplyDeleteYeah, like ever f'ing day.