13

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.

6
  • If you're running on the ...46 kernel, then you may prege the ...43 kernel packages to save some space. Probably building the initrd takes room -- is there any reason to even have a separate /boot (raid, encrypted root, etc.)?
    – ubfan1
    Aug 11, 2022 at 22:09
  • 1
    encrypted root is why there's a separate /boot. Now that it's changed to requiring 429MB, I could purge the previous kernel, but I'd still like to understand what's happening. This is much, much more space requested than any Ubuntu upgrade I've done previously. Plus it lowering the requested amount ~200MB out of nowhere doesn't fill me with confidence that all will go well. Aug 11, 2022 at 22:12
  • 1
    I have the same issue and have opened a bug report about this here: bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/…. In my case the space required is bigger than the total size of the /boot partition! Aug 31, 2022 at 11:24
  • 4
    Does this answer your question? Very high /boot space requirement to go from 20.04 to 22.04 preventing upgrade
    – gmauch
    Sep 16, 2022 at 16:42
  • 2
    @gmauch Sort of. I did end up solving my problem by removing the older kernel that was present, but I'd still like to know why the required space was so huge, and more importantly, why it fluctuated large amounts for no obvious reason. But I was able to upgrade without issue, which is the most important thing. Oct 7, 2022 at 18:25

2 Answers 2

6

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.

1

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

sudo apt autoremove

That did the trick.

3
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 1, 2022 at 11:53
  • I find the suggestion to do sudo apt autoremove odd because in my own experience and based on feedback of others in similar questions, it does not do anything to help with removing files from /boot
    – jpp1
    Feb 18 at 23:17
  • 1
    @jpp1 sudo apt autoremove will not just remove unused dependencies, it will also remove old unused kernels, which will free space in /boot. You can use ls -lh /boot/initrd.img* to see the kernels. Typically up to 3 old kernels are kept at a time.
    – bmaupin
    Aug 31 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .