finish-leg ledger scp still hits "No such file or directory" on /var/lib/ourcloud after #441's tmpfiles fix landed (sig 404124947736 recurs a 3rd time) #442

Closed
opened 2026-08-11 20:05:46 +00:00 by ben · 2 comments
Owner

Failure

Drive 20260811T195131Z (own-VPS, target droplet) went red at the supply/finish leg, identical to two prior reds carrying the same signature 404124947736:

founding: hand over authority: founding: hand the ledger into the fleet: fleetwire: land the ledger on the gateway: fleetwire: scp: exit status 1 — scp: dest open "/var/lib/ourcloud/enroll.json": No such file or directory

Evidence: test-results/drive-droplet/20260811T195131Z/artifacts/legs.json (all legs green through enroll-activate, supply red with this exact text), same string in .../artifacts/journey.droplet-.../error-context.md.

Why this is surprising

This is the THIRD time signature 404124947736 has gone red, and the SECOND supposed fix for it:

  1. Healer commit 99393f9 (sig 404124947736, first heal) — added DDR 0162's finish row to the droplet e2e's own-VPS order. Did not touch the actual dir-creation defect.
  2. Ticket commit d765cf6 (#441, landed 2026-08-11 19:29:13) — the durable, targeted fix: renderGatewayGuest (internal/clan/vmguest.go:262) now declares systemd.tmpfiles.rules = [ "d /var/lib/ourcloud 0700 root root -" ] at boot, plus StateDirectoryMode = "0700" on the control-plane unit, specifically because the ledger scp precedes the unit's first start (which is what used to create the dir via StateDirectory). Pinned by TestRenderGatewayGuest_LedgerDirExistsAtBoot (internal/clan/vmguest_test.go) — I re-ran this test on current HEAD (591374b) and it still passes, so the source fix is genuinely present in the checkout.
  3. This drive (20260811T195131Z, started ~22 minutes after #441 landed) hit the byte-identical scp failure anyway.

What I ruled out

  • Stale binary: unlikely — scripts/smoke-private-path.sh runs pnpm --filter app build:electron and pnpm --filter app build:helper (not :dev) fresh on every drive (lines ~325-326), and app/helper/cmd/helper is what imports internal/clan and calls renderGatewayGuest. The script's own oc_payload_fresh staleness gate only guards the control-plane/dashboard payload components (built separately, ridden into the warm image) — that gate is irrelevant here since the render comes from the freshly-built helper, not the payload.
  • Go-side caching in the accelerator legs: ruled out. enrollment.go's build() (line 652) and copy() (line 711) are explicitly best-effort accelerators — every failure there just falls through to the authoritative verify() step (enrollment.go:788, clan machines update <node> --flake ... --target-host ...), which rebuilds/deploys the CURRENT flake content unconditionally every run. No hash/memoization exists in the Go code (store_count.go's plannedPathCount/missingOnTarget shell out to nix live every call). The suspiciously fast enroll-build/enroll-copy timings in legs.json (8ms/9ms) are a harness polling artifact, not evidence of a skip — app/tests/e2e/fixtures/journey.ts's legVerdict/waitForLeg (lines 76-137) mark a leg done as soon as currentId has already moved past it, so a leg can read near-zero ms if the poll simply never landed while it was current.

Suspected layer

Since enroll-activate (the clan machines update call, enrollment.go:788) reported green BEFORE supply ran, the gateway's NixOS system should already be on the generation carrying #441's tmpfiles rule by the time fleetwire's scp lands (internal/fleetwire/fleet.go:113 SeedLedger, called from internal/founding/seed.go:307). Yet the directory still doesn't exist. That points at NixOS/clan activation semantics I can't verify without a live box: whether clan machines update's remote activation performs a genuine switch (which should run systemd-tmpfiles --create for a brand-new /etc/tmpfiles.d entry immediately) versus something closer to boot (which would defer the new generation, including the tmpfiles rule, to the next reboot — and this journey never reboots the gateway again after enroll-activate). I cannot rule this in or out without droplet access.

Evidence gap (separate, smaller defect worth fixing regardless)

test-results/drive-droplet/20260811T195131Z/logs/droplet-journal.txt shows the post-drive evidence gather ALSO failed: Host key verification failed for 134.199.156.13, Offending ED25519 key in /home/dev/.ssh/known_hosts:93. oc_droplet_evidence (scripts/lib/rehearsal-droplet.sh:81-89) runs a plain ssh (default strict checking against the operator's real ~/.ssh/known_hosts), unlike oc_droplet_create's connectivity wait (lines 66, 74) which explicitly scrubs the entry (ssh-keygen -R) and uses -o StrictHostKeyChecking=accept-new before connecting. Since DO recycles droplet IPs across runs, evidence gather can collide with a stale key from an unrelated prior droplet at the same address and silently lose the journalctl/ls -laR /var/lib/ourcloud capture — exactly the evidence that would prove or disprove whether #441's fix actually took effect on THIS box. Fixing oc_droplet_evidence to match oc_droplet_create's host-key handling (scrub + accept-new) won't fix the red leg, but it's a one-line, low-risk fix that would let the NEXT red drive's evidence answer this question directly.

What plugging the real defect needs

A droplet-side inspection a healer can't do blind: run the next drive with REHEARSAL_KEEP_RED_DROPLET=1, and on red SSH into the kept box (scrub ~/.ssh/known_hosts first) to check ls -la /etc/tmpfiles.d/ + the generated ourcloud entry's content, systemd-tmpfiles --create --dry-run, journalctl -u systemd-tmpfiles-setup, and readlink -f /run/current-system against the toplevel clan machines update reported building. That will show whether the new generation with the tmpfiles rule is actually live, and if it is, why the directory still isn't there.

Why I'm filing instead of self-fixing

#441 was small, certain-looking, and unit-tested — and it still didn't hold on a real droplet. I can't name a different exact defective line with the same confidence, and I have no droplet access here to verify any change against the real failure mode. Per the resisted-heal guidance, a third guess risks burning another paid droplet on the same wrong theory.

drive 20260811T195131Z red at supply: journey leg "finish" went red: founding: hand over authority: founding: hand the ledger into the fleet: fleetwire: land the ledger on the gateway: fleetwire: scp: exit status N — scp: dest open "/va scp: failed to upload file /home/dev/swarm/Matou/ourcloud/test-results/drive-droplet/HTNZ/state/scratch/enroll.json to /var/lib/ourcloud/enroll.json
evidence: test-results/…/20260811T195131Z/ on matou-workstation (legs.json, droplet-journal.txt, trace)

## Failure Drive `20260811T195131Z` (own-VPS, target droplet) went red at the `supply`/`finish` leg, identical to two prior reds carrying the same signature `404124947736`: ``` founding: hand over authority: founding: hand the ledger into the fleet: fleetwire: land the ledger on the gateway: fleetwire: scp: exit status 1 — scp: dest open "/var/lib/ourcloud/enroll.json": No such file or directory ``` Evidence: `test-results/drive-droplet/20260811T195131Z/artifacts/legs.json` (all legs green through `enroll-activate`, `supply` red with this exact text), same string in `.../artifacts/journey.droplet-.../error-context.md`. ## Why this is surprising This is the THIRD time signature `404124947736` has gone red, and the SECOND supposed fix for it: 1. Healer commit `99393f9` (sig `404124947736`, first heal) — added DDR 0162's finish row to the droplet e2e's own-VPS order. Did not touch the actual dir-creation defect. 2. Ticket commit `d765cf6` (#441, landed 2026-08-11 19:29:13) — the durable, targeted fix: `renderGatewayGuest` (`internal/clan/vmguest.go:262`) now declares `systemd.tmpfiles.rules = [ "d /var/lib/ourcloud 0700 root root -" ]` at boot, plus `StateDirectoryMode = "0700"` on the control-plane unit, specifically because the ledger scp precedes the unit's first start (which is what used to create the dir via `StateDirectory`). Pinned by `TestRenderGatewayGuest_LedgerDirExistsAtBoot` (`internal/clan/vmguest_test.go`) — **I re-ran this test on current HEAD (591374b) and it still passes**, so the source fix is genuinely present in the checkout. 3. This drive (`20260811T195131Z`, started ~22 minutes after #441 landed) hit the byte-identical scp failure anyway. ## What I ruled out - **Stale binary**: unlikely — `scripts/smoke-private-path.sh` runs `pnpm --filter app build:electron` and `pnpm --filter app build:helper` (not `:dev`) fresh on every drive (lines ~325-326), and `app/helper/cmd/helper` is what imports `internal/clan` and calls `renderGatewayGuest`. The script's own `oc_payload_fresh` staleness gate only guards the *control-plane*/*dashboard* payload components (built separately, ridden into the warm image) — that gate is irrelevant here since the render comes from the freshly-built helper, not the payload. - **Go-side caching in the accelerator legs**: ruled out. `enrollment.go`'s `build()` (line 652) and `copy()` (line 711) are explicitly best-effort accelerators — every failure there just falls through to the authoritative `verify()` step (`enrollment.go:788`, `clan machines update <node> --flake ... --target-host ...`), which rebuilds/deploys the CURRENT flake content unconditionally every run. No hash/memoization exists in the Go code (`store_count.go`'s `plannedPathCount`/`missingOnTarget` shell out to `nix` live every call). The suspiciously fast `enroll-build`/`enroll-copy` timings in `legs.json` (8ms/9ms) are a harness polling artifact, not evidence of a skip — `app/tests/e2e/fixtures/journey.ts`'s `legVerdict`/`waitForLeg` (lines 76-137) mark a leg done as soon as `currentId` has already moved past it, so a leg can read near-zero ms if the poll simply never landed while it was current. ## Suspected layer Since `enroll-activate` (the `clan machines update` call, `enrollment.go:788`) reported green BEFORE `supply` ran, the gateway's NixOS system should already be on the generation carrying #441's tmpfiles rule by the time fleetwire's scp lands (`internal/fleetwire/fleet.go:113` `SeedLedger`, called from `internal/founding/seed.go:307`). Yet the directory still doesn't exist. That points at NixOS/clan activation semantics I can't verify without a live box: whether `clan machines update`'s remote activation performs a genuine `switch` (which should run `systemd-tmpfiles --create` for a brand-new `/etc/tmpfiles.d` entry immediately) versus something closer to `boot` (which would defer the new generation, including the tmpfiles rule, to the next reboot — and this journey never reboots the gateway again after enroll-activate). I cannot rule this in or out without droplet access. ## Evidence gap (separate, smaller defect worth fixing regardless) `test-results/drive-droplet/20260811T195131Z/logs/droplet-journal.txt` shows the post-drive evidence gather ALSO failed: `Host key verification failed` for `134.199.156.13`, `Offending ED25519 key in /home/dev/.ssh/known_hosts:93`. `oc_droplet_evidence` (`scripts/lib/rehearsal-droplet.sh:81-89`) runs a plain `ssh` (default strict checking against the operator's real `~/.ssh/known_hosts`), unlike `oc_droplet_create`'s connectivity wait (lines 66, 74) which explicitly scrubs the entry (`ssh-keygen -R`) and uses `-o StrictHostKeyChecking=accept-new` before connecting. Since DO recycles droplet IPs across runs, evidence gather can collide with a stale key from an unrelated prior droplet at the same address and silently lose the `journalctl`/`ls -laR /var/lib/ourcloud` capture — exactly the evidence that would prove or disprove whether #441's fix actually took effect on THIS box. Fixing `oc_droplet_evidence` to match `oc_droplet_create`'s host-key handling (scrub + accept-new) won't fix the red leg, but it's a one-line, low-risk fix that would let the NEXT red drive's evidence answer this question directly. ## What plugging the real defect needs A droplet-side inspection a healer can't do blind: run the next drive with `REHEARSAL_KEEP_RED_DROPLET=1`, and on red SSH into the kept box (scrub `~/.ssh/known_hosts` first) to check `ls -la /etc/tmpfiles.d/` + the generated ourcloud entry's content, `systemd-tmpfiles --create --dry-run`, `journalctl -u systemd-tmpfiles-setup`, and `readlink -f /run/current-system` against the toplevel `clan machines update` reported building. That will show whether the new generation with the tmpfiles rule is actually live, and if it is, why the directory still isn't there. ## Why I'm filing instead of self-fixing #441 was small, certain-looking, and unit-tested — and it still didn't hold on a real droplet. I can't name a different exact defective line with the same confidence, and I have no droplet access here to verify any change against the real failure mode. Per the resisted-heal guidance, a third guess risks burning another paid droplet on the same wrong theory. drive `20260811T195131Z` red at `supply`: `journey leg "finish" went red: founding: hand over authority: founding: hand the ledger into the fleet: fleetwire: land the ledger on the gateway: fleetwire: scp: exit status N — scp: dest open "/va scp: failed to upload file /home/dev/swarm/Matou/ourcloud/test-results/drive-droplet/HTNZ/state/scratch/enroll.json to /var/lib/ourcloud/enroll.json` evidence: `test-results/…/20260811T195131Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) <!-- rehearsal-sig: 404124947736 -->
Author
Owner

Root cause found (manual trace of run 195131Z's captured flake) — #441's fix landed in the WRONG render for the own-VPS path, the same VM-vs-FullInstall divergence that bit #399 (hostPlatform), #410 (identity), #432 (trust key), #436 (loopback target):

  • d765cf6 added the systemd.tmpfiles.rules d /var/lib/ourcloud 0700 root root - to renderGatewayGuest (internal/clan/vmguest.go), whose output is gateway-guest.nix (GatewayGuestFileName), written only at enrollment.go:403 for the VM-mode gateway.
  • The own-VPS FullInstall path does NOT emit gateway-guest.nix. Proof: run 195131Z's captured state/clan-config/machines/gateway/ contains configuration.nix, disko.nix, networking.nix, front-door.nix, acme-dns.nix, access.nix, platform.nix — no gateway-guest.nix. So the tmpfiles rule never reaches the droplet, and /var/lib/ourcloud is still absent when the finish-leg scp lands the ledger → scp: dest open "/var/lib/ourcloud/enroll.json": No such file or directory (3rd recurrence, sig 404124947736).

Fix — put the rule where the own-VPS gateway carries it

The ledger's home must be declared in a render the FullInstall path emits. Options, cleanest first:

  1. Move (or also emit) the d /var/lib/ourcloud 0700 root root - tmpfiles rule into the entry configuration.nix render (renderVMGuestBaseline, vmguest.go) — BOTH paths write it (enrollment.go:405 and the own-VPS assembly), so the ledger dir exists on VM and droplet alike. This also lets #441's now-VM-only seam test cover both.
  2. Or a dedicated always-imported ledger.nix module in the gateway machine dir, added to AttachGateway's import list (gateway_attach.go) so every gateway — VM or FullInstall — carries it.

Keep #441's StateDirectoryMode = "0700" pin on the control-plane unit (that part is correct and path-agnostic). Extend the seam test to assert the rule appears in the OWN-VPS gateway assembly, not just gateway-guest.nix — that assertion is what would have caught this.

This remains the genuine last tooth: #440's honesty guard is proven (this run red-ed correctly at finish instead of a false green), so once the dir truly lands, the next drive completes the founding. Blocks #378.

Root cause found (manual trace of run 195131Z's captured flake) — #441's fix landed in the WRONG render for the own-VPS path, the same VM-vs-FullInstall divergence that bit #399 (hostPlatform), #410 (identity), #432 (trust key), #436 (loopback target): - `d765cf6` added the `systemd.tmpfiles.rules` `d /var/lib/ourcloud 0700 root root -` to **`renderGatewayGuest`** (internal/clan/vmguest.go), whose output is **`gateway-guest.nix`** (`GatewayGuestFileName`), written only at `enrollment.go:403` for the **VM-mode** gateway. - The own-VPS **FullInstall** path does NOT emit gateway-guest.nix. Proof: run 195131Z's captured `state/clan-config/machines/gateway/` contains `configuration.nix, disko.nix, networking.nix, front-door.nix, acme-dns.nix, access.nix, platform.nix` — **no gateway-guest.nix**. So the tmpfiles rule never reaches the droplet, and `/var/lib/ourcloud` is still absent when the finish-leg scp lands the ledger → `scp: dest open "/var/lib/ourcloud/enroll.json": No such file or directory` (3rd recurrence, sig 404124947736). ## Fix — put the rule where the own-VPS gateway carries it The ledger's home must be declared in a render the FullInstall path emits. Options, cleanest first: 1. Move (or also emit) the `d /var/lib/ourcloud 0700 root root -` tmpfiles rule into the entry `configuration.nix` render (**`renderVMGuestBaseline`**, vmguest.go) — BOTH paths write it (`enrollment.go:405` and the own-VPS assembly), so the ledger dir exists on VM and droplet alike. This also lets #441's now-VM-only seam test cover both. 2. Or a dedicated always-imported `ledger.nix` module in the gateway machine dir, added to `AttachGateway`'s import list (gateway_attach.go) so every gateway — VM or FullInstall — carries it. Keep #441's `StateDirectoryMode = "0700"` pin on the control-plane unit (that part is correct and path-agnostic). Extend the seam test to assert the rule appears in the OWN-VPS gateway assembly, not just gateway-guest.nix — that assertion is what would have caught this. This remains the genuine last tooth: #440's honesty guard is proven (this run red-ed correctly at finish instead of a false green), so once the dir truly lands, the next drive completes the founding. Blocks #378. <!-- rehearsal-sig: 404124947736 -->
Author
Owner

Fixed in 3762a67 (on origin/main).

Followed ben's trace + option 2: the d /var/lib/ourcloud 0700 root root - tmpfiles rule was in renderGatewayGuest (vmguest.go), the VM-mode render whose output gateway-guest.nix the own-VPS full-install path never bakes (#399) — so #441's rule evaluated on the loopback VM and was absent on the real droplet, the 3rd recurrence of sig 404124947736.

Fix: the rule now lives in a dedicated ledger.nix (renderLedgerDir, gateway_attach.go) that AttachGateway — the ONE composition point for BOTH gateway shapes (enrollment.go:355) — writes and imports on every gateway via baseMachineModules. Removed from renderGatewayGuest; kept its StateDirectoryMode = "0700" pin. warm_repo mirrors ledger.nix too.

Seam test that would have caught #441: TestAttachGateway_LedgerHomeReachesOwnVPSGateway asserts the rule at the composed OWN-VPS assembly (front door + acme-dns, NO gateway-guest.nix) — verified it fails without the ledger.nix write. TestRenderGatewayGuest_LedgerDirExistsAtBoot → LedgerDirModePinned (mode-only, plus a negative assert that the render no longer carries the rule).

Companion fix (issue body): oc_droplet_evidence (scripts/lib/rehearsal-droplet.sh) now scrubs the stale known_hosts entry + accept-new like oc_droplet_create, so a recycled-IP host-key clash no longer silently loses the droplet journal / ls /var/lib/ourcloud evidence.

Docs: GOTCHAS #18 (gateway config in renderGatewayGuest never reaches the own-VPS gateway — the VM/full-install divergence class); STATUS header lead. go test ./internal/clan/... green; pre-push gate green. Blocks #378 — the next drive should land the ledger and complete the hand-off. NOTE: this fix is unit-verified but, like #441, not verified on a live droplet from here; if it recurs, run with REHEARSAL_KEEP_RED_DROPLET=1 and inspect /etc/tmpfiles.d/ + readlink -f /run/current-system per the issue's inspection plan.

Fixed in 3762a67 (on origin/main). Followed ben's trace + option 2: the `d /var/lib/ourcloud 0700 root root -` tmpfiles rule was in `renderGatewayGuest` (vmguest.go), the VM-mode render whose output `gateway-guest.nix` the own-VPS **full-install** path never bakes (#399) — so #441's rule evaluated on the loopback VM and was absent on the real droplet, the 3rd recurrence of sig 404124947736. **Fix:** the rule now lives in a dedicated `ledger.nix` (`renderLedgerDir`, gateway_attach.go) that `AttachGateway` — the ONE composition point for BOTH gateway shapes (enrollment.go:355) — writes and imports on every gateway via `baseMachineModules`. Removed from `renderGatewayGuest`; kept its `StateDirectoryMode = "0700"` pin. `warm_repo` mirrors ledger.nix too. **Seam test that would have caught #441:** `TestAttachGateway_LedgerHomeReachesOwnVPSGateway` asserts the rule at the composed OWN-VPS assembly (front door + acme-dns, NO gateway-guest.nix) — verified it fails without the ledger.nix write. `TestRenderGatewayGuest_LedgerDirExistsAtBoot` → `LedgerDirModePinned` (mode-only, plus a negative assert that the render no longer carries the rule). **Companion fix (issue body):** `oc_droplet_evidence` (scripts/lib/rehearsal-droplet.sh) now scrubs the stale known_hosts entry + `accept-new` like `oc_droplet_create`, so a recycled-IP host-key clash no longer silently loses the droplet journal / `ls /var/lib/ourcloud` evidence. **Docs:** GOTCHAS #18 (gateway config in `renderGatewayGuest` never reaches the own-VPS gateway — the VM/full-install divergence class); STATUS header lead. `go test ./internal/clan/...` green; pre-push gate green. Blocks #378 — the next drive should land the ledger and complete the hand-off. NOTE: this fix is unit-verified but, like #441, not verified on a live droplet from here; if it recurs, run with REHEARSAL_KEEP_RED_DROPLET=1 and inspect `/etc/tmpfiles.d/` + `readlink -f /run/current-system` per the issue's inspection plan.
ben closed this issue 2026-08-11 20:33:44 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#442
No description provided.