Sudden Jump in initrd.img SIze Filled /boot Partition
https://askubuntu.com/questions/1566167/sudden-jump-in-initrd-img-size-filled-boot-partitionI went to update my system today and encountered a strange problem that has left my system in a perilous state. I've done this hundreds of times so didn't expect anything to go wrong.
I ran sudo apt update; sudo apt -y dist-upgrade; sudo apt -y autoremove as usual and got an error from initramfs complaining that my /boot partition is full.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-176-generic
zstd: error 25 : Write error : No space left on device (cannot write compressed block)
E: mkinitramfs failure zstd -q -1 -T0 25
I checked it and was confused, because it was only 60% full.
/dev/sda1 470M 266M 180M 60% /boot
ll /boot/
total 259M
drwx------ 2 root root 12K Dec 23 2017 lost+found
-rw-r--r-- 1 root root 181K Feb 6 2022 memtest86+_multiboot.bin
-rw-r--r-- 1 root root 181K Feb 6 2022 memtest86+.elf
-rw-r--r-- 1 root root 179K Feb 6 2022 memtest86+.bin
-rw------- 1 root root 6.1M Mar 6 05:14 System.map-5.15.0-173-generic
-rw-r--r-- 1 root root 256K Mar 6 05:14 config-5.15.0-173-generic
-rw------- 1 root root 12M Mar 6 05:16 vmlinuz-5.15.0-173-generic
-rw------- 1 root root 6.1M Mar 11 06:57 System.map-5.15.0-176-generic
-rw-r--r-- 1 root root 256K Mar 11 06:57 config-5.15.0-176-generic
-rw------- 1 root root 12M Mar 11 07:54 vmlinuz-5.15.0-176-generic
lrwxrwxrwx 1 root root 26 Apr 15 23:00 vmlinuz -> vmlinuz-5.15.0-176-generic
lrwxrwxrwx 1 root root 29 Apr 15 23:00 initrd.img -> initrd.img-5.15.0-176-generic
lrwxrwxrwx 1 root root 26 Apr 15 23:00 vmlinuz.old -> vmlinuz-5.15.0-173-generic
lrwxrwxrwx 1 root root 29 Apr 15 23:00 initrd.img.old -> initrd.img-5.15.0-173-generic
drwxr-xr-x 5 root root 1.0K Apr 15 23:00 grub
-rw-r--r-- 1 root root 112M Apr 23 18:54 initrd.img-5.15.0-176-generic
-rw-r--r-- 1 root root 112M Apr 27 16:51 initrd.img-5.15.0-173-generic
I tried deleting the new initrd.img to make space, and after rerunning initrd, I got the same error. Looking at the size of the initrd.img-5.15.0-173-generic image, I see that it's jumped to over 275 MB.
ll /boot/
total 300M
drwx------ 2 root root 12K Dec 23 2017 lost+found
-rw-r--r-- 1 root root 181K Feb 6 2022 memtest86+_multiboot.bin
-rw-r--r-- 1 root root 181K Feb 6 2022 memtest86+.elf
-rw-r--r-- 1 root root 179K Feb 6 2022 memtest86+.bin
-rw------- 1 root root 6.1M Mar 6 05:14 System.map-5.15.0-173-generic
-rw-r--r-- 1 root root 256K Mar 6 05:14 config-5.15.0-173-generic
-rw------- 1 root root 12M Mar 6 05:16 vmlinuz-5.15.0-173-generic
-rw------- 1 root root 6.1M Mar 11 06:57 System.map-5.15.0-176-generic
-rw-r--r-- 1 root root 256K Mar 11 06:57 config-5.15.0-176-generic
lrwxrwxrwx 1 root root 26 Apr 15 23:00 vmlinuz -> vmlinuz-5.15.0-176-generic
lrwxrwxrwx 1 root root 29 Apr 15 23:00 initrd.img -> initrd.img-5.15.0-176-generic
lrwxrwxrwx 1 root root 26 Apr 15 23:00 vmlinuz.old -> vmlinuz-5.15.0-173-generic
lrwxrwxrwx 1 root root 29 Apr 15 23:00 initrd.img.old -> initrd.img-5.15.0-173-generic
drwxr-xr-x 5 root root 1.0K Apr 15 23:00 grub
-rw-r--r-- 1 root root 275M Apr 27 18:01 initrd.img-5.15.0-173-generic
It's obvious what's causing the problem, which is a sudden doubling of the size of the initrd.img files, but why are they suddenly so much bigger? I managed to fit both images onto the /boot by changing /etc/initramfs-tools/initramfs.conf from MODULES=most to MODULES=dep (in initrd.img contains unnecessary modules after distro upgrade to 22.04), but that leaves my boot partition almost full:
/dev/sda1 470M 460M 0 100% /boot
ll /boot/
total 453M
drwx------ 2 root root 12K Dec 23 2017 lost+found
-rw-r--r-- 1 root root 181K Feb 6 2022 memtest86+_multiboot.bin
-rw-r--r-- 1 root root 181K Feb 6 2022 memtest86+.elf
-rw-r--r-- 1 root root 179K Feb 6 2022 memtest86+.bin
-rw------- 1 root root 6.1M Mar 6 05:14 System.map-5.15.0-173-generic
-rw-r--r-- 1 root root 256K Mar 6 05:14 config-5.15.0-173-generic
-rw------- 1 root root 12M Mar 6 05:16 vmlinuz-5.15.0-173-generic
-rw------- 1 root root 6.1M Mar 11 06:57 System.map-5.15.0-176-generic
-rw-r--r-- 1 root root 256K Mar 11 06:57 config-5.15.0-176-generic
lrwxrwxrwx 1 root root 26 Apr 15 23:00 vmlinuz -> vmlinuz-5.15.0-176-generic
lrwxrwxrwx 1 root root 29 Apr 15 23:00 initrd.img -> initrd.img-5.15.0-176-generic
lrwxrwxrwx 1 root root 26 Apr 15 23:00 vmlinuz.old -> vmlinuz-5.15.0-173-generic
-rw-r--r-- 1 root root 214M Apr 27 18:26 initrd.img-5.15.0-176-generic
drwxr-xr-x 5 root root 1.0K Apr 27 18:26 grub
-rw-r--r-- 1 root root 214M Apr 27 18:27 initrd.img-5.15.0-173-generic
This leaves me with no headroom in case of future expansions of initrd.img size and also I'm concerned that I excluded a module that will be important. Why did the initrd.img size suddenly jump? Is there any solution here short of a risky resize of my /boot partition?










