Cannot remove unused old kernels in Ubuntu 10.04 LTS

Your server will punish you if you do not stay on top of your administrative tasks in a timely manner. I did not stay on top of my unused kernels and my /boot filled up. When I went to do my usual apt-get purge of the kernel package I got the following crazy error message:

root@Host:/boot# sudo apt-get purge linux-image-2.6.32-46-server
Reading package lists… Done
Building dependency tree
Reading state information… Done
You might want to run `apt-get -f install’ to correct these:
The following packages have unmet dependencies:
linux-image-server: Depends: linux-image-2.6.32-62-server but it is not going to be installed
E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution).

So after surfing the internets for advice what I landed on that fixed the issue was moving some of the kernel files to a different mount point with space and execute the following commands:

  • apt-get -f install
  • update-grub

This allowed a previous attempt to automatically upgrade my kernel to complete and then allowed me to successfully remove the unused kernels that weren’t needed anymore doing the following:

  • uname -r
    • This is the kernel you should not remove.
  • dpkg –list | grep linux-image
    • Start with the lowest and use the command line below and go to town until you have cleaned things up
  • apt-get purge linux-image-X.X.X-X-server

Tips:

Leave a Reply

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