sector-f-linux

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

commit f80edab1681279e5ba80d3ae4399ee2972aa1a0a
parent 3f9845bdb007ee8a551d8cc9f38c7f14ca789362
Author: Divan Visagie <me@divanv.com>
Date:   Fri, 27 Nov 2026 19:46:11 +0100

build: nothing is published until make publish, ghcr.io as the registry, Rust in the image (ADR-0015)

- make build is local: it builds the real image and the VM's (the same plus the patina test login)
  in Docker and pushes nothing. make publish is the only push, of the image make build made, to
  ghcr.io/sector-f-labs/sector-f-linux with gh's token. make disk and make iso take the image from
  Docker, not the registry. There is one ISO (no test user, no SSH unless make iso DEBUG=1); the
  separate iso-release target and the dev repository are gone. The registry host on the tailnet is
  no longer used.
- The Fedora bases follow the 45 tag instead of a digest, which quay.io had stopped serving.
- libmpv: the builder gets mpv-devel and the image mpv-libs, which patina-desktop's video-player
  needs to link and to run.
- The image carries the Rust toolchain (rust, cargo, clippy, rustfmt, rust-src, rust-analyzer) and
  gcc, git and make.
- The updater is built and copied into the image (updater-build.sh, make updater, make check).

Diffstat:
MMakefile | 26++++++++++++++------------
Adocs/adr/0015-nothing-is-published-until-publish.md | 36++++++++++++++++++++++++++++++++++++
Mlinux/Containerfile | 21+++++++++++----------
Mlinux/desktop/builder.Containerfile | 6+++---
Mlinux/live/build.sh | 24+++++++++++++-----------
Mlinux/publish.sh | 49+++++++++++++++++++------------------------------
Mlinux/vm/README.md | 31++++++++++++++++---------------
Mlinux/vm/build.sh | 30+++++++++++++-----------------
Mlinux/vm/clean.sh | 6+++---
Mlinux/vm/common.sh | 16+++++++++-------
Mlinux/vm/disk.sh | 15+++++++++------
11 files changed, 146 insertions(+), 114 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,17 +1,18 @@ -# Sector F Linux: build the image (Fedora bootc on Btrfs), run it in a VM, and publish it. +# Sector F Linux: build the image (Fedora bootc on Btrfs), run it in a VM, make the install ISO, and publish. +# Nothing leaves this machine until `make publish`. # These wrap the scripts in linux/ (see linux/vm/README.md). Needs Docker, QEMU with KVM and OVMF. VM := linux/vm/vm.sh DISK := linux/out/disk.raw .DEFAULT_GOAL := help -.PHONY: help build desktop greeter installer iso iso-release iso-run iso-stop iso-shot iso-ssh iso-reset check publish disk run console stop ssh view screenshot log upgrade rollback clean distclean +.PHONY: help build desktop greeter installer updater iso iso-run iso-stop iso-shot iso-ssh iso-reset check publish disk run console stop ssh view screenshot log upgrade rollback clean distclean help: ## List the targets @grep -E '^[a-zA-Z_-]+:.*## ' $(MAKEFILE_LIST) | \ awk 'BEGIN{FS=":.*## "} {printf " %-12s %s\n", $$1, $$2}' -build: ## Build the desktop, greeter and image, and push it to the registry (QUICK=1 skips the first two) +build: ## Build the desktop, greeter, updater and image on this machine, no push (QUICK=1 skips the first two) linux/vm/build.sh desktop: ## Build only the Patina desktop into linux/build/desktop/ @@ -23,11 +24,11 @@ greeter: ## Build only the greeter into linux/build/greeter/ (in the Fedora buil installer: ## Build only the installer into linux/build/installer/ (in the Fedora builder) linux/installer-build.sh -iso: ## Build the live install ISO to linux/out/iso/ from the dev image, with SSH for the rig (builds in the VM; takes a while) - LIVE_DEBUG=1 TARGET_IMGREF=registry.example.com/sectorf-linux-dev:latest linux/live/build.sh +updater: ## Build only the updater into linux/build/updater/ (in the Fedora builder) + linux/updater-build.sh -iso-release: ## Build the live install ISO from the published image (sectorf-linux), no SSH, no test user (same output file) - PAYLOAD=registry.example.com/sectorf-linux:latest TARGET_IMGREF=registry.example.com/sectorf-linux:latest linux/live/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) + $(if $(DEBUG),LIVE_DEBUG=1 )linux/live/build.sh iso-run: ## Boot the ISO in QEMU with two blank drives (VNC localhost:5902) linux/live/try.sh start @@ -38,17 +39,18 @@ iso-stop: ## Power the ISO's VM off iso-shot: ## Save the ISO VM's screen to linux/out/iso/screen.png linux/live/try.sh screenshot -iso-ssh: ## A root shell in the ISO VM (dev ISO only; or: make iso-ssh CMD='lsblk') +iso-ssh: ## A root shell in the ISO VM (needs an ISO built with DEBUG=1; or: make iso-ssh CMD='lsblk') linux/live/try.sh ssh $(CMD) iso-reset: ## Stop the ISO VM and blank its two drives linux/live/try.sh reset -check: ## Tests and clippy for the greeter and the installer +check: ## Tests and clippy for the greeter, the installer and the updater $(MAKE) -C greeter check $(MAKE) -C installer check + $(MAKE) -C updater check -publish: ## Build the real image (not the VM's dev one) and push it to registry.example.com (tailnet only) +publish: ## Push the image `make build` made to ghcr.io/sector-f-labs (the only target that pushes) linux/publish.sh disk: ## Install the image onto linux/out/disk.raw (replaces the disk) @@ -81,7 +83,7 @@ screenshot: ## Save the VM's screen to linux/out/screen.png log: ## Follow the VM's serial console $(VM) log -upgrade: ## In the running VM: fetch the latest build from the registry and stage it (rpm-ostree: bootc refuses once a package is layered; ADR-0009) +upgrade: ## In the running VM: fetch the latest published image and stage it (after `make publish`) (rpm-ostree: bootc refuses once a package is layered; ADR-0009) $(VM) ssh rpm-ostree upgrade rollback: ## In the running VM: boot the previous build at the next reboot @@ -90,5 +92,5 @@ rollback: ## In the running VM: boot the previous build at the next reboot clean: ## Stop the VM and delete linux/out/ linux/vm/clean.sh -distclean: ## Also delete the built test image +distclean: ## Also delete the built images linux/vm/clean.sh --all diff --git a/docs/adr/0015-nothing-is-published-until-publish.md b/docs/adr/0015-nothing-is-published-until-publish.md @@ -0,0 +1,36 @@ +# 0015. Nothing is published until `make publish`; one ISO + +Date: 2026-11-27 + +## Status + +Accepted (the user's direction). + +## Context + +`make build` pushed a test image, `sector-f-linux-dev`, to the registry, because the test VM and the +ISO's build VM pulled their image from there, and the test image has a login that the real one must +not. That left two images in the registry, and two ISOs: a dev one (SSH for the rig, payload the dev +image) and a release one that needed `make publish` first. Nobody wants to ship the dev ISO, and +nothing needs to be published to test locally. + +## Decision + +- **`make build` is local.** It builds the real image (`sector-f-linux:build`, the Containerfile's + `system` stage) and the VM's image (`sector-f-linux-dev:build`, `system` plus the test login) in + 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. +- **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. +- The VM follows the published image, so `make upgrade` is tried after a publish. + +## Consequences + +- The registry holds one repository, `sector-f-linux`. The old `sector-f-linux-dev` there can be deleted. +- Trying an update in the VM needs a real publish first (before, it needed a dev push). +- Amends [ADR-0009](0009-seflos-a-fedora-bootc-image-on-btrfs.md) (the dev stage and its registry) and + [ADR-0014](0014-the-live-disc-boots-straight-into-the-installer.md) (the payload). diff --git a/linux/Containerfile b/linux/Containerfile @@ -5,14 +5,13 @@ # dev the system plus what the test VM needs: a user to log in as, and # trust in the development registry (vm/README.md) # -# The desktop is built first by desktop/build.sh, into build/desktop/, and the greeter by -# greeter-build.sh, into build/greeter/. +# The desktop is built first by desktop/build.sh, into build/desktop/, the greeter by +# greeter-build.sh, into build/greeter/, and the updater by updater-build.sh, into build/updater/. -# Fedora's own bootc image, pinned by digest: the best-tested base bootc has, -# with its own kernel, so none of the workarounds the Ubuntu base needed (a -# newer bootc and kernel, dpkg's state) are here. The digest is Fedora 45 as of -# 2026-11-20; update it to take a new base. -FROM quay.io/fedora/fedora-bootc@sha256:813fd13fb01363e76310c5e764ddcba8e275a0259255f49b5717a9925e74b177 AS base +# Fedora's own bootc image, on the 45 tag so it follows Fedora's rebuilds (a digest pin stops +# resolving once upstream drops it): the best-tested base bootc has, with its own kernel, so none +# of the workarounds the Ubuntu base needed (a newer bootc and kernel, dpkg's state) are here. +FROM quay.io/fedora/fedora-bootc:45 AS base # The boot and shutdown splash (Plymouth): Fedora's spinner theme, tinted in the greeter's # Everforest colours, with the logo. Built here so Pillow and rsvg-convert stay out of the image. @@ -51,7 +50,7 @@ RUN dnf -y --setopt=install_weak_deps=False install \ pipewire pipewire-pulseaudio wireplumber \ mesa-dri-drivers mesa-vulkan-drivers mesa-libEGL mesa-libgbm vulkan-loader \ libinput libseat libxkbcommon xkeyboard-config pixman libdrm \ - gtk4 webkitgtk6.0 alsa-lib openssl-libs fontconfig sqlite-libs libsoup3 pam \ + gtk4 webkitgtk6.0 alsa-lib openssl-libs fontconfig sqlite-libs libsoup3 pam mpv-libs \ dejavu-sans-fonts google-noto-color-emoji-fonts \ hicolor-icon-theme adwaita-icon-theme yaru-icon-theme \ foot xdg-user-dirs \ @@ -61,13 +60,15 @@ RUN dnf -y --setopt=install_weak_deps=False install \ cups cups-browsed cups-filters hplip \ fprintd fprintd-pam \ tailscale openvpn NetworkManager-openvpn avahi ModemManager \ - qemu-kvm fastfetch htop microcode_ctl linux-firmware btrfs-progs && \ + qemu-kvm fastfetch htop microcode_ctl linux-firmware btrfs-progs \ + rust cargo clippy rustfmt rust-src rust-analyzer gcc git make && \ dnf clean all # The Patina desktop and Files, and its session: laid out under / by desktop/build.sh. And the # greeter, laid out by greeter-build.sh. COPY build/desktop/ / COPY build/greeter/ / +COPY build/updater/ / # Files the system adds to the base, as laid out under system/. Among them, # boot.automount is masked (a symlink to /dev/null in /etc/systemd/system): @@ -144,7 +145,7 @@ COPY live/usr/ /usr/ # (an image in this disc's container storage, put there by image-builder) and the registry image the # machine updates from. Set by live/build.sh. ARG PAYLOAD_REF= -ARG TARGET_IMGREF=registry.example.com/sectorf-linux:latest +ARG TARGET_IMGREF=ghcr.io/sector-f-labs/sector-f-linux:latest RUN mkdir -p /usr/lib/patina-install && echo "$PAYLOAD_REF" > /usr/lib/patina-install/payload && \ echo "$TARGET_IMGREF" > /usr/lib/patina-install/target # For testing only (LIVE_DEBUG=1 in live/build.sh): root can log in over SSH with the test rig's key. diff --git a/linux/desktop/builder.Containerfile b/linux/desktop/builder.Containerfile @@ -4,11 +4,11 @@ # desktop/build.sh runs `build.py --stage` in it and the image copies the tree # in, so the image gets exactly what `make install-full` puts in place: every # binary and app, the default apps list, session entry, portal and PAM config. -# Pinned by digest, as the image's base is. +# Follows the fedora:45 tag, so it stays buildable when Fedora rebuilds the image. # # Rust comes from rustup, pinned, so builds repeat: patina-desktop's lockfile # needs 1.95. Raise RUST_VERSION when the lockfile asks for more. -FROM quay.io/fedora/fedora@sha256:f236063d5a7a15e76ff034f2be5fa6f7a8922fcb655093ad972a1f196b14a007 +FROM quay.io/fedora/fedora:45 ARG RUST_VERSION=1.95.0 @@ -18,7 +18,7 @@ RUN dnf -y --setopt=install_weak_deps=False install \ libxkbcommon-devel pixman-devel systemd-devel libinput-devel libseat-devel \ mesa-libgbm-devel mesa-libEGL-devel libdrm-devel wayland-devel pam-devel \ alsa-lib-devel vulkan-loader-devel vulkan-headers webkitgtk6.0-devel \ - openssl-devel fontconfig-devel sqlite-devel libsoup3-devel && \ + openssl-devel fontconfig-devel sqlite-devel libsoup3-devel mpv-devel && \ dnf clean all # System-wide, so the build can run as an ordinary user (build.sh gives it its diff --git a/linux/live/build.sh b/linux/live/build.sh @@ -9,24 +9,26 @@ # # linux/live/build.sh # -# The ISO lands in linux/out/iso/. PAYLOAD (default the development image, -# registry.example.com/sectorf-linux-dev:latest) is the image the ISO carries as the offline -# install payload (ADR-0010); the VM pulls it. TARGET_IMGREF is what installed machines follow -# (default the published sectorf-linux, as a real installer would; a test sets it to the payload). -# LIVE_DEBUG=1 lets root log in over SSH with the test rig's key. +# 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. +# 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 -ROOT=$(cd "$(dirname "$0")/.." && pwd) +source "$(dirname "$0")/../vm/common.sh" VM="$ROOT/vm/vm.sh" OUT="$ROOT/out/iso" -FEDORA=quay.io/fedora/fedora@sha256:f236063d5a7a15e76ff034f2be5fa6f7a8922fcb655093ad972a1f196b14a007 +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" -PAYLOAD=${PAYLOAD:-registry.example.com/sectorf-linux-dev:latest} -TARGET_IMGREF=${TARGET_IMGREF:-registry.example.com/sectorf-linux:latest} +PAYLOAD=${PAYLOAD:-$VM_IMAGE} +TARGET_IMGREF=${TARGET_IMGREF:-$VM_IMAGE} debug_key="" [[ -z "${LIVE_DEBUG:-}" ]] || debug_key=$(cat "$ROOT/out/id_ed25519.pub") docker build -q --target live -t sectorf-live-installer -f "$ROOT/Containerfile" \ @@ -50,8 +52,8 @@ if [[ -f "$pid" ]] && kill -0 "$(cat "$pid")" 2>/dev/null; then :; else "$VM" st 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 "pulling the payload $PAYLOAD into the VM" -"$VM" ssh "podman pull -q $PAYLOAD >/dev/null && df -h /var/builder | tail -1" +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" say "building the ISO (in the VM)" "$VM" ssh " diff --git a/linux/publish.sh b/linux/publish.sh @@ -1,40 +1,29 @@ #!/usr/bin/env bash -# Builds the real image, the Containerfile's `system` target and not the test VM's `dev` one (which -# has a login and trusts the development registry), and pushes it to the private registry on the registry host -# (the infrastructure repo), where machines follow it with `bootc switch`. +# Pushes the real image to GitHub's container registry, where machines follow it with +# `bootc switch` (or the updater app). It is the image `make build` made (SYSTEM_IMAGE, the +# Containerfile's `system` stage), the same one `make iso` carries, so what was tried is what ships; +# it is not rebuilt here. This is the only thing that pushes to a registry. # -# linux/publish.sh +# make build && make publish # -# PUBLISH_REPO is where it goes (default registry.example.com/sectorf-linux); it is reachable -# from the tailnet only. Two tags are pushed: latest, and a UTC timestamp to go back to. +# PUBLISH_REPO is where it goes (default ghcr.io/sector-f-labs/sector-f-linux). Logs in with the +# token of `gh` (scope write:packages). Two tags are pushed: latest, and a UTC timestamp to go back to. # # The push goes through skopeo, from Docker's own daemon, and not `docker push`: Docker pushes an # OCI manifest whose own layers carry Docker's media type, which bootc rejects on an upgrade -# ("Unhandled layer type"); skopeo writes every layer as OCI. See vm/build.sh, and ADR-0009. -set -euo pipefail +# ("Unhandled layer type"); skopeo writes every layer as OCI. See ADR-0009. +source "$(dirname "$0")/vm/common.sh" -ROOT=$(cd "$(dirname "$0")" && pwd) -REPO=${PUBLISH_REPO:-registry.example.com/sectorf-linux} STAMP=$(date -u +%Y%m%d-%H%M%S) -LOCAL="$REPO:build" +docker image inspect "$SYSTEM_IMAGE" >/dev/null 2>&1 || die "no $SYSTEM_IMAGE; make build first" -say() { printf '==> %s\n' "$*"; } +registry=${REPO%%/*} +user=$(gh api user --jq .login) +say "pushing $REPO:latest and $REPO:$STAMP, with OCI layers" +# The token goes in on stdin, not on a command line. +gh auth token | docker run --rm -i --network host -v /var/run/docker.sock:/var/run/docker.sock "$SYSTEM_IMAGE" \ + sh -euc 'skopeo login "$1" -u "$2" --password-stdin >/dev/null + skopeo copy --format oci "docker-daemon:$3" "docker://$4:latest" + skopeo copy "docker://$4:latest" "docker://$4:$5"' sh "$registry" "$user" "$SYSTEM_IMAGE" "$REPO" "$STAMP" >/dev/null -"$ROOT/desktop/build.sh" -"$ROOT/greeter-build.sh" - -say "building the system image" -docker build -f "$ROOT/Containerfile" --target system -t "$LOCAL" "$ROOT" - -# --network host so the name resolves as it does here (the tailnet's split DNS), and the real -# certificate is checked: nothing here is insecure. -say "pushing $REPO:latest, with OCI layers" -docker run --rm --network host -v /var/run/docker.sock:/var/run/docker.sock "$LOCAL" \ - skopeo copy --format oci "docker-daemon:$LOCAL" "docker://$REPO:latest" >/dev/null - -# The second tag is the same manifest: copied inside the registry, so nothing is uploaded again. -say "tagging $REPO:$STAMP" -docker run --rm --network host "$LOCAL" \ - skopeo copy "docker://$REPO:latest" "docker://$REPO:$STAMP" >/dev/null - -say "done: $REPO:latest and $REPO:$STAMP (machines on the tailnet: bootc switch $REPO:latest)" +say "done: $REPO:latest and $REPO:$STAMP (machines: bootc switch $REPO:latest)" diff --git a/linux/vm/README.md b/linux/vm/README.md @@ -2,13 +2,13 @@ Builds the Patina desktop and the Sector F Linux image (Fedora 45's bootc image on Btrfs, ADR-0009), installs it onto a disk file the way it would go onto a real disk, and boots it in QEMU, then -lets the VM upgrade from a local registry and roll back. Needs Docker, QEMU with KVM, and OVMF +lets the VM upgrade from the published image and roll back. Needs Docker, QEMU with KVM, and OVMF (`apt install qemu-system-x86 ovmf`); no root, no podman on the host. Paths here are relative to `linux/`. From the repository root, `make build`, `make disk`, `make run` and `make upgrade` call these. ``` -vm/build.sh build the desktop and the image (its dev stage), push it to registry.example.com +vm/build.sh build the desktop and the image on this machine (nothing is pushed; ../publish.sh pushes) vm/disk.sh install the image onto out/disk.raw (and make the SSH key and an empty second disk) vm/vm.sh start boot it in the background (serial console in out/serial.log) vm/vm.sh wait wait until SSH answers @@ -18,16 +18,16 @@ vm/vm.sh view its screen in a VNC viewer (localhost:5901) vm/vm.sh screenshot its screen, saved to out/screen.png vm/vm.sh log follow the serial console vm/vm.sh stop power it off -vm/clean.sh stop it and delete out/ (--all: the registry and the image too) +vm/clean.sh stop it and delete out/ (--all: the built images too) ``` The Patina greeter comes up on the screen; log in as **patina**, password **patina**, and the Patina session -starts (the dev image adds that user, in `wheel`; the real image has none). +starts (the VM's image adds that user, in `wheel`; the real image, and so the ISO, has none). Trying an update: ``` -vm/build.sh # a new build, pushed +make build && make publish # a new build, pushed vm/vm.sh ssh rpm-ostree upgrade # the VM fetches and stages it vm/vm.sh ssh systemctl reboot # boots into it vm/vm.sh ssh cat /usr/lib/patina-os/build # which build is running @@ -46,21 +46,22 @@ image underneath and keeps the layer. (pinned in `desktop/builder.Containerfile`). The tree lands in `build/desktop/` as it goes under `/`, 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 and - trust in the registry. vm/build.sh builds `dev`. -- **The registry** is the real one, `registry.example.com` on the registry host (the infrastructure repo), which only the tailnet reaches. The test image goes there as `sectorf-linux-dev`: - it has a login, so it never shares a name with the published `sectorf-linux` - (`../publish.sh`). The VM reaches it through this host's connection (QEMU's user network), with - the real certificate, so the test loop is the update path the real machines use. It needs the - tailnet and the registry host to be up; there is no local registry to fall back on. +- **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. +- **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. + Building, installing the VM and making the ISO need no registry. The package must be public for + machines to pull without a login. - **The push is OCI.** Docker pushes an OCI manifest whose own layers carry Docker's media type, which bootc rejects on an upgrade (`Unhandled layer type`), and skopeo won't convert that from a - registry. vm/build.sh pushes the image again from Docker's daemon with `skopeo copy --format oci`, + registry. publish.sh pushes the image from Docker's daemon with `skopeo copy --format oci`, which takes a few minutes. - **The install** runs the image itself, privileged, with the host's `/dev` for a loop device: its - own podman pulls it from the registry, and its own `bootc install to-disk` writes the disk, with + own podman loads it from a file saved from Docker, and its own `bootc install to-disk` writes the disk, with a Btrfs root, and puts `out/id_ed25519.pub` in root's `authorized_keys`. The installed system - follows `registry.example.com/sectorf-linux-dev:latest`. + follows the published `ghcr.io/sector-f-labs/sector-f-linux:latest`. - **The VM** has 4 CPUs, 4 GB, UEFI, the system disk, an empty 10 GB second disk (not used now that ZFS is gone), SSH on localhost:2222 with the key in `out/id_ed25519`, a virtio GPU shown over VNC (Mesa draws in software), a USB tablet and keyboard, and QEMU's monitor on `out/monitor.sock` diff --git a/linux/vm/build.sh b/linux/vm/build.sh @@ -1,28 +1,24 @@ #!/usr/bin/env bash -# Builds the Patina desktop (desktop/build.sh), then the image's dev stage from the Containerfile, -# and pushes it to the registry (registry.example.com, tailnet only), where the VM's -# `rpm-ostree upgrade` finds it. QUICK=1 skips the desktop and greeter builds, for changes to the -# image only (the Containerfile, linux/system, branding): `make build QUICK=1`. The dev stage has a login: it goes to sectorf-linux-dev, never to -# the published sectorf-linux (linux/publish.sh). +# 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 +# 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, +# linux/system, branding): `make build QUICK=1`. source "$(dirname "$0")/common.sh" if [[ -z "${QUICK:-}" ]]; then "$ROOT/desktop/build.sh" "$ROOT/greeter-build.sh" + "$ROOT/updater-build.sh" else - echo "==> QUICK: not rebuilding the desktop and the greeter (build/ as it is)" + echo "==> QUICK: not rebuilding the desktop, the greeter and the updater (build/ as it is)" fi build_id=$(date -u +%Y-%m-%dT%H:%M:%SZ) -say "building $IMAGE ($build_id)" +say "building $SYSTEM_IMAGE ($build_id)" +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" - -# Docker pushes an OCI manifest whose own layers carry Docker's media type -# (application/vnd.docker.image.rootfs.diff.tar.gzip), and bootc can't read those on an upgrade -# ("Unhandled layer type"). skopeo won't convert that mixed manifest from a registry, so it reads -# the image from Docker's own daemon, where it is a plain image, and pushes it as OCI (every layer -# recompressed and uploaded: a few minutes). skopeo is the image's own; --network host so the -# name resolves as it does here (the tailnet's split DNS), and the certificate is checked. -say "pushing $IMAGE with OCI layers" -docker run --rm --network host -v /var/run/docker.sock:/var/run/docker.sock "$IMAGE" \ - skopeo copy --format oci "docker-daemon:$IMAGE" "docker://$IMAGE" >/dev/null +say "done: $SYSTEM_IMAGE and $IMAGE, on this machine only. make iso, make run, make publish." diff --git a/linux/vm/clean.sh b/linux/vm/clean.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Removes what the VM scripts made: stops the VM and deletes out/ (disks, key, # logs, and podman's storage, whose files belong to root, so they're deleted -# from a container). With --all, also the built image (the registry's copy stays). +# from a container). With --all, also the built images (the registry's copy stays). source "$(dirname "$0")/common.sh" "$ROOT/vm/vm.sh" stop @@ -12,6 +12,6 @@ rm -rf "$OUT" say "removed out/" if [[ "${1:-}" == --all ]]; then - docker image rm "$IMAGE" >/dev/null 2>&1 || true - say "removed $IMAGE" + docker image rm "$IMAGE" "$SYSTEM_IMAGE" >/dev/null 2>&1 || true + say "removed $IMAGE and $SYSTEM_IMAGE" fi diff --git a/linux/vm/common.sh b/linux/vm/common.sh @@ -5,13 +5,15 @@ set -euo pipefail ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) OUT="$ROOT/out" -# The test image goes to the same registry as the real one (registry.example.com on the registry host, which -# only the tailnet reaches), in a repository of its own: it has a login, so it must never share a -# name with the published sectorf-linux. The VM reaches the registry through this host's -# connection (QEMU's user network), so the same name works on both sides. -DEV_REPO=${DEV_REPO:-registry.example.com/sectorf-linux-dev} -IMAGE="$DEV_REPO:latest" -VM_IMAGE="$IMAGE" +# Nothing here is pushed: `make build` makes two local images and only `make publish` (publish.sh) +# sends anything to the registry. SYSTEM_IMAGE is the real image, the one the ISO carries and +# publish.sh pushes. IMAGE is the same plus a test login (the Containerfile's `dev` stage), for the +# VM only; it never leaves this machine. VM_IMAGE is what the installed VM follows for updates: the +# published image, so `make upgrade` works once something is published. +REPO=${PUBLISH_REPO:-ghcr.io/sector-f-labs/sector-f-linux} +SYSTEM_IMAGE="$REPO:build" +IMAGE="$REPO-dev:build" +VM_IMAGE="$REPO:latest" DISK="$OUT/disk.raw" DISK_SIZE=20G diff --git a/linux/vm/disk.sh b/linux/vm/disk.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash # Installs the image onto a fresh disk file, out/disk.raw, the way it would go # onto a real disk: the image runs its own `bootc install to-disk` through a loop -# device, onto Btrfs (ADR-0009). The installed system follows the development -# registry, so `bootc upgrade` in the VM fetches what vm/build.sh pushed. Also -# makes the SSH key, which root's authorized_keys gets. +# device, onto Btrfs (ADR-0009). The image is the local one vm/build.sh made (with +# the test login); the installed system follows the published image, so `make upgrade` in the +# VM fetches what `make publish` pushed. Also makes the SSH key, which root's +# authorized_keys gets. source "$(dirname "$0")/common.sh" vm_running && die "the VM is running; vm/vm.sh stop first" @@ -16,16 +17,17 @@ rm -f "$DISK" "$OVMF_VARS" truncate -s "$DISK_SIZE" "$DISK" # Privileged with the host's /dev, for the loop device. bootc installs from # podman's storage, normally the host's; there's no podman on the host here, so -# the image's own podman pulls it from the registry into a storage folder of its -# own first. The target is the same image as the VM will see it. +# the image's own podman loads it, from a file saved here, into a storage folder of its +# own first. Nothing comes from the registry. mkdir -p "$OUT/containers" +docker save "$IMAGE" -o "$OUT/image.tar" docker run --rm --privileged --network host \ -v /dev:/dev -v "$OUT:/data" -v "$OUT/containers:/var/lib/containers" \ "$IMAGE" bash -euc ' # The console order: tty0 last, since Plymouth shows its splash on the last console and treats # a serial one as no screen. mkdir -p /var/tmp # /var in the image is empty until it boots - podman pull -q "$1" >/dev/null + podman load -q -i /data/image.tar >/dev/null bootc install to-disk \ --via-loopback /data/disk.raw \ --wipe \ @@ -36,6 +38,7 @@ docker run --rm --privileged --network host \ --karg console=ttyS0,115200 \ --karg console=tty0 ' install "$IMAGE" "$VM_IMAGE" +rm -f "$OUT/image.tar" [[ -f "$DATA" ]] || qemu-img create -q -f qcow2 "$DATA" "$DATA_SIZE" say "done: vm/vm.sh start"