Kernel panic reboot

By default after a kernel panic Linux just sits there and waits for a user to hit the restart button. That can be a bad thing if it’s a remote server.

Checking if enabled

To check if its enabled try this:

# cat /proc/sys/kernel/panic
0

The returned 0 is the time the kernel will wait before it reboots. If it is 0 or lower, it won’t reboot by itself.

Enabling kernel panic reboot

To set the kernel to reboot do this command

# echo "5" > /proc/sys/kernel/panic

Where 5 is replaced with the number of seconds to wait till reboot after a kernel panic.

To check the time was set right do this:

# cat /proc/sys/kernel/panic
5

Making it permanent

To make it more permanent do this:

# echo "kernel.panic=5" >> /etc/sysctl.conf

Adding the following to your kernel parameters in your bootloaders configuration might also help:

panic=5

NOTE: Substitute 5 with the number of seconds to wait till reboot after a kernel panic.

Source: http://gentoo-wiki.com/TIP_Kernel_Panic_Reboot