27

Getting the following error when trying to upgrade to 22.04

The upgrade has aborted. The upgrade needs a total of 616 M free space on disk '/boot'. Please free at least an additional 144 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.

I have done all the usual suspects removing old kernels, etc., but that amount of space takes up nearly all of the Ubuntu default boot drive space so no amount of freeing space is going to let that go through.

The giant increase in size requirements leads me to believe this is some form of error. Short of decrypting and re-sizing partitions is there anything I can try here?

U. Windl
  • 255
  • 2
  • 5
Seth Brown
  • 583
  • 1
  • 5
  • 9

5 Answers5

44

This is a known issue caused by using a different compression method for the initramfs. The new default, lz4 compression, is faster to decompress/read at boot time, but takes a lot of space in /boot to create. This means people with smaller /boot partitions won't have enough space to generate the initramfs.

The workaround is to change the compression algorithm to xz as recommended (or some other algorithm that takes less space).

To do this, edit /etc/initramfs-tools/initramfs.conf and set COMPRESS=xz, as stated in the error message. Afterward, you should be able to upgrade.

Esther
  • 3,932
31

I was ultimately able to resolve this with a compression tip from the bug report that Esther linked here.

The error states that the initramfs.conf must be changed to COMPRESS=xz. However, simply changing the config has no effect. The images need to be rebuilt after with the following command:

sudo update-initramfs -u -k all

Changing to COMPRESS=xz has a minimal effect however and not enough to allow install on a default-sized boot partition. Setting COMPRESS=lzma and rebuilding the images did allow the install to continue.

Also worth noting that the error message says to run the command "sudo apt autoremove" but this will likewise not free up boot space on its own. Excess kernels must generally be removed like so.

Seth Brown
  • 583
  • 1
  • 5
  • 9
1

Another option, if putting /boot on the root partition is no option: You can (temporarily or permanently) put it on a usb stick.

  • Copy all files onto the stick (make sure to keep permission, e.g., by using rsync -a)
  • umount the stick, mount it at /boot
  • reinstall grub (update-grub and grub-install)
  • Boot from the usb stick

Best if you still have the old /boot around for a first test before doing it for real.

allo
  • 671
-1

To avoid this you can put /boot on the same partition. export a user to another /home directory after the fact.

TardisGuy
  • 367
-1

For anyone looking for an idea of what the Ubuntu 22.04 /boot partition size should be, I've set mine to 1G and on a fresh install currently 127M used.

The 22.04 installer seems to want to use a percentage of the whole disk for /boot. On 12G it was trying to use 1.75G which seems excessive.

Hopefully 1G will be enough, though it hasn't done a kernel update yet, though an apt update did do this okay:

Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-53-generic

racitup
  • 99