Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.
Question: How can I get my Linux server rebooted/restarted automatically if it caught a kernel panic?
Answer: As you might know, kernel panic is an action taken by an operating system upon detecting an internal fatal error from which it cannot safely recover; the term is largely specific to Unix and Unix-like systems (it’s a wiki’s description).
By default Linux wouldn’t not reboot after panic occurs, but the following option of sysctl will cause a kernel to reboot after N seconds you specify. In our example server will be rebooted in 15 seconds if kernel panic stopped its operation:
1. Open sysctl’s configuration file:
sudo nano /etc/sysctl.conf
2. Add there the following line:
kernel.panic = 15
or
1. Execute the following command:
/sbin/sysctl -w kernel.panic=15
Hope it helps!


Very nice tip, this is very useful to admins who administer linux boxes remotely.
Great tip, I didn’t even know it’s possible.
This tip is very useful if you compile a new kernel remotely, and you want a safe net if something goes wrong; but you must pay attention to not load the same kernel when you startup (so new kernel not on default in lilo/grub )