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

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch