Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Alt + SysRq + Command upon a Kernel Panic

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
emariz
Posts: 2901
Joined: 2008-10-17 07:59

Alt + SysRq + Command upon a Kernel Panic

#1 Post by emariz »

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.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

#2 Post by dasein »

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.)

kevmitch
Posts: 498
Joined: 2008-01-29 20:43

Re: Alt + SysRq + Command upon a Kernel Panic

#3 Post by kevmitch »

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.

confuseling
Posts: 2121
Joined: 2009-10-21 01:03

Re: Alt + SysRq + Command upon a Kernel Panic

#4 Post by confuseling »

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

emariz
Posts: 2901
Joined: 2008-10-17 07:59

Re: Alt + SysRq + Command upon a Kernel Panic

#5 Post by emariz »

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.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

#6 Post by dasein »

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.

emariz
Posts: 2901
Joined: 2008-10-17 07:59

Re: Alt + SysRq + Command upon a Kernel Panic

#7 Post by emariz »

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

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

#8 Post by dasein »

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.

emariz
Posts: 2901
Joined: 2008-10-17 07:59

Re: Alt + SysRq + Command upon a Kernel Panic

#9 Post by emariz »

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. http://forums.debian.net/viewtopic.php?f=6&t=79169

pendrachken
Posts: 1394
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Alt + SysRq + Command upon a Kernel Panic

#10 Post by pendrachken »

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

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

#11 Post by dasein »

Thre's also: Reboot Even If System Utterly Broken

User avatar
Mr James
Posts: 1258
Joined: 2010-09-10 13:02

Re: Alt + SysRq + Command upon a Kernel Panic

#12 Post by Mr James »

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.
asus S551L laptop :: debian stable :: dwm

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

#13 Post by dasein »

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.)

robert-e
Posts: 44
Joined: 2011-12-09 21:29

Re: Alt + SysRq + Command upon a Kernel Panic

#14 Post by robert-e »

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

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Alt + SysRq + Command upon a Kernel Panic

#15 Post by dasein »

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.

robert-e
Posts: 44
Joined: 2011-12-09 21:29

Re: Alt + SysRq + Command upon a Kernel Panic

#16 Post by robert-e »

Interesting..on my keyboard the sysrq key is a function key..OTOH, I did try with just Alt+sysrq and still got the "capture" screen. ??? No problem...just giving a heads up to any reading this thread.
Regards,
Bob

Post Reply