REMOVE OLD KERNELS

I tend to be on #ubuntu to help others. Today, an interesting question
popped up, how do I clean the old linux images and headers?

Each linux image / header has its own dir in /usr/src/

Let's start, uname -a ... do NOT remove this image

Let's do a sudo apt-get update ... make sure it is clean

If, for some reason, you get errors, try sudo apt-get -f install (fix broken)

Let's get a list of all the images, dpkg -l | grep linux-image

for each image, issue
sudo apt-get purge linux-image-4.4.0-51 (your numbers will be different)
sudo apt-get purge linux-image-extra-4.4.0-51 (your numbers will be different)

It will do a bunch of things and that image/headers is removed.

After all is done, do another sudo apt-get update to sync everything.

Happy trails!

Comments

I have always used Synaptic Package Manager. Search for Linux Image and uninstall all but the newest two newest. That way you have a spare in case something goes wrong.