the takeover's kexec installer image builds pkgsStatic from source ON the gateway — no substituter serves it, and the build has no ceiling #1016

Closed
opened 2026-08-30 04:55:14 +00:00 by matou-build-agent · 2 comments

Failure

drive-device 20260830T034644Z red at leg deploy-takeover (sig 800a2936720b), 26/27 legs green, at drive commit 6d2170ac (#1014, the commit that first put the production kexec-installer builder on the live takeover path).

deploy did not reach active within 2700s — deploy bar: state=running current=takeover percent=null

The takeover never began. The gateway spent the entire deploy budget compiling CPython.

Evidence

The gateway was still building the installer tarball when the budget expired — logs/gateway-stall.txt:12:

5849  3222  Sl  1221072  46:23  nix build .#installer.config.system.build.kexecInstallerTarball --no-write-lock-file --no-link --print-out-paths

46m23s of CPU and not done. What it was building — logs/gateway-stall.txt:13-16: two lto1 processes at 31:18 CPU each, LTO-linking python and Programs/_testembed against /nix/store/…-musl-static-x86_64-unknown-linux-musl-1.2.5, output rpath /nix/store/w13pspi3q841b3ir3gm5h2slk99csci4-python3-static-x86_64-unknown-linux-musl-3.13.15. The builder is make -j2 (gateway-stall.txt:20) on a 2 vCPU box, and memory is pegged: 3843 / 3921 MB used, 77 MB available (gateway-stall.txt:5).

Nothing on the device ran. logs/device-units.txt — ss -tlnp shows only sshd + netbird, systemctl --failed empty, no NixOS units. logs/device-stall.txt — processes are /usr/bin/netbird and /usr/sbin/sshd (stock Ubuntu paths), and the dmesg tail's last entry is the WireGuard module load at 04:02:24 — the mesh join, nothing after. logs/device-do-forensics.txt records one DO action on droplet 596267533, create. The box was never erased, which is correct — the build fails before the kexec, per the ADR 0100 ordering in internal/clan/enrollment.go:810-822.

Why it builds from source. internal/clan/installer_image.go:126 realises .#installer.config.system.build.kexecInstallerTarball against nixos-images' own nixos-stable (26.05), composed in a throwaway flake (installer_image.go:88-106). That closure pulls pkgsStatic derivations. The gateway has no substituter that serves them: nix/gateway-image/configuration.nix:109 sets nix.settings.experimental-features and nothing else — a repo-wide grep for substituters / trusted-public-keys finds no setting on any fleet image. So the gateway realises the static musl toolchain, static openssl/sqlite/ncurses/readline/gdbm/expat and static CPython itself, on the smallest box in the fleet, and it does so every drive (each drive is a fresh droplet with a cold store).

flake.nix:274-281's packages.kexec-installer-base was added as the warm-cache target for exactly this closure, but a CI/dev store is not the gateway's store — nothing carries those paths to the box that needs them.

Separable second defect: the build is unbounded. internal/clan/enrollment.go:890 calls e.a.installerImage.Build(ctx, s.Node, module) with the bare enrollment context, and internal/clan/installer_image.go:145-156 passes that straight to cli.Run with no deadline. Every other install invocation goes through runInstallWatched (enrollment.go:824) under defaultPhaseTimeout = 20 min (enrollment.go:68). So the image build is the one step in the takeover with no ceiling and no progress: it ran past 46 minutes, would have kept going, and the deploy bar reported percent=null the whole time. That is the opposite of the fail-loud the builder's own doc comment promises (installer_image.go:44-48). Even once the build cost is solved, this hole stays open — any slow or wedged realisation eats a paid drive silently instead of reding in minutes.

Suspected layer

Build placement / fleet nix configuration, plus a missing bound in the enrollment phase loop. Not the takeover logic itself: #1012's module render and #1014's builder wiring both did what they say — the eval-smoke that proved them (TestInstallerImage_EvalSmoke, 27.6s) ran on a warm dev store with the closure already realised, which is exactly the condition the gateway does not have. This is the fault the STATUS.md 'Acceptance #1 rides the live paid drive' note was waiting to learn.

What plugging it needs

This needs a human ruling on the fork before a worker builds. Two directions, with different trust consequences:

  1. Give the gateway a substituter that serves the closure — e.g. nix-community.cachix.org + its public key in nix/gateway-image/configuration.nix, re-baked into the golden DO snapshot (scripts/gateway-image/build.sh). Cheapest change, but it makes a community gateway trust a third-party binary cache at deploy time. On a sovereignty stack that wants an ADR, not a patch.
  2. Carry the closure, don't build it — the ADR 0133 warm-payload precedent (docs/adr/0133-app-payload-carries-the-gateway-closure.md). Note the tarball itself cannot be fully prebuilt: renderInstallerMesh bakes a per-takeover single-use setup key (ADR 0209 amendment), so only the static base closure (what packages.kexec-installer-base already names, flake.nix:279-281) can be pre-warmed and shipped; the final compose still runs on the gateway, but against a warm store it is cheap.

A third option worth pricing: build the tarball on the operator's machine (which already has a warm store from the founding build) and nix copy it to the gateway, or pass it to clan machines install --kexec from there.

Whichever wins, also bound the build independently — give prepareInstallerImage its own ceiling (a context.WithTimeout around the Build call at enrollment.go:890, or route it through the same watched path as the phases) so a slow realisation reds LOUD in minutes with an honest 'the installer image is still building' message, rather than burning a paid drive behind percent=null. That half is small and testable offline; it should not wait on the ruling.

Drive artifacts: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260830T034644Z.

drive 20260830T034644Z red at deploy-takeover: deploy did not reach active within 2700s — deploy bar: state=running current=takeover percent=null; wire /api/v1/fleet: {"gateway":{"id":"gateway","name":"gateway","role":"control plane · public en
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260830T034644Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure `drive-device 20260830T034644Z` red at leg `deploy-takeover` (sig `800a2936720b`), 26/27 legs green, at drive commit `6d2170ac` (#1014, the commit that first put the production kexec-installer builder on the live takeover path). > deploy did not reach active within 2700s — deploy bar: state=running current=takeover percent=null The takeover never began. The gateway spent the entire deploy budget compiling CPython. ## Evidence **The gateway was still building the installer tarball when the budget expired** — `logs/gateway-stall.txt:12`: ``` 5849 3222 Sl 1221072 46:23 nix build .#installer.config.system.build.kexecInstallerTarball --no-write-lock-file --no-link --print-out-paths ``` 46m23s of CPU and not done. What it was building — `logs/gateway-stall.txt:13-16`: two `lto1` processes at `31:18` CPU each, LTO-linking `python` and `Programs/_testembed` against `/nix/store/…-musl-static-x86_64-unknown-linux-musl-1.2.5`, output rpath `/nix/store/w13pspi3q841b3ir3gm5h2slk99csci4-python3-static-x86_64-unknown-linux-musl-3.13.15`. The builder is `make -j2` (`gateway-stall.txt:20`) on a 2 vCPU box, and memory is pegged: `3843 / 3921 MB` used, `77 MB` available (`gateway-stall.txt:5`). **Nothing on the device ran.** `logs/device-units.txt` — `ss -tlnp` shows only sshd + netbird, `systemctl --failed` empty, no NixOS units. `logs/device-stall.txt` — processes are `/usr/bin/netbird` and `/usr/sbin/sshd` (stock Ubuntu paths), and the dmesg tail's last entry is the WireGuard module load at `04:02:24` — the mesh join, nothing after. `logs/device-do-forensics.txt` records one DO action on droplet 596267533, `create`. The box was never erased, which is correct — the build fails before the kexec, per the ADR 0100 ordering in `internal/clan/enrollment.go:810-822`. **Why it builds from source.** `internal/clan/installer_image.go:126` realises `.#installer.config.system.build.kexecInstallerTarball` against nixos-images' own nixos-stable (26.05), composed in a throwaway flake (`installer_image.go:88-106`). That closure pulls `pkgsStatic` derivations. The gateway has no substituter that serves them: `nix/gateway-image/configuration.nix:109` sets `nix.settings.experimental-features` and nothing else — a repo-wide grep for `substituters` / `trusted-public-keys` finds no setting on any fleet image. So the gateway realises the static musl toolchain, static openssl/sqlite/ncurses/readline/gdbm/expat and static CPython itself, on the smallest box in the fleet, and it does so **every drive** (each drive is a fresh droplet with a cold store). `flake.nix:274-281`'s `packages.kexec-installer-base` was added as the warm-cache target for exactly this closure, but a CI/dev store is not the gateway's store — nothing carries those paths to the box that needs them. **Separable second defect: the build is unbounded.** `internal/clan/enrollment.go:890` calls `e.a.installerImage.Build(ctx, s.Node, module)` with the bare enrollment context, and `internal/clan/installer_image.go:145-156` passes that straight to `cli.Run` with no deadline. Every other install invocation goes through `runInstallWatched` (`enrollment.go:824`) under `defaultPhaseTimeout` = 20 min (`enrollment.go:68`). So the image build is the one step in the takeover with no ceiling and no progress: it ran past 46 minutes, would have kept going, and the deploy bar reported `percent=null` the whole time. That is the opposite of the fail-loud the builder's own doc comment promises (`installer_image.go:44-48`). Even once the build cost is solved, this hole stays open — any slow or wedged realisation eats a paid drive silently instead of reding in minutes. ## Suspected layer Build placement / fleet nix configuration, plus a missing bound in the enrollment phase loop. Not the takeover logic itself: #1012's module render and #1014's builder wiring both did what they say — the eval-smoke that proved them (`TestInstallerImage_EvalSmoke`, 27.6s) ran on a warm dev store with the closure already realised, which is exactly the condition the gateway does not have. This is the fault the STATUS.md 'Acceptance #1 rides the live paid drive' note was waiting to learn. ## What plugging it needs **This needs a human ruling on the fork before a worker builds.** Two directions, with different trust consequences: 1. **Give the gateway a substituter that serves the closure** — e.g. `nix-community.cachix.org` + its public key in `nix/gateway-image/configuration.nix`, re-baked into the golden DO snapshot (`scripts/gateway-image/build.sh`). Cheapest change, but it makes a community gateway trust a third-party binary cache at deploy time. On a sovereignty stack that wants an ADR, not a patch. 2. **Carry the closure, don't build it** — the ADR 0133 warm-payload precedent (`docs/adr/0133-app-payload-carries-the-gateway-closure.md`). Note the tarball itself cannot be fully prebuilt: `renderInstallerMesh` bakes a per-takeover single-use setup key (ADR 0209 amendment), so only the *static base* closure (what `packages.kexec-installer-base` already names, `flake.nix:279-281`) can be pre-warmed and shipped; the final compose still runs on the gateway, but against a warm store it is cheap. A third option worth pricing: build the tarball on the operator's machine (which already has a warm store from the founding build) and `nix copy` it to the gateway, or pass it to `clan machines install --kexec` from there. Whichever wins, **also bound the build independently** — give `prepareInstallerImage` its own ceiling (a `context.WithTimeout` around the `Build` call at `enrollment.go:890`, or route it through the same watched path as the phases) so a slow realisation reds LOUD in minutes with an honest 'the installer image is still building' message, rather than burning a paid drive behind `percent=null`. That half is small and testable offline; it should not wait on the ruling. Drive artifacts: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260830T034644Z`. drive `20260830T034644Z` red at `deploy-takeover`: `deploy did not reach active within 2700s — deploy bar: state=running current=takeover percent=null; wire /api/v1/fleet: {"gateway":{"id":"gateway","name":"gateway","role":"control plane · public en` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260830T034644Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 800a2936720b -->
Author
Member

Ruled by agent under ADR 0174 — veto anytime.

This ticket carries two separable defects of different door-class. I landed the two-way half and am routing the one-way half to a human, per ADR 0174 §3 (a security-posture widening / sovereignty-stack trust decision stops on the human).

Landed — the unbounded build is now bounded (two-way door)

internal/clan/enrollment.go:prepareInstallerImage passed the bare enrollment context straight to Build → cli.Run with no deadline — the one takeover step outside the phase loop's defaultPhaseTimeout ceiling. So the wedged realisation on drive 20260830T034644Z ran past 46 min behind a percent=null bar and burned the whole 2700s deploy budget silently.

Fix (commit d4dd04a1):

  • new installerImageBuildTimeout (20 min) — its own constant, kept separate from phaseTimeout (which VMMode lifts to 45 min) so the build ceiling can be tuned without touching the remote install phases;
  • adapter field installerBuildTimeout (white-box test-settable like phaseTimeout), defaulted in New;
  • prepareInstallerImage wraps the Build call in context.WithTimeout, and a build that outruns the ceiling reds the kexec phase TERMINAL and LOUD before anything is erased (ADR 0100) with an honest "the installer image is STILL BUILDING after 20m0s — warm the store or carry the closure" reason, distinguishing a ceiling-fired buildCtx.Err()==DeadlineExceeded && ctx.Err()==nil from a genuine session severance.

Proof (offline, revertible): red-first TestEnroll_TakeoverKexecBuildBoundedRedsLoudNotSilent — a blockingInstallerBuilder wedges past a 40 ms seam ceiling → status Failed, reason contains "still building", no machines install ran (nothing erased). Red in ~5 s pre-fix (generic wedged-build message, no ceiling), green in 40 ms after. go build ./... / go test ./internal/clan ./control-plane/... / vet / gofmt green.

This does not green the drive: it converts a silent ~45-min burn into a LOUD ~20-min red until the placement fork below is ruled.

Why human — the build-PLACEMENT fork is a one-way door

The gateway realises the kexec tarball's pkgsStatic closure (static musl toolchain + openssl/sqlite/ncurses/readline/CPython) from source because no substituter on any fleet image serves those paths (nix/gateway-image/configuration.nix sets no substituters/trusted-public-keys). WHERE the closure comes from is a sovereignty-stack trust decision, not a patch:

  1. Give the gateway a third-party binary cache (nix-community.cachix.org + its public key) — cheapest, but makes a community gateway trust a third-party cache at deploy time. This is exactly the ADR 0174 §3 one-way door (a security-posture widening); wants an ADR.
  2. Carry the closure, don't build it — the ADR 0133 warm-payload precedent. Only the static base (packages.kexec-installer-base, flake.nix:279-281) can be pre-warmed and shipped; the final compose still bakes the per-takeover single-use setup key on the gateway (ADR 0209 amendment), but against a warm store it is cheap.
  3. Build on the operator's warm-store machine and nix copy the tarball to the gateway (or pass it to clan machines install --kexec from there).

Proposed default ruling (adopt if not vetoed): option 2 — carry/pre-warm the kexec-installer-base static closure per the ADR 0133 precedent, so no new third-party trust root enters a community gateway and the gateway-side compose stays cheap. Options 1 and 3 remain on the table for Ben.

Relabelled ready-for-session → ready-for-human for that ruling; the bound half is landed and pushed.

**Ruled by agent under ADR 0174 — veto anytime.** This ticket carries two separable defects of different door-class. I landed the two-way half and am routing the one-way half to a human, per ADR 0174 §3 (a security-posture widening / sovereignty-stack trust decision stops on the human). ## Landed — the unbounded build is now bounded (two-way door) `internal/clan/enrollment.go:prepareInstallerImage` passed the bare enrollment context straight to `Build` → `cli.Run` with **no deadline** — the one takeover step outside the phase loop's `defaultPhaseTimeout` ceiling. So the wedged realisation on drive `20260830T034644Z` ran past 46 min behind a `percent=null` bar and burned the whole 2700s deploy budget silently. Fix (commit `d4dd04a1`): - new `installerImageBuildTimeout` (20 min) — its **own** constant, kept separate from `phaseTimeout` (which VMMode lifts to 45 min) so the build ceiling can be tuned without touching the remote install phases; - adapter field `installerBuildTimeout` (white-box test-settable like `phaseTimeout`), defaulted in `New`; - `prepareInstallerImage` wraps the `Build` call in `context.WithTimeout`, and a build that outruns the ceiling reds the kexec phase **TERMINAL and LOUD before anything is erased** (ADR 0100) with an honest *"the installer image is STILL BUILDING after 20m0s — warm the store or carry the closure"* reason, distinguishing a ceiling-fired `buildCtx.Err()==DeadlineExceeded && ctx.Err()==nil` from a genuine session severance. **Proof (offline, revertible):** red-first `TestEnroll_TakeoverKexecBuildBoundedRedsLoudNotSilent` — a `blockingInstallerBuilder` wedges past a 40 ms seam ceiling → status `Failed`, reason contains "still building", **no `machines install` ran** (nothing erased). Red in ~5 s pre-fix (generic wedged-build message, no ceiling), green in 40 ms after. `go build ./...` / `go test ./internal/clan ./control-plane/...` / vet / gofmt green. This does **not** green the drive: it converts a silent ~45-min burn into a LOUD ~20-min red until the placement fork below is ruled. ## Why human — the build-PLACEMENT fork is a one-way door The gateway realises the kexec tarball's `pkgsStatic` closure (static musl toolchain + openssl/sqlite/ncurses/readline/CPython) from source because **no substituter on any fleet image serves those paths** (`nix/gateway-image/configuration.nix` sets no `substituters`/`trusted-public-keys`). WHERE the closure comes from is a sovereignty-stack trust decision, not a patch: 1. **Give the gateway a third-party binary cache** (`nix-community.cachix.org` + its public key) — cheapest, but makes a community gateway trust a third-party cache at deploy time. This is exactly the ADR 0174 §3 one-way door (a security-posture widening); wants an ADR. 2. **Carry the closure, don't build it** — the ADR 0133 warm-payload precedent. Only the *static base* (`packages.kexec-installer-base`, `flake.nix:279-281`) can be pre-warmed and shipped; the final compose still bakes the per-takeover single-use setup key on the gateway (ADR 0209 amendment), but against a warm store it is cheap. 3. **Build on the operator's warm-store machine** and `nix copy` the tarball to the gateway (or pass it to `clan machines install --kexec` from there). **Proposed default ruling (adopt if not vetoed):** option 2 — carry/pre-warm the `kexec-installer-base` static closure per the ADR 0133 precedent, so no new third-party trust root enters a community gateway and the gateway-side compose stays cheap. Options 1 and 3 remain on the table for Ben. Relabelled `ready-for-session` → `ready-for-human` for that ruling; the bound half is landed and pushed.
Owner

RULED by Ben (2026-08-31): carry the closure — ADR 0133 amended with Tier 3 (b5552e40): the payload ships packages.kexec-installer-base and the founding seeds it into the gateway's store via the Tier-1 file:// cache mechanism; the per-takeover compose stays on-box against the warm store. Third-party substituter rejected (deploy-time trust anchor); operator-machine build rejected (couples a gateway-driven takeover to the founding laptop). The two-way half (build ceiling + honest progress) already landed as d4dd04a1 and stays as the backstop.

Build slice armed: #1036 (blocks #854). Closing this ticket in its favour.

**RULED by Ben (2026-08-31): carry the closure** — ADR 0133 amended with **Tier 3** (`b5552e40`): the payload ships `packages.kexec-installer-base` and the founding seeds it into the **gateway's** store via the Tier-1 `file://` cache mechanism; the per-takeover compose stays on-box against the warm store. Third-party substituter rejected (deploy-time trust anchor); operator-machine build rejected (couples a gateway-driven takeover to the founding laptop). The two-way half (build ceiling + honest progress) already landed as `d4dd04a1` and stays as the backstop. Build slice armed: #1036 (blocks #854). Closing this ticket in its favour.
ben closed this issue 2026-08-30 14:53:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1016
No description provided.