I normally would test whether sysrq + sub works when the kernel panic occurs, but "unfortunately" my system works pretty stable, and I have no idea how to make kernel panic. So the question is very simple. Does sysrq work when the kernel panics, or do I have to reboot the machine by using the reset button?

A bonus question: When the kernel reboots the system via the kernel.panic sysctl parameter, is it the exact same situation compared to pressing the reset button? Does the kernel make any actions before restarting the system, for instance sync or remount read-only?

  • Without testing, I believe kernel panic shuts down all kernel functions, including the magic sysrq. The water is muddied somewhat by all the kernels which don't have sysrq support enabled by default. – Tom Hunt Oct 28 '15 at 21:49

You should be able to generate a panic using:

sysctl kernel.panic=1
sysctl kernel.sysrq=1
echo c > /proc/sysrq-trigger

See https://www.kernel.org/doc/Documentation/sysrq.txt for details on the kernel.sysrq parameter and the 'c' command

The kernel.panic=1 parameter is to set to have the host to reboot after 1 second when a panic occured. If you want to investigate console output you might want to set the parameter to 0 to prevent the automatic reboot.

  • 1
    I've just tested echo c > /proc/sysrq-trigger and it looks like the kernel panics, but my desktop was frozen, I mean there was no console. I have 60 set in the kernel.panic parameter and after that time the machine was rebooted. So it looks like it works. Anyways, sysrq doesn't work at all. :) – Mikhail Morfikov Oct 28 '15 at 22:20
  • kernel.org/doc/Documentation/sysrq.txt gives a 404. – Aaron Franke May 13 '18 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.