Reboot Linux box after a kernel panic

If you want the server to get rebooted automatically after kernel hit by a pain error message, try adding panic=N to /etc/sysctl.conf file.

It specify kernel behavior on panic. By default, the kernel will not reboot after a panic, but this option will cause a kernel reboot after N seconds. For example following boot parameter will force to reboot Linux after 10 seconds.

Open /etc/sysctl.conf file

# vi /etc/sysctl.conf

When kernel panic's, reboot after 10 second delay

kernel.panic = 10

Save and close the file. Alternatively, you may want to enable and use magic system request keys (SysRq).

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 2 comments… read them below or add one }

1 Anonymous 11.16.07 at 3:47 pm

Thanks for this tip. My computer had a kernel panic for the first time a couple of weeks ago and I had no choice but to reboot it manually.

2 mangoo 11.21.07 at 6:36 pm

One can also add panic=10 to the kernel command line, it will have exactly the same effect.

Of course, it’s possible to change it later with sysctl, or by writing to /proc:

echo 10 > /proc/sys/kernel/panic

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , ,

Previous post: XEN Server Status Monitoring Command Cheat Sheet

Next post: Hacking Nokia Series 60 Phones with Linux