commit 1cb71d3270c996d5d5b0b5c7666fbf6d5f5a52cc
parent e2047954abbb81b53950795f27156d8f5b22aaf8
Author: Divan Visagie <me@divanv.com>
Date: Sat, 21 Nov 2026 02:06:51 +0100
live: an ISO that boots to a kiosk screen (ADR-0014, step 1)
The Containerfile's live stage (the base with greetd, cage, the greeter as a stand-in, the splash, dracut-live, the ISO tools, GRUB's EFI binaries and iso.yaml), turned into an ISO by Fedora 45's image-builder (bootc-generic-iso) in linux/live/build.sh, and booted in QEMU with two blank drives by linux/live/try.sh: UEFI, shim, GRUB, the splash, the greeter's mock first-run screen under cage.
The ISO is built inside the test VM, not on this host: Ubuntu's AppArmor profile unpriv_bwrap denies osbuild's sandbox the capabilities it needs to mount the image. The VM's second disk is 50 GB (sparse) for the container storage and the work. Recorded in ADR-0014. Not done: the installer, the payload, the drive picker, the install command and its polkit rule.
Diffstat:
8 files changed, 204 insertions(+), 3 deletions(-)
diff --git a/docs/adr/0014-the-live-disc-boots-straight-into-the-installer.md b/docs/adr/0014-the-live-disc-boots-straight-into-the-installer.md
@@ -82,6 +82,28 @@ flask (ADR-0012, "The boot and shutdown splash").
and progress screen; the drive picker and its safety rules.
4. The gaps above as they matter, and real hardware.
+## Step 1 done (2026-11-21): a live ISO boots to a kiosk screen
+
+The Containerfile's `live` stage (from the base: greetd, cage, the greeter as a stand-in, the splash,
+`dracut-live`, the ISO tools, GRUB's EFI binaries, `linux/live/iso.yaml`) is turned into an ISO by
+Fedora 45's `image-builder` 89 (`bootc-generic-iso`; no patched build was needed). The ISO is 1.7 GB,
+boots on UEFI through shim and GRUB in QEMU (`linux/live/try.sh`, with two blank drives) and shows
+the greeter's mock first-run screen under cage. The live image itself is 1.5 GB.
+
+Found on the way:
+- **The ISO cannot be built on this host.** image-builder runs osbuild in a bubblewrap sandbox, and
+ Ubuntu's AppArmor profile `unpriv_bwrap` denies it `setuid`, `chown` and `sys_admin`, so mounting the
+ image fails with "permission denied" (the kernel log shows `apparmor="DENIED"`). Docker's
+ `--privileged` and podman's `label=disable` (which only affects SELinux) do not help. `linux/live/build.sh`
+ therefore builds in the test VM (Fedora, SELinux), using its second disk (50 GB, sparse) for the
+ container storage and osbuild's work. CI will want a Fedora runner for the same reason.
+- **The container must keep its SELinux label** in the VM: image-builder labels its own store with
+ `chcon`, which fails with `label=disable`.
+- **`iso.yaml`'s `default` and `timeout` are integers** in this version, and GRUB still counts down
+ from a default (to look at: a timeout of 0 was not honoured).
+- Not yet: the installer, the payload, the drive picker, the privileged install command, Secure Boot
+ and real hardware.
+
## Consequences
- The live disc is one job, and the installer is the only new app. The greeter does not get a live mode.
diff --git a/linux/.dockerignore b/linux/.dockerignore
@@ -6,3 +6,4 @@
!build/desktop/
!build/greeter/
!branding/plymouth-theme.py
+!live/
diff --git a/linux/Containerfile b/linux/Containerfile
@@ -120,3 +120,34 @@ ARG BUILD_ID=unknown
RUN mkdir -p /usr/lib/patina-os && echo "$BUILD_ID" > /usr/lib/patina-os/build
RUN bootc container lint
+
+# ---------------------------------------------------------------------------
+# The live disc (ADR-0014): the base, not the system, since it boots straight into the installer and
+# needs no desktop: greetd and cage, the installer (for now the greeter as a stand-in), the splash,
+# and what the container-native ISO contract asks of an image (ADR-0010): dracut-live in the
+# initramfs so it can boot the squashfs, the ISO tools, GRUB's EFI binaries, iso.yaml. linux/live/
+# build.sh turns it into an ISO with the system image as the offline payload.
+FROM base AS live
+RUN dnf -y --setopt=install_weak_deps=False install \
+ greetd cage plymouth plymouth-plugin-two-step dracut-live dracut-config-generic \
+ xorriso isomd5sum squashfs-tools grub2-tools grub2-efi-x64 grub2-efi-x64-cdboot shim-x64 python3 \
+ mesa-dri-drivers mesa-libEGL mesa-libgbm vulkan-loader mesa-vulkan-drivers \
+ libinput libseat libxkbcommon xkeyboard-config pixman libdrm dejavu-sans-fonts \
+ fontconfig polkit && \
+ dnf clean all
+# GRUB's and shim's EFI binaries where the contract looks for them.
+RUN mkdir -p /boot/efi && cp -ra /usr/lib/efi/*/*/EFI /boot/efi/
+COPY build/greeter/ /
+COPY live/etc/ /etc/
+COPY system/usr/lib/tmpfiles.d/patina-greeter.conf /usr/lib/tmpfiles.d/
+COPY system/usr/share/pixmaps/seflos-logo.svg /usr/share/pixmaps/
+COPY --from=plymouth-theme /sectorf /usr/share/plymouth/themes/sectorf
+RUN mkdir -p /usr/lib/bootc-image-builder
+COPY live/iso.yaml /usr/lib/bootc-image-builder/iso.yaml
+# The initramfs with what a live boot needs: the squashfs by label (dmsquash-live) and the splash.
+RUN printf '[Daemon]\nTheme=sectorf\nShowDelay=0\n' > /etc/plymouth/plymouthd.conf && \
+ systemctl enable greetd.service && systemctl set-default graphical.target && \
+ kver=$(ls /usr/lib/modules) && \
+ DRACUT_NO_XATTR=1 dracut --no-hostonly --kver "$kver" --reproducible --zstd \
+ --add "dmsquash-live plymouth" -f "/usr/lib/modules/$kver/initramfs.img"
+
diff --git a/linux/live/build.sh b/linux/live/build.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+# Builds the live ISO (ADR-0014, ADR-0010): the Containerfile's `live` stage, turned into an ISO by
+# image-builder's bootc-generic-iso. The ISO is built inside the test VM (vm/), not on this host:
+# image-builder runs osbuild in a bubblewrap sandbox, which a host with AppArmor (Ubuntu) confines
+# so that it cannot mount the image ("permission denied"; seen in the kernel log as
+# apparmor="DENIED" profile="unpriv_bwrap"). The VM is Fedora with SELinux, as the tool expects
+# (and the container runs with its own SELinux label: image-builder labels its store itself).
+# The VM's second disk, formatted on first use, holds the container storage and the work.
+#
+# linux/live/build.sh
+#
+# The ISO lands in linux/out/iso/. PAYLOAD=<image ref in the VM's podman> adds that image to the
+# ISO as the offline install payload (ADR-0010).
+set -euo pipefail
+
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+VM="$ROOT/vm/vm.sh"
+OUT="$ROOT/out/iso"
+FEDORA=quay.io/fedora/fedora@sha256:f236063d5a7a15e76ff034f2be5fa6f7a8922fcb655093ad972a1f196b14a007
+say() { printf '==> %s\n' "$*"; }
+
+"$ROOT/greeter-build.sh"
+
+say "building the live image"
+docker build -q --target live -t sectorf-live-installer -f "$ROOT/Containerfile" "$ROOT" >/dev/null
+
+say "the build VM"
+pid="$ROOT/out/qemu.pid"
+if [[ -f "$pid" ]] && kill -0 "$(cat "$pid")" 2>/dev/null; then :; else "$VM" start; "$VM" wait; fi
+"$VM" ssh '
+ set -e
+ mkdir -p /var/builder
+ mountpoint -q /var/builder || {
+ dev=/dev/disk/by-id/virtio-patina-data
+ blkid "$dev" >/dev/null 2>&1 || mkfs.ext4 -q -L builder "$dev"
+ mount "$dev" /var/builder
+ }
+ mkdir -p /var/builder/containers /var/builder/out
+ mountpoint -q /var/lib/containers || mount --bind /var/builder/containers /var/lib/containers
+ df -h /var/builder | tail -1'
+
+say "sending the live image to the VM"
+docker save sectorf-live-installer | "$VM" ssh 'podman load -q >/dev/null && podman tag docker.io/library/sectorf-live-installer:latest localhost/sectorf-live-installer:latest'
+
+say "building the ISO (in the VM)"
+"$VM" ssh "
+ rm -rf /var/builder/out/*
+ mkdir -p /var/builder/cache
+ podman run --rm --privileged \
+ -v /var/lib/containers/storage:/var/lib/containers/storage -v /var/builder/cache:/var/cache/image-builder \
+ -v /var/builder/out:/output $FEDORA sh -c '
+ dnf -y -q install image-builder podman >/dev/null 2>&1
+ image-builder build --output-dir /output --bootc-ref localhost/sectorf-live-installer \
+ --bootc-default-fs btrfs ${PAYLOAD:+--bootc-installer-payload-ref $PAYLOAD} bootc-generic-iso' 2>&1 | tail -25
+ find /var/builder/out -name '*.iso' -exec ls -lh {} \;"
+
+say "copying the ISO out"
+mkdir -p "$OUT"
+iso=$("$VM" ssh "find /var/builder/out -name '*.iso' | head -1")
+[[ -n "$iso" ]] || { echo "error: no ISO was made" >&2; exit 1; }
+"$VM" ssh "cat '$iso'" > "$OUT/sectorf-live.iso"
+ls -lh "$OUT/sectorf-live.iso"
diff --git a/linux/live/etc/greetd/config.toml b/linux/live/etc/greetd/config.toml
@@ -0,0 +1,9 @@
+# The live disc boots straight into the installer (ADR-0014): greetd runs it in cage, as the
+# greeter. For now a stand-in, the greeter's mock first-run screen, to prove the ISO boots to a
+# kiosk screen; the installer replaces it.
+[terminal]
+vt = 1
+
+[default_session]
+command = "env PATINA_GREETER_MOCK=setup systemd-cat -t installer cage -s -- /usr/libexec/patina-greeter"
+user = "greetd"
diff --git a/linux/live/iso.yaml b/linux/live/iso.yaml
@@ -0,0 +1,11 @@
+# What image-builder's bootc-generic-iso takes from the image (the container-native ISO contract,
+# ADR-0010, ADR-0014): the ISO's label and GRUB's menu. The initramfs loads the live squashfs by the
+# label (dracut-live); selinux=0 because the squashfs is not labelled (the contract's own quirk).
+label: SECTORF-LIVE
+grub2:
+ default: 0
+ timeout: 0
+ entries:
+ - name: Install Sector F Linux
+ linux: /images/pxeboot/vmlinuz root=live:CDLABEL=SECTORF-LIVE rd.live.image selinux=0 quiet splash loglevel=3 vt.global_cursor_default=0
+ initrd: /images/pxeboot/initrd.img
diff --git a/linux/live/try.sh b/linux/live/try.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+# Boots the live ISO (out/iso/sectorf-live.iso) in QEMU with UEFI and two blank 16 GB drives, to try
+# the installer (ADR-0014): the chosen one should get the system, the other stay untouched. Its own
+# VNC display (localhost:5902) and monitor, so the test VM (vm/) can run beside it.
+#
+# linux/live/try.sh start boot it (in the background)
+# linux/live/try.sh screenshot save the screen to out/iso/screen.png
+# linux/live/try.sh type 'text' type into it (\t Tab, \n Enter)
+# linux/live/try.sh stop power it off
+# linux/live/try.sh reset also delete the blank drives
+set -euo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+OUT="$ROOT/out/iso"
+ISO="$OUT/sectorf-live.iso"
+MON="$OUT/monitor.sock"
+PID="$OUT/qemu.pid"
+VARS="$OUT/OVMF_VARS.fd"
+running() { [[ -f "$PID" ]] && kill -0 "$(cat "$PID")" 2>/dev/null; }
+
+case "${1:-}" in
+ start)
+ running && { echo "already running"; exit 0; }
+ [[ -f "$ISO" ]] || { echo "no $ISO: linux/live/build.sh first" >&2; exit 1; }
+ for d in a b; do [[ -f "$OUT/drive-$d.qcow2" ]] || qemu-img create -q -f qcow2 "$OUT/drive-$d.qcow2" 16G; done
+ cp -n /usr/share/OVMF/OVMF_VARS_4M.fd "$VARS"
+ rm -f "$MON"
+ qemu-system-x86_64 -enable-kvm -cpu host -m 3072 -smp 2 -machine q35 \
+ -drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd \
+ -drive if=pflash,format=raw,file="$VARS" \
+ -drive file="$ISO",media=cdrom,readonly=on \
+ -drive file="$OUT/drive-a.qcow2",if=none,id=a -device virtio-blk-pci,drive=a,serial=DRIVE-A \
+ -drive file="$OUT/drive-b.qcow2",if=none,id=b -device virtio-blk-pci,drive=b,serial=DRIVE-B \
+ -device virtio-vga -vnc 127.0.0.1:2 -monitor "unix:$MON,server,nowait" \
+ -netdev user,id=n0 -device virtio-net-pci,netdev=n0 \
+ -daemonize -pidfile "$PID"
+ echo "booting: VNC localhost:5902; $0 screenshot"
+ ;;
+ screenshot)
+ running || { echo "not running" >&2; exit 1; }
+ shot=${2:-$OUT/screen.png}; shot=$(cd "$(dirname "$shot")" && pwd)/$(basename "$shot")
+ rm -f "$shot"; printf 'screendump %s -f png\n' "$shot" | nc -U -q 1 "$MON" >/dev/null
+ for _ in $(seq 1 20); do [[ -s "$shot" ]] && break; sleep 0.2; done
+ echo "$shot"
+ ;;
+ type)
+ MON="$MON" python3 -I - "$2" <<'PY'
+import os, socket, sys, time
+s = socket.socket(socket.AF_UNIX); s.connect(os.environ["MON"]); s.settimeout(1)
+try: s.recv(4096)
+except Exception: pass
+SPECIAL = {" ": "spc", "-": "minus", "_": "shift-minus", ".": "dot", "\t": "tab", "\n": "ret", "\b": "backspace"}
+for ch in sys.argv[1].encode().decode("unicode_escape"):
+ key = SPECIAL.get(ch) or ("shift-" + ch.lower() if ch.isupper() else ch)
+ s.sendall(("sendkey " + key + "\n").encode()); time.sleep(0.07)
+ try: s.recv(4096)
+ except Exception: pass
+PY
+ ;;
+ stop)
+ running && kill "$(cat "$PID")"; rm -f "$PID" ;;
+ reset)
+ "$0" stop; rm -f "$OUT"/drive-*.qcow2 "$OUT/OVMF_VARS.fd" ;;
+ *) sed -n 2,11p "$0" | sed 's/^# \{0,1\}//'; exit 2 ;;
+esac
diff --git a/linux/vm/common.sh b/linux/vm/common.sh
@@ -15,10 +15,11 @@ VM_IMAGE="$IMAGE"
DISK="$OUT/disk.raw"
DISK_SIZE=20G
-# A second, empty disk for the ZFS pool for /home (ADR-0001), which the VM sees
-# as /dev/disk/by-id/virtio-patina-data.
+# A second, empty disk, which the VM sees as /dev/disk/by-id/virtio-patina-data. It is where the
+# live ISO is built (live/build.sh): container storage and osbuild's work need tens of GB, and the
+# disk is sparse, so it costs nothing until used.
DATA="$OUT/data.qcow2"
-DATA_SIZE=10G
+DATA_SIZE=50G
KEY="$OUT/id_ed25519"
SSH_PORT=2222
SERIAL_LOG="$OUT/serial.log"