14

When attempting to upgrade from 20.04 to 22.04, I got an error about there not being enough space in /boot. But the amount of space requested is extremely large (617M), which makes me suspect something is going wrong.

The error message produced by do-release-upgrade:

Not enough free disk space

The upgrade has aborted. The upgrade needs a total of 617 M free space on disk '/boot'. Please free at least an additional 282 M of disk space on '/boot'. You can remove old kernels using 'sudo apt autoremove' and you could also set COMPRESS=xz in /etc/initramfs-tools/initramfs.conf to reduce the size of your initramfs.

Contents of /boot:

$ ls -lh /boot/
total 271M
-rw-r--r-- 1 root root 256K Jul 14 10:42 config-5.15.0-43-generic
-rw-r--r-- 1 root root 257K Aug  4 14:44 config-5.15.0-46-generic
drwx------ 3 root root 4.0K Dec 31  1969 efi
drwxr-xr-x 4 root root 4.0K Aug 10 12:50 grub
lrwxrwxrwx 1 root root   28 Aug 10 11:06 initrd.img -> initrd.img-5.15.0-46-generic
-rw-r--r-- 1 root root 118M Aug 11 17:48 initrd.img-5.15.0-43-generic
-rw-r--r-- 1 root root 119M Aug 11 17:47 initrd.img-5.15.0-46-generic
lrwxrwxrwx 1 root root   28 Aug 10 11:06 initrd.img.old -> initrd.img-5.15.0-43-generic
drwx------ 2 root root  16K Sep 17  2021 lost+found
-rw-r--r-- 1 root root 179K Aug 18  2020 memtest86+.bin
-rw-r--r-- 1 root root 181K Aug 18  2020 memtest86+.elf
-rw-r--r-- 1 root root 181K Aug 18  2020 memtest86+_multiboot.bin
-rw------- 1 root root 6.0M Jul 14 10:42 System.map-5.15.0-43-generic
-rw------- 1 root root 6.0M Aug  4 14:44 System.map-5.15.0-46-generic
lrwxrwxrwx 1 root root   25 Aug 10 11:06 vmlinuz -> vmlinuz-5.15.0-46-generic
-rw------- 1 root root  11M Jul 14 10:43 vmlinuz-5.15.0-43-generic
-rw------- 1 root root  11M Aug  4 14:47 vmlinuz-5.15.0-46-generic
lrwxrwxrwx 1 root root   25 Aug 10 11:06 vmlinuz.old -> vmlinuz-5.15.0-43-generic

And the size + disk usage of /boot:

$ df -h /boot/
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p2  704M  279M  374M  43% /boot

Any insights on why the update is requesting so much /boot space or suggestions on how to fix this would be appreciated.

EDIT: For unknown reasons, after running the tool again, it's now asking for 429M of free space. I didn't change anything, so I'm not sure why the number is lower. It's still much larger than it seems like it should be though.

hairlessbear
  • 241
  • 1
  • 2
  • 5

2 Answers2

9

I came across this issue while trying to update KDE Neon via a warning icon in the desktop tray

After looking at the link shared by gmauch, I was able to solve the issue by combining this answer and this answer like so:

$ vim /etc/initramfs-tools/initramfs.conf
...
#
# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz ]
#

COMPRESS=lz4 # change lz4 to xz

...

then after exiting/editing the file

$ sudo update-initramfs -u -k all

Which will effect the changes made in the /etc/initramfs-tools/initramfs.conf file. After this you should be able to proceed with the upgrade.

It is still worth it to run sudo apt autoremove to generally free up space as well remove older kernels using this one liner I came across sometime back:

$ dpkg -l | egrep "linux-(signed|modules|image|headers)" | grep -v $(uname -r | cut -d - -f 1) | awk {'print $2'} | xargs sudo apt purge -y

Just to know what kernels you have, running a shorter version should suffice:

$ dpkg -l | egrep "linux-(signed|modules|image|headers)" | grep $(uname -r)

Anything that has ii at the beginning means that it is an installed kernel.

Hope this helps.

leni1
  • 91
2

Having similar issue, I just run the command suggested by the error message:

sudo apt autoremove

That did the trick.