How to setup kernel fallback in CentOS6?
Folks, it’s been a long while since I have published an article. Here I’m explaining about how we can set kernel fallbacks in CentOS6 servers.
As SysAdmins, we need regular kernel updates to secure our server. To get the server active on the new kernel, we need to reboot the server unless it has kernelcare enabled.
For KernelCare enabled servers, the new kernels will get automatically activated without any reboots.
In normal servers, we’re not sure if the server will face any problems upon reboot for new kernels. In that scenario, we can enable fallbacks for our kernels.
That is, when kernel fallback is enabled in grub.conf, the server will check the default grub entry for kernel.
It’ll check the specified kernel and if the server face any problems with the new kernel, the server will try to load other kernels when it reaches the “timeout” entry.
How to partition a hard drive using “parted” command?
Parted – A useful information!
Recently I had to work on a “Parted” based server. Not always we’ll get chances to work on “parted” based servers. Hence I thought of documenting it. Parted is a command which helps you to modify hard-disk partitions. More than a command, it’s a GNU utility. Read more….
Here, I’m illustrating with kernels A, B and C. A is the new kernel, B and C are older kernels. The grub.conf reads the first kernel entry as 0.
First the server checks the kernel A, if the server isn’t booting with that kernel it’ll try loading kernel B. If B fails to load, then it’ll load kernel C.
These are the entries that we need in the /etc/grub.conf file to have kernel fallback.
default saved
timeout 10
fallback 1 2
title A
kernel /boot/vmlinuzx
root (hd0,1)
initrd /boot/initramfs-x.img
savedefault fallback
title B
kernel /boot/vmlinuzx
root (hd0,1)
initrd /boot/initramfs-x.img
savedefault fallback
title C
kernel /boot/vmlinuzx
root (hd0,1)
initrd /boot/initramfs-x.img
savedefault
By default, grub will load the “default saved” entry and will save a fallback entry as next boot entry with this configuration.
That is, when Grub tries to boot “A”, it will save 1 which is “B” as the next boot entry as the command specifies that 1 is the first fallback entry.
Similarly, when Grub tries to boot B, it saves 2 “C” as the next boot entry as fallback specifies 2 as the next boot entry.
By defining kernel fallbacks we can save our servers from unnecessary down times due to kernel problems. We can safely switch back to previous versions. I hope this article help you getting a clear picture on kernel fallbacks!
Heba Habeeb, thanks a lot for the post.Really thank you! Much obliged.
Most welcome!