Old Linux kernel images lying around in your /boot partition ?

If you like me have run into having your boot partition filled to the brim with bits containing OLD kernel images and have been prevented from running

sudo apt-get upgrade

command without getting an error. You will want to read on.

all installed kernel version with

dpkg --list | grep linux-image
dpkg --list | grep linux-headers

The following three commands will remove the selected versions of images from the boot device.

sudo apt-get purge linux-image-4.4.0-{72,75,78}
sudo apt-get purge linux-image-extra-4.4.0-{72,75,78}
sudo apt-get purge linux-headers-4.4.0-{72,75,78}

NB: be aware the removal of linux kernel images will trigger an update of the kernel and the latest available version available to the disto!

 


Note it will be a good idea to order Grub2 to update it's list of kernel images available to boot from. This command will to the trick.

sudo update-grub2

You can verify grub2 have updated it's list by reboot the host.

 


Sources

  1. https://askubuntu.com/questions/2793/how-do-i-remove-old-kernel-versions-to-clean-up-the-boot-menu
  2. http://ask.xmodulo.com/remove-kernel-images-ubuntu.html