Friday, July 23, 2010

Linux: Automatic Reboot on Kernel Panic

Automatic Reboot on Kernel Panic

This guide will help you configure your server so that in the event of a kernel
panic your server will automatically restart itself. This saves you the trouble
of submitting a reboot request for your server and has the side-effect of
helping to prevent downtime.

There are several different ways that this little-known trick can be
accomplished. We'll go over each method.

On-Startup Command This command can be placed into your server startup scripts.
It must be performed each restart to be effective. This method is sure-fire and
should work on any distribution of linux.

    echo 60 > /proc/sys/kernel/panic

Using Lib

If you are unsure if you are using lib or not, see if you have a file
/etc/lib.conf. If this file exists, then you are okay to place the command
below into the file. If you do not have this file, use a different method.


Once you modify this file and save it you will want to restart lib:

    # /sbin/lib

Using Grub

 If you utilize grub, you may append this to your boot config line:


Bear in mind that by doing this, unless you carefully monitor your system logs
you will not know if a kernel panic has occurred. It does help minimize the
effect of downtime in the event of a kernel panic however.

No comments: