kernel package install has cpio error and results in non-working initramfs
tl;dr: initramfs
during kernel package update sometimes has cpio
error and creates non-booting initramfs
, leading to a hang on boot that is not recoverable without external steps; perhaps the cpio
error is the result of some kind of bad system state, as the error does not completely correlate with the boot problem, and the boot problem is not reproducible
Compte rendu:
I have a scripted remote kernel package update process on a tablet, and am frequently doing kernel package updates of my custom built kernel package as I merge the linux-lts
changes from edge
, and the kernel package update has been occasionally resulting in a non-working system. This is on a tablet that needs to boot using 32-bit EFI, so I'm booting with grub
and the framebuffer console (fnord: to be clear fbcon is the framebuffer console driver, and doesn't preclude any specific framebuffer like EFI as I said earlier); the non-working boot behaviour presents as a hang at the Loading initial ramdisk ...
message which is somewhat ambiguous being the last thing I see before the openrc
boot log comes up on the framebuffer when things are operating normally.
This time I happened to be looking at the output of the remote script doing the kernel package update as it happened and saw:
==> initramfs: creating /boot/initramfs-lts
cpio: unsupported cpio format, use newc or crc
cpio: write error: Broken pipe
By the fact that subsequent &&
'd steps ran, I deduce that as far as apk
was concerned the package installation was a success.
I immediately ssh
'd to the system to try to beat the automated reboot at the end of my entire update script to attempt to fix it manually and save myself a reboot cycle; I first noted that the initramfs-lts
that had been generated was about 8mb (quite short of the usual 12mb)
I ran:
sudo mkinitfs 5.15.5-0-lts
which completed without error and created an approximately the right size initramfs
, and I copied it into the right place for the grub menu item which was going to autoboot before my scripted update even got to its grub-update. Problem resolved, or so I thought.
Then the system rebooted, and hung at the Loading initial ramdisk ...
prompt.
So I rebooted from the previous kernel and reran the same command to generate the new initramfs
again:
sudo mkinitfs 5.15.5-0-lts
and copied it into the right location again and rebooted.
This time the system booted without issue.