How to Uninstall Unused Old Kernels

During updates your old Linux kernels pile up.  Then one day when you try to do your next updates, an interesting alert comes up from the server.  Basically, it tells you that your boot partition is full and can not fit any more kernels.  Sounds easy, right? It will be easy for those of you who is pretty crafty with terminal and debugging.  We have seasoned sysadmins in our web analytics company, but, naturally, there are junior guys who are still in constant learning process.

Unfortunately, those of them who are used to web interface, like Webmin, will delete their old kernels but won’t be able to proceed with the installation of a new Linux kernel. Interestingly enough, great Webmin just does not show all installed kernels. Some kind of a bug, I guess.

Well, your solution is to open the terminal and find out how many kernels are there anyways. So you need to type up:
rpm -q kernel | sort

Then you need to find out which kernel is the default one on your machine. So invoke the following command on your terminal:

uname -r

Then while whistling some funny melody, start uninstalling one by one all useless kernels. Here is the command:

rpm -e kernel(and its version)

Don’t forget to reboot.  The alert would not bother you anymore.

Note: Please, be careful with uninstallation. Don’t erase all kernels, leave at least a couple of them in case a new update is gonna cause you problems.  In that case, you will just switch back to the old kernel and wait for another kernel update.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Password Protect a Directory on Apache

Next Post

How to Share RedHat and Fedora Remote Directories with SSHFS

Related Posts