fix(pxe-infra): back to sanboot now that ESP has BOOTX64.EFI

The previous run of imgfetch+boot crashed at RIP 0x7EE855FC in iPXE. iPXE was passing the full 2GB raw disk image to the firmware 'boot' primitive, which expects a UEFI PE executable (a small file with a PE header), not a 2GB block-device image. The firmware's PE loader hits uninitialised memory and the RIP-AF pattern reappears.

The earlier sanboot attempt also crashed, but that was before the systemd-boot fix gave the image a real \EFI\BOOT\BOOTX64.EFI. sanboot presents the URL as a block device, the firmware walks the GPT and finds the ESP, systemd-boot runs, and the kernel boots from the local ext4 partition. This is the right primitive for raw disk images served over HTTP.

Refs: docs/ARCHITECTURE.md section L4.
This commit is contained in:
oqyude committed 2026-10-13 03:57:28 +03:00
1 parent 4ff7188678
commit 8d5fad76fd
1 file changed
+9 -5
+9 -5
View File
@@ -39,13 +39,17 @@
environment.etc."pxe-infra/http/boot.ipxe".source = pkgs.writeText "boot.ipxe" '' environment.etc."pxe-infra/http/boot.ipxe".source = pkgs.writeText "boot.ipxe" ''
#!ipxe #!ipxe
set boot-url http://${config.pxe-infra.bridge.address}/latest set boot-url http://${config.pxe-infra.bridge.address}/latest
imgfetch ''${boot-url}/alpine-worker.raw # sanboot (not imgfetch+boot) is the right primitive for
boot || goto retry # raw disk images: it presents the URL as a block device
# to the firmware, and the firmware walks the partition
# table to find a bootloader. `boot` tries to parse the
# blob as a UEFI PE executable, which a 2 GB raw disk
# is not.
sanboot ''${boot-url}/alpine-worker.raw || goto retry
:retry :retry
echo boot failed, retrying in 5s echo sanboot failed, retrying in 5s
sleep 5 sleep 5
imgfetch ''${boot-url}/alpine-worker.raw sanboot ''${boot-url}/alpine-worker.raw
boot
''; '';
}; };
} }