github twitter linkedin email rss
Boot folder is almost full
May 14, 2017
2 minutes read

Boot folder is almost full on Ubuntu

I got a error message says “Boot folder is almost full” on my Ubuntu 16.04 after I updated packages. There are a lot of solutions for a simple case on stackoverflow like below:

However, my problem was more serious because:

  1. I couldn’t run any apt related command because I didn’t have much space on /boot folder which is in another small partition. The partition is created if you installed Ubuntu with a disk encryption(it does make sense, Otherwise it cannot be booted). In this case, it’s hard to expand the partition since it’s encrypted
  2. sudo apt autoremove didn’t work because one of my packages has broken since an install process failed because of the disk space
  3. sudo apt-get -f update command didn’t work to fix the problem above because there was no space to download files on /boot folder


Remove some of unused Linux images manually through dpkg command to make space for /boot partition,

Remove images

First, you need to check what image your machine currently use:

$ uname -a
Linux mkm 4.4.0-77-generic #98-Ubuntu SMP Wed Apr 26 08:34:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

You have to leave the latest image and the previous version of the image. For example, if your /boot folder has 4.4.0-50, 4.4.0-71, 4.4.0-72, 4.4.0-73, you need to remove 50 and 71, but not 72 and 73. Remove image through dpkg command, and you have to command like below:

sudo dpkg --remove --force-remove-reinstreq linux-image-extra-4.4.0-64-generic
sudo dpkg --remove --force-remove-reinstreq linux-image-4.4.0-64-generic

First, you need to

Force install some missing

Now, your apt package manager don’t know about the packages are removed since dpkg command is low-level command basically is used by apt. The command complains if you removed the file this way, so you need to re-install some packages again.

apt-get -f install

Run autoremove

Finally, you can run autoremovecommand to remove all unnecessary files under the /boot folder. It fixes apt’s package list as well.

sudo apt autoremove

Back to posts

comments powered by Disqus