Recently I tried to install updates with “apt-get upgrade” on a Ubuntu Desktop 20.04 LTS. The installation of the updates failed because of to less free space on the boot partition.
I got the following error message:
Not enough free disk space The upgrade has aborted. The upgrade needs a total of 25.7 M free space on disk '/boot'. Please free at least an additional 25.7 M of disk space on '/boot'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.
The aim for me was just to free up some space on /boot so that I could install the newest kernel version.
So I just executed this command in the Linux terminal:
root@ubuntubox:/# dpkg -l |grep linux-image |grep -v extra
A lot of obsolete kernel versions where shown.
The next step for me was to remove one or more obsolete kernels:
root@ubuntubox:/boot# apt-get remove linux-image-4.15.0-169-generic
Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: account-plugin-facebook Use 'apt autoremove' to remove them. The following additional packages will be installed: linux-image-unsigned-4.15.0-169-generic Suggested packages: fdutils linux-doc-4.15.0 | linux-source-4.15.0 linux-tools The following packages will be REMOVED: linux-image-4.15.0-169-generic linux-modules-extra-4.15.0-169-generic The following NEW packages will be installed: linux-image-unsigned-4.15.0-169-generic 0 upgraded, 1 newly installed, 2 to remove and 4 not upgraded. Need to get 8.119 kB of archives. After this operation, 181 MB disk space will be freed. Do you want to continue? [Y/n] Y
I did this for several OLD kernels then there was enough free space on /boot again.