apt-get upgrade on Ubuntu 20.04 box fails because there is not enough space in /boot
evgeni opened this issue · 0 comments
evgeni commented
Ohai,
I've tested this on the following boxes, but I think others could be affected too:
- generic/ubuntu2004 (libvirt, 4.3.10)
- generic/ubuntu2004 (libvirt, 4.3.12)
When you boot the machine, you see there are at least two kernels installed:
root@ubuntu2004:~# ls /boot/
config-5.4.0-169-generic grub initrd.img-5.4.0-169-generic initrd.img-5.4.0-42-generic initrd.img.old System.map-5.4.0-169-generic vmlinuz vmlinuz-5.4.0-42-generic
config-5.4.0-42-generic initrd.img initrd.img-5.4.0-169-generic.img initrd.img-5.4.0-42-generic.img lost+found System.map-5.4.0-42-generic vmlinuz-5.4.0-169-generic vmlinuz.old
Additionally, the initrds are doubled: initrd.img-5.4.0-169-generic
and initrd.img-5.4.0-169-generic.img
(and same for -42-). However, the ones ending in .img
are not referenced from the grub.cfg
at all:
# grep img /boot/grub/grub.cfg
initrd /initrd.img-5.4.0-169-generic
initrd /initrd.img-5.4.0-169-generic
initrd /initrd.img-5.4.0-169-generic
initrd /initrd.img-5.4.0-42-generic
initrd /initrd.img-5.4.0-42-generic
Calling apt-get update && apt-get upgrade
results in:
Processing triggers for initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-170-generic
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-170-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
Calling rm -f /boot/*-generic.img
before doing the upgrade cleans up enough space to not break things.
I think two optimizations can be made:
- Cleaning those
.img
files (wherever they come from) - Shipping the box only with one (latest at build-time) kernel installed