Centos 7 – Bug in a Linux kernel, how to solve this structurally

Once in a blue moon the inevitable happens. A buggy Linux kernel is updated through your ‘yum update’ action. It happened to me. Here are the steps I took:

1) Check which kernels you have installed:

rpm -qa kernel

A list of kernels is displayed.

2) If there are more than (say) 3 kernels, do some housekeeping:

a) If yum utilities are not already installed, do this first:
yum install yum-utils -y

b) Next, delete* old kernels, (apart from the most recent 3 kernels):
package-cleanup --oldkernels --count=3

3) Now the tricky part. Delete the buggy kernel. For example, kernel-3.10.0-693.11.6.el7.x86_64 did not work for a XEN virtualized server.

yum remove kernel-3.10.0-693.11.6.el7.x86_64

4) The structural part; until the kernel is outdated by 3 versions, do not update kernels for a little while:

yum -y update --exclude=kernel*

5) Granted, this can hardly be classified as structural. But it works until the kernel has been superseded by 3 new versions, then you can go back to your usual yum update command, and no longer exclude the kernel from being updated.


*Note: If a buggy kernel is already active on your server step 2b may not work, most Centos installs prevent deletion of your active kernel. Google is your friend for this more complex scenario which is outside the scope of this ‘memory’.