How to close down GNU/Linux safely after a system freeze with the SysRq key
- 2007-07-06
-
Write a full post in response to this!
Despite jeering at Windows for the infamous system freezes and blue screens of death, there are and will be times when your computer just locks up: the cursor is frozen and even invoking a console by Ctrl + Alt + [F2, F3, ...] to close down the X windows session running on F7 is non-functional.
My fellow blogger, Andrew Min, has given excellent tips on this website when faced with stubborn processes and applications that just refuse to terminate. This tip may be of assistance to those whose entire system has frozen and aren’t happy to just do a hard power off and trust to luck that data will not be corrupted. Fortunately GNU/Linux has journalled filesystems so the chances of this happening are reduced and you will not suffer the indignity of being told that you performed an illegal operation or having to drum your fingers waiting impatiently for scandisk to complete.
Like Ctrl + Alt + Delete this tip is a three fingered Vulcan neck pinch. It consists of Alt + SysRq and a selection of one other key (of which there are thirteen!), the choice of which will determine what operation is performed. This has been described as a way to communicate with the Kernel. It used to be that you had to enable this “magic key combo” when compiling a kernel but this is no longer necessary. (If your computer does not have a SysRq key then look for the “Print Screen” key—usually abbreviated to Prt Scr Normally, after certain key combos you will see “OK” and “Done”. If your kernel is really locked up you might not see them at all. If you have a file called /proc/sys/kernel/sysrq then you are okay and man proc should list it and it will be enabled if there is a “1” in it.
Alt + SysRq + B
If you’re not running any crucial, scheduled tasks or in the middle of composing a letter or an e-mail then this key combination may be the one to use. It will reboot the system immediately without bothering to sync or unmount disks.
Alt + SysRq + R
If you cannot get to a terminal window by using Ctrl + Alt + F2 then use this key combination (pressed altogether) to get a keyboard (this is because this key combination turns off what is called keyboard raw mode. Pressing these keys allows keyboard input even after your X-Windows session has crashed/frozen). Now, try Ctrl + Alt + F2 again and you can close down from the terminal. If that fails move on to the next option.
Alt + SysRq + S
This key combo does just what it says on the tin: it (S)ync’s all filesystems which reduces the possibility of loosing any data and possibly obviating the need for the system to run fsck upon reboot.
Alt + SysRq + U
As you might guess, this one tries to unmount disks and remount them as read only.
Alt + SysRq + O
Not so obvious, but this will power off your machine without syncing or unmounting disks (but it won’t reboot. See above).
If in doubt use a mnemonic
If you are not sure about the sequence to use or just can’t remember, why not use a memory aid like: Raising Elephants Is So Utterly Boring (REISUB) or Everything Is Superb (EISUB) or So Everything Is Unusual - Boot (SEIUB). If even that was too much effort for you, just do Alt + SysRq + H which will bring up a helpful list of the command above.
Write a full post in response to this!
Similar articles
Do you like this post?
Vote for it!
Copyright information
This entry is (C) Copyright by its author, 2004-2008. Unless a different license is specified in the entry's body, the following license applies: "Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved and appropriate attribution information (author, original site, original URL) is included".
Biography
An aspiring wanabee--geek whose background is a B.A.(hons) and an M.Phil in seventeenth-century English, twenty five years in local government and recently semi-retired to enjoy my ill-gotten gains.
- Gary Richmond's posts
- Login or register to post comments
- 31038 reads
- Printer friendly version (unavailable!)




Best voted contents
-
Free software heroes: from Stallman to Google, a list of inspiring individuals who made everything possible
Tony Mobily, 2008-06-15 -
Ian Lynch's take on the BECTA fiasco
Tony Mobily, 2008-06-17 -
The Groklaw effect hits Becta. And yes, I am coining a new term
Tony Mobily, 2008-06-15 -
Mail merge in OpenOffice.org
Michael Crider, 2008-06-17
Similar entries
Buzz authors
All news
Other sites
- The Top 10 Everything (Dave). The good, the bad and the ugly.
- Free Software news (Dave & Bridget). All about free software -- free as in freedom!
- Book Reviews: Illiterarty (Bridget). Book reviews, blogs, and short stories.
Hot topics - last 60 days
-
A future without Microsoft
Tony Mobily, 2008-06-08 -
Vienna failed to migrate to GNU/Linux: why?
Tony Mobily, 2008-06-09 -
Free software heroes: from Stallman to Google, a list of inspiring individuals who made everything possible
Tony Mobily, 2008-06-15 -
Dubious ads in Free Software Magazine
Tony Mobily, 2008-05-25 -
The Bizarre Cathedral - 6
Ryan Cartwright, 2008-05-25
Hot topics - last 21 days
-
Free software heroes: from Stallman to Google, a list of inspiring individuals who made everything possible
Tony Mobily, 2008-06-15 -
The Groklaw effect hits Becta. And yes, I am coining a new term
Tony Mobily, 2008-06-15 -
Is Asus backsliding on GNU/Linux?
Gary Richmond, 2008-06-19 -
Ian Lynch's take on the BECTA fiasco
Tony Mobily, 2008-06-17
Dedicated server
Problem with SysRq key
Submitted by sonoftheclayr (not verified) on Sat, 2007-07-07 04:38.
Vote!I found this article very useful as I sometimes find myself in a situation such as this and am forced to turn the computer off manually. I have on problem though. On my laptop SysRq is a function key and there is no key on my laptop to lock the function key down, if that makes sense. Is there some way I can change the combination or another solution?
RE: Problem with SysRq key
Submitted by mark541 (not verified) on Mon, 2007-07-09 17:03.
Vote!I've got a laptop with the same limitation. I've found that you can do it with the Function key with a little experimentation (and very flexible fingers). On my laptop I did it with this combination:
Alt + Function + SysRq + x (where x is one of R S E I U B etc.)
You may need to experiment if, for example, your laptop prefers it to be entered as:
Function + SysRq + Alt + x
I don't have my laptop with me at the moment, so I'm not sure if it works both ways (When it worked the first way, I didn't try the other).
did not work for me - opensuse 10.2
Submitted by Felipe Alvarez (not verified) on Tue, 2007-07-10 04:06.
Vote!I use a HP laptop (nx7400) with opensuse 10.2 My keyboard has PRTSC, SYSRQ, Fn (function) and of course the letters. The only thing that usually comes up is "HELP" menu in Firefox (alt + Fn + sysrq + H) or ksnapshot (K desktop). I tried it on my desktop PC with same OS and KDE, and only ksnapshot opens up. Any ideas?
If you enter the following
Submitted by John Beisley (not verified) on Thu, 2007-07-12 20:12.
Vote!If you enter the following into a terminal after you've done an Alt-SysRq-S, for example, you should see that in fact it *has* done something (well, it does for me):
$ dmesg | tail -n2
[ 4065.874162] SysRq : Emergency Sync
[ 4066.451217] Emergency Sync complete
Although in my case it also brings up the GNOME screenshot program, but the kernel *also* catches the SysRq, and does what is required.
Somebody's on crack
Submitted by Gonz (not verified) on Wed, 2007-07-18 01:03.
Vote!Somebody's on crack ALT+SyRq+AnyKey will give you a nice screen shot and thats about it.
Incorrect. Press one of the
Submitted by Anonymous visitor (not verified) on Mon, 2007-09-10 23:58.
Vote!Incorrect. Press one of the desired screens and then read your dmesg output (as pointed out above). Try ALT+SysRQ+H for example.
Your dmesg should put out something like this:
SysRq : HELP : loglevel0-8 reBoot Crashdump tErm Full kIll saK showMem Nice powerOff showPc unRaw Sync showTasks Unmount shoW-blocked-tasks
Works fine, but it does take a screenshot as well (or at least open up the dialog box)
Laptop 'soft keypad' overrides useful keys
Submitted by Anonymous visitor (not verified) on Sun, 2007-07-22 21:24.
Vote!Sadly, on my laptop, the kernel sysreq handler seems to interpret all the UIOPJKL;M,./ keys as part of the number pad, so this mostly just changes the log level. (more complex than that, because I use dvorak, so these keys are actually GCRLHTNSMWVZ).
Btw, to turn off the screen capture, you just need to edit your key bindings in X windows. Makes it much easier to test. Do a tail -f /var/log/messages to see what its doing.
If the numeric keypad as
Submitted by Anonymous visitor (not verified) on Fri, 2007-11-02 09:59.
Vote!If the numeric keypad as well as the SysRq key is accessed by pressing a 'Fn' key, try to release the 'Fn' key (while holding Alt/AltGr) after you have pressed the SysRq key. And - AltGr instead of Alt doesn't give me a screenshot ... :-)
Great!
Submitted by Andrew Min on Mon, 2007-07-23 16:22.
Vote!I for one am thrilled. Kubuntu occasionally freezes, and I've just been holding down on the power button. Now, I finally can avoid that!
--
Andrew Min
http://andrew.timstown.net/dock.htm