This blog is mostly about desktop Linux but I also help manage a handful of Linux server for work. We mostly run CentOS servers or the occasional Fedora on internal sites but use CentOS exclusively for any public sites. I was finally getting around to updating a CentOS 3 server today with good old yum update when I ran into an unwelcome surprise.
Running test transaction:D'oh! I knew this day would come eventually when my tiny little 90MB /boot partition would get full!
Errors reported doing trial run
installing package kernel-smp-2.4.21-53.EL needs 53KB on the /boot filesystem
So what to do? Easy, just uninstall some of those old kernels. But how do I do that? It turns out, that is also easy.
First I figure out what kernel I am actually running now so I don't try and delete it. I am not sure what would happen if I tried but I am not going to find out. To determine the running kernel, use
uname -r. I am running 2.4.21-52.ELsmp .Next we want to see what other kernels are installed to find what we can delete. Do this like so:
[root@localhost root]# rpm -q kernel
kernel-2.4.21-37.EL
kernel-2.4.21-37.0.1.EL
kernel-2.4.21-40.EL
kernel-2.4.21-47.EL
kernel-2.4.21-47.0.1.EL
kernel-2.4.21-50.EL
kernel-2.4.21-51.EL
kernel-2.4.21-52.EL
I see that we have 7 old kernels installed. Now to delete them, just use rpm -e
rpm -e kernel-2.4.21-37.ELAnd it is gone. Rinse and repeat for the other kernels. I only plan on getting rid of a few. This is what was left:
[root@localhost root]# rpm -q kernelNow I have 30M instead of 5.6M free on my /boot partition and I can continue the update. Unfortunately that didn't clean up /boot/grub/grub.conf to remove the old kernels from the grub boot menu. Maybe that has been fixed in CentOS 4 or 5 (well, RHEL).
kernel-2.4.21-50.EL
kernel-2.4.21-51.EL
kernel-2.4.21-52.EL