Alt + SysRq + Command upon a Kernel Panic

Kernels & Hardware, configuring network, installing services

Alt + SysRq + Command upon a Kernel Panic

Postby emariz » 2012-04-29 00:56

I could proudly say that I literally did not remember when was the last time that I had experienced a kernel panic in Debian. Well, I experienced a kernel panic today. I was copying information between two LibreOffice Calc spreadsheets, and Iceweasel, Nautilus and LO Writer were also running. Nothing CPU- or RAM-intensive for this laptop (Intel i3, 4 GB of RAM). Anyway, the system stop responding but I could still move the cursor. I could not click on anything, and the keyboard did not respond, but the system could, for example, restore the back light after closing and opening the lid.

I did not know the reasons but I remembered that one should try Alt + SysRq + R E I S U B upon a kernel panic. I tried this combination and the system rebooted immediately. Then I searched for relevant error messages in /var/log, but there was nothing there. In fact, the last logged message was from an hour before the reboot. I did find the following messages regarding the SysRq operations:

Code: Select all
Apr 28 18:30:58 debian kernel: [97145.977280] SysRq : Keyboard mode set to system default
Apr 28 18:30:59 debian kernel: [97146.531345] SysRq : This sysrq operation is disabled.
Apr 28 18:30:59 debian kernel: [97147.068320] SysRq : This sysrq operation is disabled.
Apr 28 18:31:00 debian kernel: [97147.522839] SysRq : Emergency Sync
Apr 28 18:31:00 debian kernel: [97147.523079] Emergency Sync complete
Apr 28 18:31:00 debian kernel: [97148.167408] SysRq : Emergency Remount R/O


It seems that the combinations Alt+SysRq+E and Alt+SysRq+I (sending SIGTERM and SIGKILL to all processes except init, respectively) are disabled. For example, I thought that the system would not perform a file system check after issuing Alt+SysRq+REISUB. Is this disablement the cause?

This laptop only suspends to disk or to RAM, but it is never shut down. Its last reboot was on Tuesday, when the kernel was updated (from Backports).


Two questions:
1. Should I worry about those two SysRq operations (E I) being disabled?
2. Is the combination Alt+SysRq+R E I S U B the most effective one to recover a system? I already searched for information about it on the Internet and learnt what every operation does, but there are different combinations of them.
emariz
 
Posts: 2904
Joined: 2008-10-17 07:59

Re: Alt + SysRq + Command upon a Kernel Panic

Postby dasein » 2012-04-29 01:28

emariz wrote:I remembered that one should try Alt + SysRq + R E I S U B upon a kernel panic.

:cool:

emariz wrote:I thought that the system would not perform a file system check after issuing Alt+SysRq+REISUB.

That's not exactly true. REISUB makes fsck much less likely, but it all comes down to whether a drive is "dirty" in the eyes of the filesystem.

emariz wrote:2. Is the combination Alt+SysRq+R E I S U B the most effective one to recover a system?

Opinions vary on this question, but since you say you've already read up what the various options do, I will merely say that IMO, yes, REISUB is the "best" sequence.

My rationale goes something like this: if you "work backwards," you'll see that each step in REISUB "builds" logically on the step immediately before it. That is, unmount before rebooting, sync before unmounting, kill before syncing, etc. None of the other orderings makes nearly as much sense. (Particularly not the seemingly popular RSEIUB, which strikes me as totally out-of-whack.)

I've never seen the "operation is disabled" error/message before. And Google is no damn help. Here's hoping a kernel guru will happen by to educate us.

