diff --git a/image-recipe/_archived/build-auto-installer-iso.sh b/image-recipe/_archived/build-auto-installer-iso.sh index 9e88e2bf..abe90baa 100755 --- a/image-recipe/_archived/build-auto-installer-iso.sh +++ b/image-recipe/_archived/build-auto-installer-iso.sh @@ -1064,6 +1064,14 @@ echo " netavark + aardvark-dns: included in rootfs (Debian 13 packages)" echo " Including root filesystem..." cp "$ROOTFS_TAR" "$ARCH_DIR/rootfs.tar" +# Ship the canonical systemd unit on the ISO. The rootfs tar is a cached +# artifact that can predate unit fixes (B17: RequiresMountsFor on the data +# volume — without it fresh installs boot-loop "[FAILED]" until the LUKS +# mount lands), so the installer overwrites the rootfs copy with this one. +mkdir -p "$ARCH_DIR/configs" +cp "$SCRIPT_DIR/../configs/archipelago.service" "$ARCH_DIR/configs/archipelago.service" +echo " Using archipelago.service from configs/ (installer overrides rootfs copy)" + # Capture backend binary from live server if [ "$BUILD_FROM_SOURCE" = "1" ]; then echo " Building backend binary from source..." @@ -2662,11 +2670,16 @@ alias poweroff='sudo systemctl poweroff' ALIASES fi -# Systemd service: use the production version from rootfs (configs/archipelago.service) -# Do NOT overwrite — the rootfs already has the correct User=archipelago, no DEV_MODE version -if [ ! -f /mnt/target/etc/systemd/system/archipelago.service ]; then - echo " WARNING: archipelago.service missing from rootfs — copying from ISO" - cp "$BOOT_MEDIA/archipelago/../configs/archipelago.service" /mnt/target/etc/systemd/system/archipelago.service 2>/dev/null || true +# Systemd service: the canonical unit shipped on the ISO (archipelago/configs/) +# ALWAYS wins over the rootfs copy — the rootfs tar is a cached build artifact +# that can predate unit fixes (B17: without RequiresMountsFor=/var/lib/archipelago +# the service races the LUKS data mount on cold boot and "[FAILED]"-loops for +# minutes on every fresh install). +if [ -f "$BOOT_MEDIA/archipelago/configs/archipelago.service" ]; then + cp "$BOOT_MEDIA/archipelago/configs/archipelago.service" /mnt/target/etc/systemd/system/archipelago.service + echo " Installed archipelago.service from ISO configs (overrides rootfs copy)" +elif [ ! -f /mnt/target/etc/systemd/system/archipelago.service ]; then + echo " WARNING: archipelago.service missing from rootfs and ISO configs" fi # Claude API proxy — middleware that injects max_tokens, strips invalid fields diff --git a/image-recipe/archipelago-scripts/install-to-disk.sh b/image-recipe/archipelago-scripts/install-to-disk.sh index 25b13901..073f5eb4 100755 --- a/image-recipe/archipelago-scripts/install-to-disk.sh +++ b/image-recipe/archipelago-scripts/install-to-disk.sh @@ -325,6 +325,9 @@ PROFILE_EOF Description=Archipelago Backend Server After=network-online.target Wants=network-online.target +# Never start before the data volume (if one exists) is mounted — without this +# the service races the mount on cold boot and "[FAILED]"-loops until it lands (B17) +RequiresMountsFor=/var/lib/archipelago [Service] Type=simple