Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu - Manually Remove Old Kernels

For some reason, sudo apt-get autoremove often does not remove a lot of the old kernels. One will need to manually remove them if you are running out of space on your /boot partition.

Simply run

sudo apt-get purge linux-image-x.x.x.x-generic 

Replace x.x.x.x with something like 3.13.0-63 when you see initrd.img-3.13.0-62-generic listed in /boot.

Be careful not to remove the very latest kernel!

When you are finished removing kernels, be sure to update your grub boot loader.

sudo update-grub2 

References

Last updated: 4th January 2023
First published: 16th August 2018