Sunday, January 10, 2016

Chalk Up One for Centos: Removing Old Kernels

I have committed to memory the commands needed to remove old kernels from the Lubuntu 14.04 workstations in our lab:
# dpkg --purge linux-image-extra-[kernel version]-generic
# dpkg --purge linux-image-[kernel version]-generic
# dpkg --purge linux-headers-[kernel version]-generic
# dpkg --purge linux-headers-[kernel version]
With the frequency with which new kernel versions have been released, this can become a rather tedious process.  I have machines in the lab that have many old kernels, and this collection of 4 dpkg --purge commands has to be run for each old kernel on each machine.  I can hear the skilled sys admins out there groaning that I should just run ... (fill in the correct CLI command here - probably involving xargs or something), or set up proper configuration management using Puppet or something.

Despite my years and years teaching with GNU/Linux systems, however, I am not much of a sys admin, and I don't know how to nor do I feel confident enough to try commands like that.  I'll either end up deleting the current kernel, or spending half the day getting the command to work, and then fail to complete my teacher responsibilities (lesson planning, gradeing, etc.) as a result. In years past I've relied on bright, fast learning students to become the sys admins of our lab, but we are in a rebuilding process at present and I don't have any students with these skills at present.

I'm confident that preparing for the RHCSA certification this Spring will help me become better at this sort of thing, but I am philosophically committed to software freedom, and the idea that you have to be some sort of wizard to use free systems properly runs counter to idea that software freedom should be promoted as widely as possible.

It turns out that Centos 7 has a delightfully simple way to address the old kernel problem (see this for more information).  Just run:
# yum install yum-utils
# package-cleanup --oldkernels --count=1
I searched in vain for anything on the Ubuntu side this simple.  The best I could find was this post, which was not very comforting.

Chalk up a clear win for Centos on this one!

No comments:

Post a Comment