2015년 8월 2일 일요일

RHEL/CentOS downgrading to a previously-installed kernel without using yum

Suppose you did a kernel upgrade and the current version is now 2.6.18-308.el5 (stock kernel for RHEL 5.8) but you want to downgrade to 2.6.18-194.el5 (stock kernel for RHEL 5.5) which is still installed on the system and appears in grub.conf.

1. Edit /boot/grub/grub.conf and make sure that the default entry points to the previous kernel (probably default=1, but YMMV)

2. Reboot the system. You should now boot into the previous kernel version. After logging in, remove the higher kernel version from the system:

rpm -e kernel-2.6.18-308.el5 kernel-devel-2.6.18-308.el5

Now all traces of the higher-version kernel will be gone and it will not appear in grub.conf

What if you want to do a kernel downgrade but the previous kernel version is not installed?

If you have a RedHat subscription, first download the required kernel packages from the RedHat website. In the case of RHEL 5.X, all you need are the kernel and kernel-devel packages, but for RHEL6.X  I usually need 4 packages - kernel-firmware, bfa-firmware (for Brocade Fibre Channel Host Bus Adapter), kernel, and kernel-devel

In this second example, let's assume kernel 2.6.18-308.el5 is the current kernel version but that I would like to install 2.6.18-194.el5 and make it the default kernel.

1. rpm -ivh kernel-2.6.18-194.el5 kernel-devel-2.6.18-194.el5

This will install kernel-2.6.18-194 and make it the default in /boot/grub/grub.conf

You can verify that the older kernel has been installed by invoking cat /boot/grub/grub.conf and checking that the older kernel appears in the GRUB menu. If you so desire, after rebooting you can manually remove the other kernel with rpm -e