NSLU2-Linux
view · edit · print · history

Automatically Reboot on Panic

(An alternative - which will also catch hard locks, and some types of resource starvation - is to use the NSLU2's hardware watchdog e.g. see OpenSlug.Watchdog).

This is derived from http://gentoo-wiki.com/TIP_Kernel_Panic_Reboot I have not tested this yet myself, but it was felt to be interesting enough to add here; if this works for you please remove this disclaimer

This page only explains how to automatically reboot on a panic. If you want to automatically reboot after a power failure you'll need to make a hardware modification. See ForcePowerAlwaysOn

Checking if automatic reboot is enabled

To check if Automatic Reboot is enabled try this:

cat /proc/sys/kernel/panic

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

Enabling kernel panic reboot

To set the kernel to reboot do this command (as root):

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

and the value 5 (or whatever value you picked) should be returned.

Making it permanent

To make it more permanent do this (again as root):

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

Alternately, you can add a kernel parameter to your boot loader:

panic=5

This has the advantage of rebooting after a panic even if the panic happens before there is a chance for the system to interpret /etc/sysctl.conf (such as an attempted boot with a bad initrd)

view · edit · print · history · Last edited by dkg-debianorgfifthhorsemannet.
Based on work by t0ny, TimSmall, eFfeM, and repvik.
Originally by eFfeM.
Page last modified on July 11, 2006, at 11:40 PM