Kernel Updates without the panic – reboot fails

Posted on February 1, 2008
Filed Under Kernel, Operating Systems, Updating software, Web Hosting | Leave a Comment

Updating your Kernel can be a very stressful excercise if the new kernel panics and wont reboot after the update, you’ll end up having to wait for someone at the datacentre, or via KVM, to cure the problem which can sometimes take hours. So…

If you are not running a customer kernel (if you don’t know the answer its probably no), then running yum -y update is good, but you need to put in a failsafe to fall back to the old or previously working kernel to save the ensuing downtime …

Run …

yum -y update

before rebooting, edit grub.conf and add …

panic=360

to the end of the kernel version lines (360 = 360 seconds, this is a good value to use, anything too short will not give time for the server to fully load the new kernel so it may give a false negative and fall back to the old kernel even though it would have loaded just fine), i.e….

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-53.1.4.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-53.1.4.el5 ro root=LABEL=/ panic=360
initrd /boot/initrd-2.6.18-53.1.4.el5.img
title CentOS (2.6.18-8.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ panic=360
initrd /boot/initrd-2.6.18-8.el5.img

Then run this command from SSH as root…

echo "savedefault --default=1 --once" | grub --batch

Then reboot.

This will force a reboot on the next kernel version in the list if the latest one panics and fails to load.

Check which kernel has been loaded with…

uname -a

If you see the new kernel then all is fine. If it failed it will show the old kernel and you may want to try extending the panic value (say panic=600 which is 10 minutes), if it fails again then you know it will no work, so…

you can remove the update that failed to boot…

yum remove kernel-2.6.18-53.1.4.el5

obviously use the correct version number in the above example.

And then you will want to exclude that version from subsequent updates when using yum, so add an exclude in your yum.conf [MAIN] section…

exclude=kernel-2.6.18-53.1.4.el5

again, obviously using the correct version number in the example above.

Web Hosting special offers

 

 

Recently


Categories


Archives

website promotion