Xubuntu: Not enough free disk space on /boot

Today I ran into a problem when trying to install some updates for my Xubuntu 12.10… I got a message saying:

Xubuntu 20.10 /boot full

Its suggestion of ‘sudo apt-get clean’ didn’t do anything, nor did ‘sudo apt-get autoclean’, ‘sudo apt-get autoremove’, etc. After some Googling (DDGing), I found a solution…

The ‘/boot’ partition is normally rather small (243.0 MiB in my case) and contains Linux Kernel files, these are the files that get your computer going as it should. Think of them as the skeleton of your OS, but for some reason when your skeleton gets upgraded, it leaves the old one behind, which can quickly fill-up your ‘/boot’ partition.

Only one Kernel (skeleton) is used when booting your computer but it’s always good practice to leave one spare laying around just in case, you don’t really need any more than the current one and an old spare one.

Open up terminal and execute this:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d'

This lists on the screen all the unused Kernels, mine outputs:

linux-headers-3.5.0-17
linux-headers-3.5.0-17-generic
linux-headers-3.5.0-18
linux-headers-3.5.0-18-generic
linux-headers-3.5.0-19
linux-headers-3.5.0-19-generic
linux-headers-3.5.0-21
linux-headers-3.5.0-21-generic
linux-headers-3.5.0-22
linux-headers-3.5.0-22-generic
linux-image-3.5.0-17-generic
linux-image-3.5.0-18-generic
linux-image-3.5.0-19-generic
linux-image-3.5.0-21-generic
linux-image-3.5.0-22-generic
linux-image-extra-3.5.0-17-generic
linux-image-extra-3.5.0-18-generic
linux-image-extra-3.5.0-19-generic
linux-image-extra-3.5.0-21-generic
linux-image-extra-3.5.0-22-generic

This list does not include the one your are using and need to keep! e.g. 3.5.0-23.

Note: It is not always the newest one that we need to keep. Running ‘uname -a’ in terminal will tell you which version your using.

We need to uninstall all the old ones (except the one old spare e.g. 3.5.0-22). So I need to remove; 3.5.0-17, 3.5.0-18, 3.5.0-19, 3.5.0-20 and 3.5.0-21.

Sometimes I use Synaptic Package Manager to remove technical things rather than the command line, you can install Synaptic from the Ubuntu Software Centre.

For each version you wish to remove, you’ll need to remove 3 separate things. For example; to remove 3.5.0-17, you need to remove:

  1. linux-image-3.5.0-17-generic
  2. linux-image-extra-3.5.0-17-generic
  3. linux-headers-3.5.0-17 (‘linux-headers-3.5.0-17-generic’ will get automatically removed)

Remove these three things for each version you want to remove and boom, you done and your ‘/boot’ is now clean! šŸ˜€

Xubuntu: Not enough free disk space on /boot

6 thoughts on “Xubuntu: Not enough free disk space on /boot

  1. Toby says:

    Much gratitude. Exactly what I was looking for. Also, I didn’t know about Synaptic Package Manager but will be using this going forward. Following you now so keep these great posts coming.

Leave a Reply

Your email address will not be published. Required fields are marked *