Contents

Introduction

Say you have a server and you want to upgrade the kernel remotely, what happens if the kernel fails? Well with grub you have the option to boot a fallback kernel. This will describe how. Version .95 of Grub is required to do this.

Compile your new kernel

First compile your new kernel that you wish to install and place it in /boot - be sure to name it differently than your old kernel.

Setup Grub

To set up grub we must first edit the config. If you followed the Gentoo Handbook's suggestions, your boot partition is /dev/hda1, so you must first:

mount /dev/hda1 /boot

Then, open /boot/grub/grub.conf in your favorite editor, and edit away:

Now set grub to boot off the new kernel next boot. This is very important, otherwise grub will halt at bootup with error number 15, which will require the manual removal of the savedefault fallback line, before a kernel can boot:

grub-set-default 0

Reboot

Now on reboot it will try the new kernel first, if for whatever reason it fails grub will boot back to the fallback kernel. This may require you to manually reboot your machine, so hopefully you have acccess to the power strip for a reboot.

You can also append "panic=30" to your kernel options which should make the kernel reboot after 30 seconds if it oopses.

Explanation: Regarding power strip and remote rebooting

If the computer won't reboot using the panic=30 option, you may be stuck.
There are two ways you can cause a hardware reset. The first is to have the
datacenter or colo staff reset your computer. That takes time, usually too much.
The second is to use a "reboot bar" Search the internet for reboot bar. There
are different products, from rack mount units to small 1 outlet units,
for example "iboot"
You can use also IPMI, hardware module (BMC/miniBMC) embedded by default ,for example, in most
modern Intel(R) server motherboards. It provides network way to reboot server, by sending
special packet to network card, even over routed networks.
Read more here: http://www.gnu.org/software/freeipmi/

On Fail

If the kernel fails the default kernel will be incremented to 1 and therefore revert to the old kernel. This will be done next reboot.

On Success

If the kernel is successful you should have nothing to worry about. But next reboot it will still fallback to the old kernel, so you can now re-edit your config or rerun grub-set-default

Needs more explaination of things -- Thrasher 17:17, 30 Jul 2004 (GMT)
Also references to sources would be nice -- 28 May 2005