How To - Fix Boot Partition Too Small Issue
The situation: apt upgrade
is failing because the system is trying to install a new kernel, and there are already two kernels installed, and you made your damn /boot/
partition too small.
Further details:
- Debian (specifically Proxmox in this example)
- Using encrypted LVM with unencrypted
/boot/
and/boot/efi/
partitions
Example Error:
update-initramfs: Generating /boot/initrd.img-6.8.4-3-pve zstd: error 70 : Write error : cannot write block : No space left on device E: mkinitramfs failure zstd -q -9 -T0 70 update-initramfs: failed for /boot/initrd.img-6.8.4-3-pve 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
Solution:
- Identify the installed kernels:
ls /boot/
root@hostname:~# ls /boot/ config-5.15.107-2-pve config-6.2.16-3-pve initrd.img-5.15.108-1-pve initrd.img-6.8.4-3-pve System.map-5.15.108-1-pve System.map-6.8.4-3-pve vmlinuz-6.2.16-20-pve config-5.15.108-1-pve config-6.8.4-3-pve initrd.img-6.2.16-12-pve lost+found System.map-6.2.16-12-pve vmlinuz-5.15.107-2-pve vmlinuz-6.2.16-3-pve config-6.2.16-12-pve grub initrd.img-6.2.16-20-pve pve System.map-6.2.16-20-pve vmlinuz-5.15.108-1-pve vmlinuz-6.8.4-3-pve config-6.2.16-20-pve initrd.img-5.15.107-2-pve initrd.img-6.2.16-3-pve System.map-5.15.107-2-pve System.map-6.2.16-3-pve vmlinuz-6.2.16-12-pve
- Identify the running kernel:
uname -r
root@hostname:~# uname -r 6.2.16-12-pve
- Find the package name for the non-running kernel:
apt list --installed | grep pve-kernel
(NOTE: This example was done on a Proxmox machine; on most Debian systems, you'll need to search for 'linux-image' instead)
root@hostname:~# apt list --installed | grep pve-kernel WARNING: apt does not have a stable CLI interface. Use with caution in scripts. pve-kernel-5.15.107-2-pve/now 5.15.107-2 amd64 [installed,local] pve-kernel-5.15.108-1-pve/now 5.15.108-1 amd64 [installed,local] pve-kernel-5.15/now 7.4-4 all [installed,local] pve-kernel-6.2.16-3-pve/stable,now 6.2.16-3 amd64 [installed,auto-removable] pve-kernel-6.2/stable,now 8.0.5 all [installed,automatic]
- Use
apt purge
to remove all versions of the non-running kernel. Don't worry if the first one fails with the same update-initramfs error; you may need to remove more than one older kernel to free enough space for the kernel to update.