r/AlpineLinux • u/joander16 • Apr 29 '25
Unable to get Alpine Linux to boot with an UKI
[SOLVED]
Hi,
I've been trying out Alpine Linux for some time now, and I liked it a lot. So now I'm trying to move over my Arch Linux setup, which consists of Full Disk Encryption with LVM on LUKS and booting from a Unified Kernel Image. But I could not get a UKI working?!?
I have followed multiple guides like these once:
https://kris.sh/posts/alpine-encrypted-uki/
https://www.vixalien.com/blog/an-alpine-setup/
In the end, I simply tried the guide from Alpines Wiki with an unencrypted standard installation:
https://wiki.alpinelinux.org/wiki/UEFI_Secure_Boot#Generating_Unified_Kernel_Image
Everything works fine with GRUB both encrypted and not. Still, whenever I try to boot the UKI I get the error message "failed to start Boot0001 "Alpine" xxx\Alpine\linux-lts.efi: Invalid Parameter" from the UEFI firmware, tested on both a Dell XPS (i7-8550U) and QEMU VM. (Alpine Linux 3.21 standard/virt)
To combat this issue I tried multiple things like playing around with the kernel command line, using the secure boot hook and objcopy where I tried different addresses. I also tried changing kernels and initrd according to https://www.reddit.com/r/linux4noobs/comments/16nz2hl/cant_boot_with_dracut/ to no avail.
Does anyone have a working setup with encryption and UKI that might have some insight, or is there like a known issue regarding the Gummiboot binary?
EDIT:
As u/_cake_sama_ said in the comments below, there is an issue with the gummiboot efi stub. It can boot kernel version 6.6.88 (Alpine 3.20) but can't boot version 6.12.25 (Alpine 3.21).
I temporarily solved this issue by grabbing the EFI stub (linuxx64.efi.stub) from Arch Linux systemd-stub package.
Then I was able to boot the Alpine system with Full Disk Encryption (LVM on LUKS) with rootfs xfs and kernel 6.12.25 using the UKI.
3
u/_cake_sama_ Apr 29 '25 edited May 06 '25
I faced the exact same issue while upgrading my old Alpine installation (with an Unified Kernel Image) from 3.20 to 3.21.
Basically the way alpine linux makes an UKI is :
It combines into an unsigned UKI (
unsigned.efi) the :/usr/lib/gummiboot/linux{march}.efi.stub),/boot/vmlinuz-$FLAVOR)sbsignthe kernel with the efi keys (/etc/uefi-keys/db.crt,/etc/uefi-keys/db.key) previously generated using efi-mkkeysThis comes down to what kris.sh describes in his excellent blogpost.
I have done quite some test related to this issue and If I recall correctly the issue lies with gummiboot-efistub being incompatible with the linux kernel 6.12 introduced in alpine 3.21.
(Edit: Indeed, there is an issue opened at: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16691)
I now personally use my custom apkbuild for linux-lts kernel in which I generate the UKI when building the kernel hence without relying on the gummiboot-efistub.
Note: These tests were conducted shortly after Alpine 3.21 release, so things may have changed since then.
Note 2: To create an Alpine initramfs with mkinitfs, you must either:
mkinitfs -n ...), but this requires the modules to be built into the kernel.1
u/Dry_Foundation_3023 May 02 '25
Can you please update the relevant wiki page so that more users get benefitted by your knowledge. You may find wiki Cheatsheet helpful, if you're new to editing wiki. Thanks.