Grub: Fallback after Kernel Panic

This quick post is for those. Who, like me are managing servers at a remote location without any KVM support. By KVM support I mean extra Operating system visibility, where you can not access the servers unless and until its booted.

A very common problem in such kind of a scenario is to install and boot a new kernel either for just simple upgrade purpose or after a custom compilation. And in any case if new the kernel doesn’t boot you can get stuck till the time you can get some one to physically reboot the machine and select the older kernel at the time of system bootup

But, there is a way out. And this is inbuilt in GRUB (The most common Linux Bootloader). This mechanism is called Grub Fall-back. In this case you can set your older/tested kernel as the Fallback kernel in case your New kernel panics. And here is how you do it:

All you have to do is to open your /boot/grub/grub.conf and add a few lines in it like this


{commonly this is a numeric value defining which kernel is default. First one stands for 0 and goes one, but for fall back we change it to ‘saved’)
fallback 0 1
{this is an extra line which you generally don’t see in a regular grun.conf, this tells me which kernel to try first and in case it fails which to fallback)
title CentOS Testing (2.6.18-132)
root (hd0,0)
kernel /vmlinuz-2.6.18-132 ro root=LABEL=/ acpi=off noapic
initrd /initrd-2.6.18-132.img
savedefault fallback
{this is another special parameter, this signifies, in case of fault in this kernel, fallback}

title CentOS Working (2.6.18-128.el5)

root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-128.el5.img
savedefault {and finally this is the last special parameter, this signifies, that it’s the end of the fall-back loop, or in other words, this is where the system will fall back to. in case of a kernel panic)


If the above grub.conf is booted, then first Grub.conf will try to boot the system with “CentOS Testing” and if and only if the kenrel panics, it will call “CentOS Working” and boot the system

Hope this quick howto helps a few poor souls like me. Happy Kernel Compiling!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

Up ↑

%d bloggers like this: