own-VPS finish: gateway never creates /var/lib/ourcloud before the ledger scp — authority handover fails on the last leg #441

Closed
opened 2026-08-11 18:59:43 +00:00 by ben · 1 comment
Owner

The last leg of a full own-VPS founding

Run 20260811T185108Z (and 183121Z before it) drove the ENTIRE own-VPS journey on a real droplet — spec-gate passed, deploy complete, control plane live — and faulted only at the authority handover:

finish | 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

The helper scps the enroll ledger to /var/lib/ourcloud/enroll.json on the now-live gateway, but the gateway's NixOS config never creates /var/lib/ourcloud/, so scp fails opening the destination.

Fix

Ensure /var/lib/ourcloud/ exists on the gateway before the ledger lands — the durable way is a NixOS declaration in the gateway render (a systemd.tmpfiles.rules d /var/lib/ourcloud 0700 root root - entry, or the owning service's StateDirectory=ourcloud), so the dir is present the moment the box is up. (mkdir -p in the scp path just before is the lesser fix; the config declaration is the honest one — the ledger's home is part of the gateway's shape.) Match ownership/mode to what the control plane reads the ledger as.

Seam/eval test: the rendered gateway carries the ledger dir (tmpfiles rule or StateDirectory), so a founding that lands the ledger finds its parent.

This is the genuine final tooth: with it (and the false-green harness fix that must not mask it), the next drive completes a founding end to end. Blocks #378.

## The last leg of a full own-VPS founding Run `20260811T185108Z` (and `183121Z` before it) drove the ENTIRE own-VPS journey on a real droplet — spec-gate passed, **deploy complete, control plane live** — and faulted only at the authority handover: ``` finish | 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 ``` The helper scps the enroll ledger to `/var/lib/ourcloud/enroll.json` on the now-live gateway, but the gateway's NixOS config never creates `/var/lib/ourcloud/`, so scp fails opening the destination. ## Fix Ensure `/var/lib/ourcloud/` exists on the gateway before the ledger lands — the durable way is a NixOS declaration in the gateway render (a `systemd.tmpfiles.rules` `d /var/lib/ourcloud 0700 root root -` entry, or the owning service's `StateDirectory=ourcloud`), so the dir is present the moment the box is up. (mkdir -p in the scp path just before is the lesser fix; the config declaration is the honest one — the ledger's home is part of the gateway's shape.) Match ownership/mode to what the control plane reads the ledger as. Seam/eval test: the rendered gateway carries the ledger dir (tmpfiles rule or StateDirectory), so a founding that lands the ledger finds its parent. This is the genuine final tooth: with it (and the false-green harness fix that must not mask it), the next drive completes a founding end to end. Blocks #378.
Author
Owner

Fixed in d765cf6 (on origin/main).

Root cause: the finish leg's fleet-seeding (Fleet.SeedLedger) scps the enroll ledger to /var/lib/ourcloud/enroll.json on the live gateway and only THEN restarts the control-plane. The render created that dir solely through the control-plane unit's StateDirectory — which systemd creates on the unit's FIRST start — and the seeding scp precedes that restart, so it died on scp: dest open "/var/lib/ourcloud/enroll.json": No such file or directory. StateDirectory was there all along; it just fires too late for the scp.

Fix (the durable one): renderGatewayGuest (internal/clan/vmguest.go) now declares a boot-time systemd.tmpfiles.rules d /var/lib/ourcloud 0700 root root - so the ledger's home exists the moment the box is up, independent of the service; and pins the control-plane StateDirectoryMode = "0700" so the unit's first start does not re-widen the dir the tmpfiles rule created. Root 0700: the control-plane reads the ledger as root (no User=) and the ledger carries identity grants.

Seam test: TestRenderGatewayGuest_LedgerDirExistsAtBoot (internal/clan/vmguest_test.go) pins both the tmpfiles rule and the mode — a founding that lands the ledger finds its parent. Full go build/vet + internal/clan, internal/fleetwire, internal/founding tests green; the pre-push gate ran the whole suite green.

Blocks #378; pairs with #440 (false-green harness fix) so a faulted finish cannot read green.

Fixed in d765cf6 (on origin/main). **Root cause:** the finish leg's fleet-seeding (`Fleet.SeedLedger`) scps the enroll ledger to `/var/lib/ourcloud/enroll.json` on the live gateway and only THEN restarts the control-plane. The render created that dir solely through the control-plane unit's `StateDirectory` — which systemd creates on the unit's FIRST start — and the seeding scp precedes that restart, so it died on `scp: dest open "/var/lib/ourcloud/enroll.json": No such file or directory`. StateDirectory was there all along; it just fires too late for the scp. **Fix (the durable one):** `renderGatewayGuest` (internal/clan/vmguest.go) now declares a boot-time `systemd.tmpfiles.rules` `d /var/lib/ourcloud 0700 root root -` so the ledger's home exists the moment the box is up, independent of the service; and pins the control-plane `StateDirectoryMode = "0700"` so the unit's first start does not re-widen the dir the tmpfiles rule created. Root 0700: the control-plane reads the ledger as root (no User=) and the ledger carries identity grants. **Seam test:** `TestRenderGatewayGuest_LedgerDirExistsAtBoot` (internal/clan/vmguest_test.go) pins both the tmpfiles rule and the mode — a founding that lands the ledger finds its parent. Full `go build/vet` + `internal/clan`, `internal/fleetwire`, `internal/founding` tests green; the pre-push gate ran the whole suite green. Blocks #378; pairs with #440 (false-green harness fix) so a faulted finish cannot read green.
ben closed this issue 2026-08-11 19:31:46 +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#441
No description provided.