How to free up room on /boot

If you've been running Ubuntu for a while and have a smallish /boot drive, then chances are you might run out of space on it. This happens to me at least every few months and this is what I do:

Step 1.

Check which kernel version you're currently running. You definitely don't want to delete the one you're using.

uname -r

Step 2.

Find out which kernels you have installed and don't need:

sudo dpkg --list 'linux-image-*'

Step 3.

Removed unwanted / unneeded kernels.

sudo apt-get remove linux-image-[version]

For example:

sudo apt-get remove linux-image 3.16.0-50-generic

Make sure to leave at least a few previous images in case you need to roll back to an older image.

Step 4

Check how much room you've freed.

df /boot

If you are happy with the amount of available space, then continue. If not, go back and remove some more images.

Step 5

Use autoremove to clean out the packages you no longer need.

sudo apt-get autoremove

Step 6 (optional)

If you are using Grub and want to clear out old packages from your boot menu, use the following command:

sudo update-grub

All done!