fix: boot chain — add live-boot, mount proc/sys/dev, fix kernel params

The first ISO build didn't boot. Three root causes:

1. No squashfs-as-root mechanism — the custom initramfs hook mounted
   boot media but had no way to use the squashfs as the root filesystem.
   Fix: add live-boot + live-boot-initramfs-tools to debootstrap includes.
   This is ~100KB and provides proven squashfs-as-root with overlayfs.

2. Broken initramfs — update-initramfs needs /proc, /sys, /dev mounted
   in the chroot to detect modules and generate a working initrd.
   Fix: bind-mount virtual filesystems before update-initramfs.

3. Missing kernel parameters — GRUB and ISOLINUX configs lacked
   boot=live components, so live-boot never activated.
   Fix: add boot=live components to all kernel command lines.

Also: add all_video/efi_gop/efi_uga modules to GRUB EFI image for
display output on real hardware, and update installer wrapper to
check /run/live/medium first (where live-boot mounts the ISO).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-27 19:08:00 +00:00
parent 7183ebfa2b
commit 69c62eb47a

View File

@@ -461,6 +461,7 @@ debootstrap --variant=minbase --arch=${DEB_ARCH} \
kmod,procps,iproute2,ca-certificates,gdisk,\
cryptsetup,cryptsetup-initramfs,parted,dosfstools,e2fsprogs,\
linux-image-${DEB_ARCH},grub-efi-${DEB_ARCH},grub-pc-bin,\
live-boot,live-boot-initramfs-tools,\
pciutils,usbutils,less,nano \
bookworm /installer http://deb.debian.org/debian
@@ -514,7 +515,7 @@ echo " Automatic Installer"
echo ""
BOOT_MEDIA=""
for dev in /run/archiso /cdrom /media/cdrom /mnt/iso; do
for dev in /run/live/medium /lib/live/mount/medium /run/archiso /cdrom /media/cdrom /mnt/iso; do
if [ -f "\$dev/archipelago/auto-install.sh" ]; then
BOOT_MEDIA="\$dev"
break
@@ -529,7 +530,7 @@ if [ -n "\$BOOT_MEDIA" ]; then
exec bash "\$BOOT_MEDIA/archipelago/auto-install.sh"
else
echo " Installer not found on boot media."
echo " Checked: /run/archiso, /cdrom, /media/cdrom, /mnt/iso"
echo " Checked: /run/live/medium, /run/archiso, /cdrom, /media/cdrom"
echo ""
echo " Dropping to shell for manual recovery..."
exec /bin/bash
@@ -594,10 +595,20 @@ KVER=$(ls /installer/lib/modules/ | sort -V | tail -1)
echo " [container] Kernel version: $KVER"
cp /installer/boot/vmlinuz-$KVER /output/vmlinuz
# Build initramfs with our custom hooks
# Mount virtual filesystems for proper initramfs generation
mount --bind /proc /installer/proc
mount --bind /sys /installer/sys
mount --bind /dev /installer/dev
# Build initramfs with live-boot hooks + our custom hooks
chroot /installer update-initramfs -c -k $KVER
cp /installer/boot/initrd.img-$KVER /output/initrd.img
# Cleanup mounts
umount /installer/dev 2>/dev/null || true
umount /installer/sys 2>/dev/null || true
umount /installer/proc 2>/dev/null || true
# Create squashfs
echo " [container] Creating installer squashfs..."
mksquashfs /installer /output/filesystem.squashfs -comp xz -Xbcj x86 -noappend -quiet
@@ -607,7 +618,8 @@ echo " [container] Building GRUB EFI image..."
grub-mkimage -O x86_64-efi -o /output/BOOTX64.EFI -p /boot/grub \
part_gpt part_msdos fat iso9660 udf normal boot linux search \
search_fs_uuid search_fs_file search_label configfile echo cat \
ls test true loopback gfxterm gfxmenu font png
ls test true loopback gfxterm gfxmenu font png all_video video \
video_bochs video_cirrus efi_gop efi_uga
# Create EFI FAT image (4MB)
dd if=/dev/zero of=/output/efi.img bs=1M count=4 2>/dev/null
@@ -2455,12 +2467,12 @@ else
fi
menuentry "Install Archipelago" --hotkey=i {
linux /live/vmlinuz quiet
linux /live/vmlinuz boot=live components quiet
initrd /live/initrd.img
}
menuentry "Install Archipelago (verbose)" --hotkey=v {
linux /live/vmlinuz
linux /live/vmlinuz boot=live components
initrd /live/initrd.img
}
@@ -2488,13 +2500,13 @@ DEFAULT install
LABEL install
MENU LABEL Install Archipelago
KERNEL /live/vmlinuz
APPEND initrd=/live/initrd.img quiet
APPEND initrd=/live/initrd.img boot=live components quiet
MENU DEFAULT
LABEL install-verbose
MENU LABEL Install Archipelago (verbose)
KERNEL /live/vmlinuz
APPEND initrd=/live/initrd.img
APPEND initrd=/live/initrd.img boot=live components
LABEL local
MENU LABEL Boot from local disk