NO SPACE LEFT ON DISC /BOOT. PLEASE FREE AT LEAST...
2 min read

NO SPACE LEFT ON DISC /BOOT. PLEASE FREE AT LEAST...

NO SPACE LEFT ON DISC /BOOT. PLEASE FREE AT LEAST...

Common problem during linux kernel upgrade is not enough space on boot partition (if present). There are two solutions to solve this:

  1. resize boot partition what is tricky because in most cases boot is first partition on hard drive and you probably have to resize partition next to boot to make some space for resizing,
  2. free space on boot partition by removing old unused linux kernels
The upgrade needs a total of 18.1 M free space on disk `/boot`.
Please free at least an additional 18.1 M of disk space on `/boot`.Empty your trash and remove temporary packages of former installations
using `sudo apt-get clean`.

Here I focus on second solution which is much more easy and fast to apply.

To removed unused kernels, we must be sure what kernel is currently used. Iā€™m using 4.4.0ā€“66-generic and uname confirmed that:

$ uname -a
Linux szarik 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Now we can check all available linux kernels in system to realize which can be safely removed. Note that the 4.4.0ā€“66-generic kernel is also displayed:

$ dpkg -l linux-image-\* | grep ^ii
ii  linux-image-4.4.0-64-generic       4.4.0-64.85         amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-66-generic       4.4.0-66.87         amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-64-generic 4.4.0-64.85         amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-66-generic 4.4.0-66.87         amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-generic                4.4.0.66.70         amd64        Generic Linux kernel image

A good practice is to have two compilations of the kernel. Currently used and one back in case of problems. However, sometimes that one additional version takes too much disk space. Then you can simply use autoremove:

$ sudo apt-get autoremove

if this way does not remove redundant compilation, we can remove them directly using:

$ sudo apt-get purge  linux-image-4.4.0-64-generic
The following packages will be REMOVED
linux-image-4.4.0-64-generic* linux-image-extra-4.4.0-64-generic* linux-signed-image-4.4.0-64-generic*

after that we can successfully upgrade system without missing space on /boot.