Reboot on Kernel Panic

From AGwiki
Jump to: navigation, search

Normally the Linux kernel will sit patiently after a kernel panic and wait for someone to come press the reset button. If the computer is a server, this may not be the desired behaviour. Fortunately, there's a sysctl setting that will cause the kernel to reboot itself a preset number of seconds after a panic.

To enable this functionality set /proc/sys/kernel/panic to some value greater than 0:

echo 5 > /proc/sys/kernel/panic

5 is the number of seconds to wait after a panic before rebooting.

You will have to put this line in a startup script like /etc/rc.d/rc.local if you want this functionality to persist across reboots, or if your system supports /etc/sysctl.conf then add the following line to that file:

kernel.panic = 5