Kernel upgrade with low space results in phone not booting
What problem did you encounter
When low on space in /boot, a failed initramfs generation results in the boot script pointing to the broken kernel.
What is the actual behaviour?
- Install kernel
- Fail to install
- Boot script points to the broken version
What is the expected behaviour?
- Boot script points to some good version
How to reproduce
Starting with:
ls /boot/vmlinuz-* | cat
/boot/vmlinuz-5.19.0-1-librem5
/boot/vmlinuz-6.0.0-1-librem5
/boot/vmlinuz-6.1.0-1-librem5
/boot/vmlinuz-6.1.13-librem5-gd7c9aec13bf6
Trigger with:
sudo truncate -s 32M /boot/fill # adjust size until problem seen. If the kernel installs, increase. If it fails before initramfs generation, decrease.
sudo apt install linux-image-6.2.0-1-librem5
Result (notice missing initrd):
$ grep -a librem5 /boot/boot.scr
setenv fk_kvers '6.2.0-1-librem5'
purism@pureos:~$ ls /boot/initrd.* | cat
/boot/initrd.img-5.19.0-1-librem5
/boot/initrd.img-6.0.0-1-librem5
/boot/initrd.img-6.1.0-1-librem5
/boot/initrd.img-6.1.13-librem5-gd7c9aec13bf6
purism@pureos:~$ ls /boot/vmlinuz-* | cat
/boot/vmlinuz-5.19.0-1-librem5
/boot/vmlinuz-6.0.0-1-librem5
/boot/vmlinuz-6.1.0-1-librem5
/boot/vmlinuz-6.1.13-librem5-gd7c9aec13bf6
/boot/vmlinuz-6.2.0-1-librem5
Log:
Unpacking linux-image-6.2.0-1-librem5 (6.2.2pureos1) ...
Setting up linux-image-6.2.0-1-librem5 (6.2.2pureos1) ...
update-initramfs: Generating /boot/initrd.img-6.2.0-1-librem5
pigz: abort: write error on <stdout> (No space left on device)
E: mkinitramfs failure pigz 28
update-initramfs: failed for /boot/initrd.img-6.2.0-1-librem5 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Using DTB: freescale/imx8mq-librem5-r4.dtb
Installing /usr/lib/linux-image-6.2.0-1-librem5/freescale/imx8mq-librem5-r4.dtb into /boot/dtbs/6.2.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
Installing new imx8mq-librem5-r4.dtb.
Installing /usr/lib/linux-image-6.2.0-1-librem5/freescale/imx8mq-librem5-r4.dtb into /boot/dtbs/6.2.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
Taking backup of imx8mq-librem5-r4.dtb.
Installing new imx8mq-librem5-r4.dtb.
flash-kernel: deferring update (trigger activated)
dpkg: error processing package linux-image-6.2.0-1-librem5 (--configure):
installed linux-image-6.2.0-1-librem5 package post-installation script subprocess returned error exit status 1
Processing triggers for flash-kernel (3.102.0pureos6) ...
Using DTB: freescale/imx8mq-librem5-r4.dtb
Installing /usr/lib/linux-image-6.2.0-1-librem5/freescale/imx8mq-librem5-r4.dtb into /boot/dtbs/6.2.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
Taking backup of imx8mq-librem5-r4.dtb.
Installing new imx8mq-librem5-r4.dtb.
flash-kernel: installing version 6.2.0-1-librem5
Generating boot script u-boot image... done.
Taking backup of boot.scr.
Installing new boot.scr.
Errors were encountered while processing:
linux-image-6.2.0-1-librem5
E: Sub-process /usr/bin/dpkg returned an error code (1)
What hardware are you running on?
L5
Relevant OS information
Which OS are you using?
Byzantium