the gateway deploy uploads 4.15 GB of stock nixpkgs from the operator's laptop — the enrollment leg's --substitute-on-destination (#699) never reached machines update #1764

Closed
opened 2026-09-23 14:45:37 +00:00 by ben · 5 comments
Owner

What happened

A cold manual founding on 2026-09-23 (rented path, whakatohea-demo, DigitalOcean syd1). The takeover finished, the gateway paired, and the deploy step began. Then nothing moved for the better part of an hour — the progress bar was full and the operator asked whether the app was stuck.

It wasn't stuck. It was pushing 4.16 GB from the operator's laptop over a home wifi uplink to Sydney, at a measured 270 KB/s: about four hours, to deliver 6 MB of community content.

Measured on the live run (ss -tin): 52,734,143 bytes sent in 190 s, RTT 331 ms.

What is in those bytes

The delta between the system already on the box (the takeover copy, 903 paths) and the system the deploy is installing (1216 paths) is 347 paths, 4.16 GB of NAR. Split by whether the destination could fetch it itself:

paths size
Signed stock nixpkgs — nextcloud, php, kanidm, … 255 4.15 GB
Unsigned, genuinely built here — the community's own config and vars, system-path, the vendored Caddy plugins 92 0.006 GB

The gateway can fetch every one of those 255 signed paths from cache.nixos.org itself, in parallel, on a datacentre uplink. It fetches them from the operator's laptop instead.

Cause

The enrollment copy already knows this. internal/clan/enrollment.go:1345:

Args: []string{"copy", "--no-check-sigs", "--substitute-on-destination", "--to", store, s.Toplevel},

with a comment that spells out exactly this failure mode and cites #699 — "a ~55m transfer" without the flag.

The deploy leg gets none of that. internal/clan/adapter.go:626 shells out to the pinned clan CLI:

Args: []string{
    "machines", "update", string(n),
    "--flake", flakeRef(a.repo.Dir(), d.req.Revision),
    "--host-key-check", "none",
    "--build-host", "localhost",
},

and clan's own internal nix copy never passes --substitute-on-destination. Confirmed against the running process on the live box:

nix … copy --to ssh-ng://root@168.144.173.83 --no-check-sigs /nix/store/bd49f30…-nixos-system-gateway-26.11…

No --substitute-on-destination. So the #699 lesson holds for the leg that copies the takeover system and is lost for the leg that copies the services, which is the bigger closure of the two — everything a community actually installs (Nextcloud alone is most of the 4 GB) rides the second leg.

--build-host localhost is right and must stay (#1215: without it a VM-mode member builds on a 1 GB guest and nix is OOM-killed). Building here is not the problem. Shipping the result of the build byte-by-byte from here is.

Asks

  1. The deploy must not push signed paths the target can substitute. Whatever shape fits the pinned clan CLI: pass the flag through if clan supports one, or do what the enrollment leg does — a nix copy --substitute-on-destination of the toplevel before machines update, so clan's own copy finds almost everything already present and pushes only the handful of unsigned paths.
  2. A test in the shape of internal/clan/enrollment_test.go:1994, pinning it for the deploy leg too, so the two legs cannot drift apart again.
  3. Founding on a home connection is the normal case, not the exception — an operator standing up their community from a laptop is who this is for. Worth a GOTCHAS entry: every closure that crosses to the gateway substitutes at the destination; only what this machine built itself goes over the wire.

Proof it is the flag

On the live run the deploy was stopped and the same toplevel copied by hand with --substitute-on-destination, against the same gateway over the same wifi. The laptop's uplink use dropped from 270 KB/s saturated to ~82 KB/s of control traffic — the gateway was fetching the stock paths itself.

Related: #699 (the enrollment leg's version of this), #1215 (why --build-host localhost stays), #1760/#1761 (other cold-founding defects from the same run).

## What happened A cold manual founding on 2026-09-23 (rented path, `whakatohea-demo`, DigitalOcean syd1). The takeover finished, the gateway paired, and the deploy step began. Then nothing moved for the better part of an hour — the progress bar was full and the operator asked whether the app was stuck. It wasn't stuck. It was pushing **4.16 GB from the operator's laptop over a home wifi uplink to Sydney**, at a measured 270 KB/s: about **four hours**, to deliver 6 MB of community content. Measured on the live run (`ss -tin`): 52,734,143 bytes sent in 190 s, RTT 331 ms. ## What is in those bytes The delta between the system already on the box (the takeover copy, 903 paths) and the system the deploy is installing (1216 paths) is 347 paths, 4.16 GB of NAR. Split by whether the destination could fetch it itself: | | paths | size | |---|---|---| | **Signed** stock nixpkgs — nextcloud, php, kanidm, … | 255 | **4.15 GB** | | **Unsigned**, genuinely built here — the community's own config and vars, `system-path`, the vendored Caddy plugins | 92 | **0.006 GB** | The gateway can fetch every one of those 255 signed paths from cache.nixos.org itself, in parallel, on a datacentre uplink. It fetches them from the operator's laptop instead. ## Cause The **enrollment** copy already knows this. `internal/clan/enrollment.go:1345`: ```go Args: []string{"copy", "--no-check-sigs", "--substitute-on-destination", "--to", store, s.Toplevel}, ``` with a comment that spells out exactly this failure mode and cites **#699** — "a ~55m transfer" without the flag. The **deploy** leg gets none of that. `internal/clan/adapter.go:626` shells out to the pinned clan CLI: ```go Args: []string{ "machines", "update", string(n), "--flake", flakeRef(a.repo.Dir(), d.req.Revision), "--host-key-check", "none", "--build-host", "localhost", }, ``` and clan's own internal `nix copy` never passes `--substitute-on-destination`. Confirmed against the running process on the live box: ``` nix … copy --to ssh-ng://root@168.144.173.83 --no-check-sigs /nix/store/bd49f30…-nixos-system-gateway-26.11… ``` No `--substitute-on-destination`. So the #699 lesson holds for the leg that copies the *takeover* system and is lost for the leg that copies the *services*, which is the bigger closure of the two — everything a community actually installs (Nextcloud alone is most of the 4 GB) rides the second leg. `--build-host localhost` is right and must stay (#1215: without it a VM-mode member builds on a 1 GB guest and nix is OOM-killed). Building here is not the problem. **Shipping the result of the build byte-by-byte from here is.** ## Asks 1. The deploy must not push signed paths the target can substitute. Whatever shape fits the pinned clan CLI: pass the flag through if clan supports one, or do what the enrollment leg does — a `nix copy --substitute-on-destination` of the toplevel *before* `machines update`, so clan's own copy finds almost everything already present and pushes only the handful of unsigned paths. 2. A test in the shape of `internal/clan/enrollment_test.go:1994`, pinning it for the deploy leg too, so the two legs cannot drift apart again. 3. Founding on a home connection is the normal case, not the exception — an operator standing up their community from a laptop is who this is for. Worth a GOTCHAS entry: *every closure that crosses to the gateway substitutes at the destination; only what this machine built itself goes over the wire.* ## Proof it is the flag On the live run the deploy was stopped and the same toplevel copied by hand **with** `--substitute-on-destination`, against the same gateway over the same wifi. The laptop's uplink use dropped from 270 KB/s saturated to ~82 KB/s of control traffic — the gateway was fetching the stock paths itself. Related: #699 (the enrollment leg's version of this), #1215 (why `--build-host localhost` stays), #1760/#1761 (other cold-founding defects from the same run).
Author
Owner

Correction on which leg, and the measured proof.

Which leg. The 4.16 GB push is the services apply, not the control-plane apply. The control plane had already activated (st.Activated true), so internal/founding/services.go:214 re-enters applyControlPlane for the tip carrying the attached service modules. Both legs go through the same updateNode at internal/clan/adapter.go:626, so the missing flag is one fix — but it bites hardest here, because this is the closure that carries what a community actually installs. On this run the services placed were Files & documents, Document editing, Community archive and Data collections; Nextcloud alone is most of the 4 GB.

Measured proof the flag is the whole story. The deploy was stopped and the identical toplevel copied by hand against the same gateway, over the same wifi, with --substitute-on-destination added:

nix copy --no-check-sigs --substitute-on-destination \
  --to ssh-ng://root@168.144.173.83 \
  /nix/store/bd49f30…-nixos-system-gateway-26.11.20260612.173d0ad
  • ~7 minutes, exit 0, whole closure present on the gateway afterwards (ls -d /nix/store/bd49f30… on the box resolves).
  • Laptop uplink use fell from 270 KB/s saturated to ~82 KB/s of control traffic — the gateway was fetching from cache.nixos.org itself.

So: 4 hours → 7 minutes on a home connection, for one flag.

The operator-facing cost when it isn't fixed. The services apply is deliberately non-fatal (#1392, ADR 0100) — correct behaviour, and it worked honestly here: the deploy reported live and all four services landed as "the deploy did not hold — add … from the control panel". But stack that on top of a four-hour silent push and the realistic outcome is an operator who concludes the app has hung, kills it, and arrives at hand-off with a live community and zero services — having been given no way to tell "working" from "stuck". That is this run, exactly.

See also the sibling ticket on the same step reporting no progress at all.

Correction on which leg, and the measured proof. **Which leg.** The 4.16 GB push is the **services** apply, not the control-plane apply. The control plane had already activated (`st.Activated` true), so `internal/founding/services.go:214` re-enters `applyControlPlane` for the tip carrying the attached service modules. Both legs go through the same `updateNode` at `internal/clan/adapter.go:626`, so the missing flag is one fix — but it bites hardest here, because this is the closure that carries what a community actually installs. On this run the services placed were Files & documents, Document editing, Community archive and Data collections; Nextcloud alone is most of the 4 GB. **Measured proof the flag is the whole story.** The deploy was stopped and the identical toplevel copied by hand against the same gateway, over the same wifi, with `--substitute-on-destination` added: ``` nix copy --no-check-sigs --substitute-on-destination \ --to ssh-ng://root@168.144.173.83 \ /nix/store/bd49f30…-nixos-system-gateway-26.11.20260612.173d0ad ``` - **~7 minutes**, exit 0, whole closure present on the gateway afterwards (`ls -d /nix/store/bd49f30…` on the box resolves). - Laptop uplink use fell from **270 KB/s saturated to ~82 KB/s** of control traffic — the gateway was fetching from cache.nixos.org itself. So: **4 hours → 7 minutes** on a home connection, for one flag. **The operator-facing cost when it isn't fixed.** The services apply is deliberately non-fatal (#1392, ADR 0100) — correct behaviour, and it worked honestly here: the deploy reported `live` and all four services landed as *"the deploy did not hold — add … from the control panel"*. But stack that on top of a four-hour silent push and the realistic outcome is an operator who concludes the app has hung, kills it, and arrives at hand-off with a live community and **zero services** — having been given no way to tell "working" from "stuck". That is this run, exactly. See also the sibling ticket on the same step reporting no progress at all.
Author
Owner

Sibling on the same step: #1765 — why the operator could not tell this was working.

Sibling on the same step: #1765 — why the operator could not tell this was working.
Author
Owner

This is now decision 1 of ADR 0272 (docs/adr/0272-the-target-fetches-its-own-bytes-the-installer-carries-only-the-pre-gateway-bootstrap.md, landed 180b4975) — the founding device sends a target only what the target cannot obtain itself. The measurement on this ticket is the ADR's central evidence.

This ticket stays independent: it needs nothing from the rest of the slice (#1767, #1768, #1769, #1770, #1771, #1772) and is the one piece that helps every founding immediately.

This is now **decision 1 of ADR 0272** (`docs/adr/0272-the-target-fetches-its-own-bytes-the-installer-carries-only-the-pre-gateway-bootstrap.md`, landed `180b4975`) — the founding device sends a target only what the target cannot obtain itself. The measurement on this ticket is the ADR's central evidence. This ticket stays independent: it needs nothing from the rest of the slice (#1767, #1768, #1769, #1770, #1771, #1772) and is the one piece that helps every founding immediately.

swarm-claim host=matou-dev-server-01 run=30954
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=30954 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1764 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1764,
  "status": "success",
  "commits": [
    "968a0dcd"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "internal/clan/adapter.go",
    "internal/clan/deploy_substitute_test.go",
    "internal/clan/deploytarget.go",
    "internal/clan/store_count.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/clan/... -count=1",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go vet ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go build ./...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The deploy must not push signed paths the target can substitute": "internal/clan/adapter.go substituteAhead() runs a `nix copy --no-check-sigs --substitute-on-destination --to ssh-ng://<target> <toplevel>` BEFORE `clan machines update`, so clan's own copy finds the signed stock-nixpkgs paths already present at the destination and pushes only the unsigned community-built paths; covers both the control-plane and services applies (both go through updateNode).",
    "A test in the shape of enrollment_test.go:1994 pinning it for the deploy leg too": "internal/clan/deploy_substitute_test.go TestDeploy_SubstitutesStockPathsAtTheTargetInsteadOfPushingThemFromHere asserts the deploy's pre-copy carries --substitute-on-destination + --no-check-sigs, targets the node's ssh-ng deploy target, and pushes the built toplevel — the deploy-leg twin of TestEnroll_VMModeCopyLetsTheTargetSubstituteWhatItCan; plus TestDeploy_SkipsTheSubstituteAheadCopyOnALoopbackSelfDeploy.",
    "A GOTCHAS entry: every closure that crosses to the gateway substitutes at the destination; only what this machine built goes over the wire": "docs/GOTCHAS.md #320 records the symptom/cause/rule and the invariant verbatim."
  },
  "summary": "The gateway deploy leg pre-copies the toplevel with --substitute-on-destination so the datacentre target fetches signed stock nixpkgs itself and only locally-built paths cross the wire.",
  "blockers": []
}
**close-report** for #1764 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1764, "status": "success", "commits": [ "968a0dcd" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "internal/clan/adapter.go", "internal/clan/deploy_substitute_test.go", "internal/clan/deploytarget.go", "internal/clan/store_count.go" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/clan/... -count=1", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go vet ./internal/clan/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go build ./...", "exit_code": 0 } ], "criteria": { "The deploy must not push signed paths the target can substitute": "internal/clan/adapter.go substituteAhead() runs a `nix copy --no-check-sigs --substitute-on-destination --to ssh-ng://<target> <toplevel>` BEFORE `clan machines update`, so clan's own copy finds the signed stock-nixpkgs paths already present at the destination and pushes only the unsigned community-built paths; covers both the control-plane and services applies (both go through updateNode).", "A test in the shape of enrollment_test.go:1994 pinning it for the deploy leg too": "internal/clan/deploy_substitute_test.go TestDeploy_SubstitutesStockPathsAtTheTargetInsteadOfPushingThemFromHere asserts the deploy's pre-copy carries --substitute-on-destination + --no-check-sigs, targets the node's ssh-ng deploy target, and pushes the built toplevel — the deploy-leg twin of TestEnroll_VMModeCopyLetsTheTargetSubstituteWhatItCan; plus TestDeploy_SkipsTheSubstituteAheadCopyOnALoopbackSelfDeploy.", "A GOTCHAS entry: every closure that crosses to the gateway substitutes at the destination; only what this machine built goes over the wire": "docs/GOTCHAS.md #320 records the symptom/cause/rule and the invariant verbatim." }, "summary": "The gateway deploy leg pre-copies the toplevel with --substitute-on-destination so the datacentre target fetches signed stock nixpkgs itself and only locally-built paths cross the wire.", "blockers": [] } ``` </details>
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.

Dependencies

No dependencies set.

Reference
Matou/idss#1764
No description provided.