From be84b73abeeb4cff3306f33483df8d862d4e721b Mon Sep 17 00:00:00 2001 From: Julian Sommer <115516918+juliansommer@users.noreply.github.com> Date: Mon, 19 Oct 2026 13:11:03 +1000 Subject: [PATCH] fix: rebuild the initramfs after upgrading the kernel in system AMIs On Alpine 3.21 apk does not run the mkinitfs trigger inside the libguestfs appliance, so apk upgrade left the old initramfs beside the new kernel. The guest could not load virtio_blk and dropped to the emergency shell, which stalled EKS cluster creation. Run mkinitfs for the installed kernel and fail the build if the initramfs lacks its virtio_blk module. --- scripts/build-system-image.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/build-system-image.sh b/scripts/build-system-image.sh index 987d8572a..4fe2983ef 100755 --- a/scripts/build-system-image.sh +++ b/scripts/build-system-image.sh @@ -287,6 +287,9 @@ if [[ "$DISTRO" == "alpine" ]] && [[ -n "${APK_PACKAGES:-}" ]]; then # The base cloud image's kernel is only as fresh as its release; upgrade so # the AMI ships the branch's current linux-virt and security fixes. CUST+=(--run-command 'apk upgrade') + # apk's mkinitfs trigger does not always fire in the appliance; a new kernel + # with the old initramfs cannot load virtio_blk and never mounts root. + CUST+=(--run-command 'k=$(ls /lib/modules | sort -V | tail -1) && mkinitfs "$k" && zcat /boot/initramfs-virt | cpio -t | grep -qE "^(usr/)?lib/modules/$k/.*/virtio_blk\.ko"') CUST+=(--run-command "apk add ${APK_PACKAGES}") elif [[ "$DISTRO" == "ubuntu" ]] && [[ -n "${APT_PACKAGES:-}" ]]; then echo "Will install packages: ${APT_PACKAGES}"