Edit: Found this. Certainly informative, and potentially helpful: http://kernel.org/doc/Documentation/sysrq.txt
(Not sure what the "official" rationale might be for disabling certain sysrq functions. But then, I've never understood the rationale for disabling ctrl-alt-backspace, either.)
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

Postby kevmitch » 2012-04-29 05:38

Just to be pedantic about it, this wasn't a kernel panic. In an actual kernel panic, sysreq doesn't work and your caps/numlock flashes.

I see what you mean about the disabled functions. In squeeze, the file /proc/sys/kernel/sysrq contains some number like 438, wheras to enable all sysreq functions, it should just be 1. If you want to "fix" this, you can add
Code: Select all
kernel.sysrq=1

to /etc/sysctl.conf.
kevmitch
 
Posts: 498
Joined: 2008-01-29 20:43

Re: Alt + SysRq + Command upon a Kernel Panic

Postby confuseling » 2012-04-29 14:44

dasein wrote:...Not sure what the "official" rationale might be for disabling certain sysrq functions. But then, I've never understood the rationale for disabling ctrl-alt-backspace, either.)


Alt-sysrq-k still works. Don't really see where the difference is - I doubt you're any less likely to do that by accident than ctrl-alt-backspace.
The Forum's search box is terrible. Use site specific search, e.g.
https://www.google.com/search?q=site%3A ... terms+here
confuseling
 
Posts: 2144
Joined: 2009-10-21 01:03

Re: Alt + SysRq + Command upon a Kernel Panic

Postby emariz » 2012-04-29 21:57

dasein wrote:Opinions vary on this question, but since you say you've already read up what the various options do, I will merely say that IMO, yes, REISUB is the "best" sequence.

My rationale goes something like this: if you "work backwards," you'll see that each step in REISUB "builds" logically on the step immediately before it. That is, unmount before rebooting, sync before unmounting, kill before syncing, etc. None of the other orderings makes nearly as much sense.

Found this. Certainly informative, and potentially helpful: http://kernel.org/doc/Documentation/sysrq.txt

Yeah, it makes sense to me too, but I had never actually thought about it and this is a crucial sequence to remember. Also, thanks for the link, I bookmarked it. Its author also states that he "generally 'S'ync, 'U'mount, then re'B'oot when [his] system locks".

kevmitch wrote:Just to be pedantic about it, this wasn't a kernel panic. In an actual kernel panic, sysreq doesn't work and your caps/numlock flashes.

I see what you mean about the disabled functions. In squeeze, the file /proc/sys/kernel/sysrq contains some number like 438, wheras to enable all sysreq functions, it should just be 1. If you want to "fix" this, you can add kernel.sysrq=1 to /etc/sysctl.conf.

You know what, after reading more comments on the Internet, I also realised that my system might have only locked but did not suffer a kernel panic. In fact, the link provided by dasein states that the SysRq operations might not work if "the system is completely locked up". Ah!, thanks for pointing out how to enable all SysRq operations.
emariz
 
Posts: 2904
Joined: 2008-10-17 07:59

Re: Alt + SysRq + Command upon a Kernel Panic

Postby dasein » 2012-04-29 22:27

emariz wrote:Its author also states that he "generally 'S'ync, 'U'mount, then re'B'oot when [his] system locks".

The SIGTERM and SIGKILL steps strike me as crucial to an effective emergency shutdown. Merely performing a sync accomplishes little if processes that write to disk are still running. (In fact, it strikes me as likely that it is exactly why the box still needed to be fscked.)

I found this thread to be superbly informative. I've had to do an emergency shutdown on a Debian box a couple of times over the years, and I never knew until now that SIGTERM and SIGKILL were disabled in Debian. I've now updated my configuration to allow both.
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

Postby emariz » 2012-04-30 02:20

dasein wrote:I found this thread to be superbly informative. I've had to do an emergency shutdown on a Debian box a couple of times over the years, and I never knew until now that SIGTERM and SIGKILL were disabled in Debian. I've now updated my configuration to allow both.

I did that too. Here is a brief explanation of the meaning of the number 438 used by Debian. It turned out to be the sum of the binary numbers associated with each enabled SysRq operation.
http://superuser.com/questions/375816/c ... q-in-linux
emariz
 
Posts: 2904
Joined: 2008-10-17 07:59

Re: Alt + SysRq + Command upon a Kernel Panic

Postby dasein » 2012-04-30 03:25

emariz wrote:...this is a crucial sequence to remember.

There are a couple of mnemonics for the sequence. The one that I found easiest to remember is that it's "busier" spelled backwards.
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

Postby emariz » 2012-05-03 14:37

dasein wrote:There are a couple of mnemonics for the sequence. The one that I found easiest to remember is that it's "busier" spelled backwards.

Well, it may make sense to native English speakers, but English pronunciation is so irregular that is does not help us at all. For me, that means pressing AIR-EE-BIZ, which would certainly explode my system.


It seems that the system freeze was caused by a problem with the video driver. I created a new thread to discuss about it (1) and left this thread focused on the SysRq operations.

1. viewtopic.php?f=6&t=79169
emariz
 
Posts: 2904
Joined: 2008-10-17 07:59

Re: Alt + SysRq + Command upon a Kernel Panic

Postby pendrachken » 2012-05-05 00:37

dasein wrote:
emariz wrote:...this is a crucial sequence to remember.

There are a couple of mnemonics for the sequence. The one that I found easiest to remember is that it's "busier" spelled backwards.


My fav. is Resurrecting Elephants Is So Utterly Boring.

Guess I think my servers are Elephants or some....
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1326
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Alt + SysRq + Command upon a Kernel Panic

Postby dasein » 2012-05-05 01:23

Thre's also: Reboot Even If System Utterly Broken
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

Postby Mr James » 2012-05-05 01:40

I've got the worst memory in the world. While I'll forget most everything (including my own cellphone number) for some reason I'm able to remember it as just REISUB. :?

Edit: I can also remember package names like libgl1-mesa-dri while forgetting things like where I put my keys. Go figure.
E8400 P5QL 4GB 9600GT 1TB 23" 1920x1080 Debian/Wheezy dwm i386*
* found myself pulling in truckloads of multiarch packages, so...
User avatar
Mr James
 
Posts: 1249
Joined: 2010-09-10 13:02

Re: Alt + SysRq + Command upon a Kernel Panic

Postby dasein » 2012-06-04 01:30

Mr James wrote:Edit: I can also remember package names like libgl1-mesa-dri while forgetting things like where I put my keys. Go figure.

You make this sound like it's in some way unusual. ;)

(Sorry for the necro post. Missed Mr James' last remark when the thread was active, and only saw it now because I searched this thread in order to point someone to it.)
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

Postby robert-e » 2012-06-04 16:46

I added kernel.sysrq=1 to the system control file, but the reisub key sequence still did not work. Pressing the sysrq function key gives the same result as pressing the prtsc key..ie..opens a screen capture window. I did reboot after adding the "kernel.sysrq=1" line. Using squeeze, gnome2 64 bit. I suspect there is a problem with keyboard mapping, but keyboard is the standard us kb in english install. Just for your info.
Regards,
Bob
robert-e
 
Posts: 44
Joined: 2011-12-09 21:29

Re: Alt + SysRq + Command upon a Kernel Panic

Postby dasein » 2012-06-04 16:53

That's why the combination is called Alt+SysReq+[whatever key(s)]

There's also a weirdness experienced/reported by some folks where REISUB (or portions of it) work only if the ALT key on the left-hand side of the keyboard is used. (And no, I'm not joking. It's bizarre.)
Last edited by dasein on 2013-02-22 01:27, edited 1 time in total.
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable