sector-f-linux

Sector F Linux
git clone https://git.sectorflabs.com/sector-f-linux.git
Log | Files | Refs | README | LICENSE

commit 04a285fdd1860d57d611110ad08e1a53eb1f9a1d
parent a73c22c8145633d8bc308ebe3aa58e5c0e29755e
Author: Divan Visagie <me@divanv.com>
Date:   Fri, 27 Nov 2026 21:27:18 +0100

iso: carry the published image, and clear the build VM's old images (ADR-0015)

The ISO's payload is pulled from the registry, not sent from Docker. docker save and podman load
rewrite the manifest, so the payload's digest differed from the published one (same build) and a
machine installed from the ISO would have been told by the updater that an update was waiting
for the build it already runs. So make publish comes before make iso.

The build VM kept every earlier payload (4.5 GB and up each) and an 18 GB osbuild cache, and the
ISO build ran out of space unpacking the 5 GB payload. Each run now removes the VM's old images,
and clears the cache when less than 30 GB is free.

Diffstat:
MMakefile | 2+-
Mdocs/adr/0015-nothing-is-published-until-publish.md | 9+++++++--
Mlinux/live/build.sh | 22+++++++++++++++-------
Mlinux/vm/README.md | 4++--
Mlinux/vm/build.sh | 6+++---
5 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile @@ -27,7 +27,7 @@ installer: ## Build only the installer into linux/build/installer/ (in the Fedor updater: ## Build only the updater into linux/build/updater/ (in the Fedora builder) linux/updater-build.sh -iso: ## Build the install ISO to linux/out/iso/ from the image `make build` made (builds in the VM; takes a while; DEBUG=1 adds SSH for the rig) +iso: ## Build the install ISO to linux/out/iso/ from the published image, so after `make publish` (builds in the VM; takes a while; DEBUG=1 adds SSH for the rig) $(if $(DEBUG),LIVE_DEBUG=1 )linux/live/build.sh iso-run: ## Boot the ISO in QEMU with two blank drives (VNC localhost:5902) diff --git a/docs/adr/0015-nothing-is-published-until-publish.md b/docs/adr/0015-nothing-is-published-until-publish.md @@ -21,8 +21,13 @@ nothing needs to be published to test locally. Docker on this machine. Nothing is pushed. - **`make publish` is the only thing that pushes,** and it pushes the image `make build` made, not a rebuild, so what was tried is what ships. -- **`make disk` and `make iso` take the image from this machine's Docker** (`docker save`, loaded - into the VM's or the installer's podman), not from the registry. +- **`make disk` takes the image from this machine's Docker** (`docker save`, loaded + into the VM's podman), not from the registry. +- **`make iso` comes after `make publish`, and carries the published image,** pulled from the + registry. Sending it from Docker (`docker save`, `podman load`) rewrites the manifest, so the + payload's digest differs from the published one (seen: `9f12…` against `4d44…`, the same build), and + a machine installed from the ISO would be told by the updater (ADR-0016) that an update was + waiting for the build it already runs. A pull keeps the manifest as published. - **There is one ISO.** It carries the real image, has no test user and no SSH, and installed machines follow `ghcr.io/sector-f-labs/sector-f-linux:latest`. `make iso DEBUG=1` adds the rig's SSH key, for driving the ISO in QEMU; that is an option of a local test, not a second product. diff --git a/linux/live/build.sh b/linux/live/build.sh @@ -9,10 +9,11 @@ # # linux/live/build.sh # -# The ISO lands in linux/out/iso/. It carries the image `make build` made (SYSTEM_IMAGE, the real -# one, no test login) as the offline install payload (ADR-0010), sent to the VM from this machine's -# Docker, so nothing is pulled from or pushed to the registry. The payload and TARGET_IMGREF -# (what installed machines follow for updates) are both the published name, ghcr.io/sector-f-labs/sector-f-linux:latest. +# The ISO lands in linux/out/iso/. It carries the published image (the real one, no test login) as +# the offline install payload (ADR-0010). The payload and TARGET_IMGREF +# (what installed machines follow for updates) are both the published name, +# ghcr.io/sector-f-labs/sector-f-linux:latest, and the VM pulls it, so `make publish` comes first +# and the ISO carries exactly what was published (the same digest, which the updater compares). # LIVE_DEBUG=1 (make iso DEBUG=1) lets root log in over SSH with the test rig's key, for driving # the ISO in QEMU; an ISO made without it has no SSH access. set -euo pipefail @@ -23,7 +24,6 @@ OUT="$ROOT/out/iso" FEDORA=quay.io/fedora/fedora:45 say() { printf '==> %s\n' "$*"; } -docker image inspect "$SYSTEM_IMAGE" >/dev/null 2>&1 || die "no $SYSTEM_IMAGE; make build first" "$ROOT/installer-build.sh" say "building the live image" @@ -47,13 +47,21 @@ if [[ -f "$pid" ]] && kill -0 "$(cat "$pid")" 2>/dev/null; then :; else "$VM" st } mkdir -p /var/builder/containers /var/builder/out mountpoint -q /var/lib/containers || mount --bind /var/builder/containers /var/lib/containers + # Each run sends or pulls what it needs again, so what is left from earlier runs (old payloads are + # several GB each) only fills the disk; and osbuild's cache is cleared when less than 30 GB is free. + podman rmi -af >/dev/null 2>&1 || true + [ "$(df --output=avail -BG /var/builder | tail -1 | tr -dc 0-9)" -ge 30 ] || rm -rf /var/builder/cache/* 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 "sending the payload $SYSTEM_IMAGE to the VM, as $PAYLOAD" -docker save "$SYSTEM_IMAGE" | "$VM" ssh "podman load -q >/dev/null && podman tag $SYSTEM_IMAGE $PAYLOAD && df -h /var/builder | tail -1" +# The payload is pulled from the registry, not sent from Docker: docker save and podman load rewrite +# the image's manifest, so its digest would differ from the published one, and a machine installed +# from the ISO would be told an update was waiting for the build it already runs. A pull keeps the +# manifest as published. So publish first (make build, make publish, make iso). +say "pulling the payload $PAYLOAD into the VM" +"$VM" ssh "podman pull -q $PAYLOAD >/dev/null && df -h /var/builder | tail -1" say "building the ISO (in the VM)" "$VM" ssh " diff --git a/linux/vm/README.md b/linux/vm/README.md @@ -47,8 +47,8 @@ image underneath and keeps the layer. `/`, and the Containerfile copies it in, so the image gets what `make install` puts in place; the libraries and programs it needs come from dnf. `/usr/lib/patina-os/desktop` names the commit. - **The image** has two stages: `system`, the real one, and `dev`, which adds the test user. - vm/build.sh builds both, locally: `sector-f-linux:build` (what `make iso` carries and - `make publish` pushes) and `sector-f-linux-dev:build` (the VM only). Neither is pushed by the build. + vm/build.sh builds both, locally: `sector-f-linux:build` (what `make publish` pushes, and so + what `make iso` carries) and `sector-f-linux-dev:build` (the VM only). Neither is pushed by the build. - **The registry** is GitHub's, `ghcr.io/sector-f-labs/sector-f-linux`. Only `make publish` (`../publish.sh`) writes to it, and only the real image, logged in with `gh`'s token (needs the `write:packages` scope). The VM follows that name, so `make upgrade` works after a publish. diff --git a/linux/vm/build.sh b/linux/vm/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Builds the Patina desktop (desktop/build.sh), the greeter, the updater, then the image, all on this machine: -# SYSTEM_IMAGE the real image (the Containerfile's `system` stage), what `make iso` carries and -# `make publish` pushes +# SYSTEM_IMAGE the real image (the Containerfile's `system` stage), what `make publish` pushes and +# so what `make iso` then carries # IMAGE the same plus a test login (`dev` stage), for the VM (`make disk`, `make run`) # Nothing is pushed; `make publish` is the only thing that does (linux/publish.sh). # QUICK=1 skips the desktop, greeter and updater builds, for changes to the image only (the Containerfile, @@ -21,4 +21,4 @@ docker build -f "$ROOT/Containerfile" --target system -t "$SYSTEM_IMAGE" "$ROOT" say "building $IMAGE (the same, with a test login)" docker build -f "$ROOT/Containerfile" --target dev \ --build-arg BUILD_ID="$build_id" -t "$IMAGE" "$ROOT" -say "done: $SYSTEM_IMAGE and $IMAGE, on this machine only. make iso, make run, make publish." +say "done: $SYSTEM_IMAGE and $IMAGE, on this machine only. make run to try it, make publish, then make iso."