Kernel Panic Automatic Reboot

In the unlucky event of a Linux kernel panic, the default Ubuntu behaviour is for the system to sit and wait for the reset button to be pressed. Which sometimes useful for gathering diagnostic information, this can be rather inconvenient if the server is headless or remote. Therefore, this article modifies a kernel parameter to trigger an automatic reboot a specified number of seconds after the panic.

Should work in all Ubuntu releases. Tested from 8.04 (Hardy Heron) to 10.10 (Maverick Meerkat) on Ubuntu Server 64-bit.

None, as the kernel will already be installed! ;-)

Log on and become root:

sudo -s

Edit the file /etc/sysctl.conf and append the following to it:

# Automatic restart after kernel panic (seconds)
kernel.panic = 30

Once saved, check who is logged on and reboot the system to load the new parameters:

who
reboot