How to clean Ubuntu's /boot if it has run full

2015-06-16 | #solution, #ubuntu

After some time a kernel update may tell you something along the way of "Hey, there is a kernel update, but I can't update it because there is no space left on /boot".

To solve this you'll have to do a little apt-cleaning.

First find out which kernel you are using at the moment with

uname -r

After this get the list of currently installed kernels with

sudo dpkg --list 'linux-image*'

Now remove all kernels except the current and maybe the one before that by using

sudo apt-get remove linux-image-X.X.XX-XX-generic

When you are done with removing, clean up orphaned dependencies with

sudo apt-get autoremove

And you should be done. You'll likely have to do this every few months again I'm afraid.