enroll-activate: idss-mesh-self-admit races netbird-mgmt's :8011 bind, deploy exits 4 #1002

Closed
opened 2026-08-29 22:07:25 +00:00 by matou-build-agent · 1 comment

The failure

legs.json / verdict.json put the drive red at standing (roll-up, 784985 ms), whose error is a pass-through of the leg that actually carried the defect — enroll-activate (247644 ms). 11 legs green, 2 red, 0 skipped:

"leg": "enroll-activate", "status": "red", "ms": 247644,
"error": "journey leg \"enroll-activate\" went red: founding: stand up the rented server: clan: masked_exit on gateway: clan reported success but the log shows a real failure: [gateway] Aug 29 21:54:20 idss-gateway-rehearsal-e-17d4 systemd[1]: Failed to start idss-mesh-self-admit.service."

This is not the known frontier. The brief names pairing-never-flips (own-VPS carrier) as the KNOWN red, carried by legs.json skip reasons. verdict.json reports "skip": 0 and legs.json contains no skip entries at all — the drive died in founding, upstream of pairing, and never reached it. This red is new and belongs to HEAD: verdict.json pins "commit": "4257240…", which is exactly the #998 commit that un-rested idss-mesh-self-admit so the gateway joins its own mesh plane at deploy.

The evidence

idss-mesh-self-admit fires the instant the control plane is up, and the Netbird management API it must call is not yet listening (logs/gateway-journal.txt:1634, :1671):

Aug 29 21:54:14 … systemd[1]: Started idss-control-plane.service.
Aug 29 21:54:14 … systemd[1]: Starting idss-mesh-self-admit.service...
Aug 29 21:54:15 … idss-mesh-self-admit-start[2495]: level=ERROR msg="mesh self-admit: minting the gateway's own setup key through the gateway-local management API failed" err="enroll: mesh minter: ensure group \"gateway\": GET /api/groups: Get \"http://localhost:8011/api/groups\": dial tcp [::1]:8011: connect: connection refused" api=http://localhost:8011

systemd considers netbird-mgmt started at 21:54:13, but the process only binds :8011 fifteen seconds later, after SQLite migrations and two geolocation-database downloads (gateway-journal.txt:1333, :1731, :1782, :1844, :1858):

Aug 29 21:54:13 … systemd[1]: Started The management server for Netbird, a wireguard VPN.
Aug 29 21:54:15 … netbird-mgmt[2327]: Geolocation database file GeoLite2-City_20260602.mmdb not found, file will be downloaded
Aug 29 21:54:20 … netbird-mgmt[2327]: Geolocation database file geonames_20260602.db not found, file will be downloaded
Aug 29 21:54:28 … netbird-mgmt[2327]: geolocation service has been initialized from /var/lib/netbird-mgmt/data
Aug 29 21:54:28 … netbird-mgmt[2327]: server.go:226: running HTTP server and gRPC server on the same port: [::]:8011

The self-admit unit burns its whole restart budget inside that window — identical ECONNREFUSED at 21:54:15.000, 21:54:20.182, 21:54:25.411, then once more when switch-to-configuration re-triggers it ("Scheduled restart job immediately on client request", :1819) at 21:54:27.937. That last attempt missed the listener by 243 ms. The switch gives up on the next line pair (gateway-journal.txt:1859-1861):

Aug 29 21:54:28 … nixos[2562]: switching to system configuration /nix/store/s46fsm5j…-nixos-system-gateway-26.11… failed (status 4)
Aug 29 21:54:28 … systemd[1]: clan-switch-gateway-bdf57ef6.service: Main process exited, code=exited, status=4/NOPERMISSION

Five seconds after the deploy was already declared failed, the next scheduled restart succeeds against the now-listening API (:1873-1925):

Aug 29 21:54:33 … systemd[1]: idss-mesh-self-admit.service: Scheduled restart job, restart counter is at 2.
Aug 29 21:54:33 … idss-mesh-self-admit-start[2766]: idss-mesh-self-admit: the gateway's own peer joined its mesh plane on wt0
Aug 29 21:54:33 … systemd[1]: Finished idss-mesh-self-admit.service.

The forensics snapshot taken at 21:54:45 confirms the box converged on its own — logs/gateway-units.txt shows === systemctl --failed === with no failed units, and :8011 healthy: LISTEN 0 4096 *:8011 users:(("netbird-mgmt",pid=2327,fd=11)). So the machine is fine; the deploy is what failed, because a unit that self-heals on its next restart still counts as a failed unit to switch-to-configuration, which exits 4. clan then exited 0 over the top of that — the harness's masked_exit detector is correct here, not over-firing.

Suspected layer

Product / infra — the idss-mesh-self-admit.service unit definition landed by #998. It is ordered After= the Netbird management unit, but netbird-mgmt reaches "started" ~15 s before it reaches "serving". Ordering-on-unit-start is not a readiness gate against a daemon with a long, network-dependent warm-up (the GeoLite2/geonames fetch), so the retry budget (3 × ~5 s ≈ 15 s) is a coin-flip against it. Not a harness bug: the masked_exit scan reported a genuine status 4 switch failure that clan swallowed.

Secondary, worth noting but not the cause: netbird-mgmt[2327]: listen tcp 127.0.0.1:6060: bind: address already in use (:1360) — netbird-signal already holds :6060 (ss confirms netbird-signal,pid=2224,fd=8). Non-fatal (pprof port) but it is a real port collision between the two units.

What plugging it needs

  1. Give idss-mesh-self-admit a real readiness precondition on the management API rather than on the unit: an ExecStartPre that polls http://localhost:8011/api/groups (or a plain TCP wait on :8011) until it answers, with a bounded deadline comfortably past the geolocation warm-up — 90–120 s, not 15.
  2. Or push the retry into the minter itself: have the mesh-minter client treat connection-refused against the gateway-local API as retryable with its own deadline, so the unit exits non-zero only after the API is genuinely never coming.
  3. Failing either, at minimum widen the systemd budget (RestartSec/StartLimitBurst) so it cannot exhaust inside a first-boot warm-up — but this only shrinks the race window; (1) or (2) closes it.
  4. Pre-seed or disable the Netbird geolocation database fetch on the gateway image, so first-boot management startup is not gated on an outbound download whose duration varies with the droplet's network.

A useful ratchet alongside the fix: the masked_exit scan cannot distinguish a unit that failed-then-converged from one that stayed down, so it will keep reporting whichever Failed to start line it sees first. Correlating each Failed to start X against a later Finished X before calling it a real failure would keep this class of red honest — though in this run it would not have changed the verdict, since switch-to-configuration itself exited 4.

What is absent

  • No live-box section was appended to this diagnosis request, so I had no shell on the droplet and diagnosed from the harvested logs alone. They were sufficient: gateway-units.txt already carries the post-hoc systemctl --failed and ss -tlnp that a live box would have been asked for.
  • logs/droplet-journal.txt as named in the brief does not exist; the harvest instead carries per-role gateway-journal.txt (335 KB) and device-journal.txt (150 KB).
  • logs/broker-journal.txt harvested nothing — dev@100.98.48.68: Permission denied (publickey), with its own note that an off-mesh executor harvests no broker journal by design (ADR 0208, #681); the verdict does not depend on it.
  • logs/state-logs.log is an ENOENT against test-results/standing-rented/state/logs — a stale path, unrelated to this red.
  • All guest-*.log files are the same 129-byte stub; there is no guest VM in this drive (host.json records qemu: exit ENOENT: spawn qemu-system-x86_64 ENOENT).

drive 20260829T213942Z red at enroll-activate: journey leg "enroll-activate" went red: founding: stand up the rented server: clan: masked_exit on gateway: clan reported success but the log shows a real failure: [gateway] Aug 29 21:54:20 idss-gatew
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260829T213942Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## The failure `legs.json` / `verdict.json` put the drive red at `standing` (roll-up, 784985 ms), whose error is a pass-through of the leg that actually carried the defect — `enroll-activate` (247644 ms). 11 legs green, 2 red, **0 skipped**: ``` "leg": "enroll-activate", "status": "red", "ms": 247644, "error": "journey leg \"enroll-activate\" went red: founding: stand up the rented server: clan: masked_exit on gateway: clan reported success but the log shows a real failure: [gateway] Aug 29 21:54:20 idss-gateway-rehearsal-e-17d4 systemd[1]: Failed to start idss-mesh-self-admit.service." ``` **This is not the known frontier.** The brief names pairing-never-flips (own-VPS carrier) as the KNOWN red, carried by `legs.json` skip reasons. `verdict.json` reports `"skip": 0` and `legs.json` contains no skip entries at all — the drive died in founding, upstream of pairing, and never reached it. This red is new and belongs to HEAD: `verdict.json` pins `"commit": "4257240…"`, which is exactly the `#998` commit that un-rested `idss-mesh-self-admit` so the gateway joins its own mesh plane at deploy. ## The evidence `idss-mesh-self-admit` fires the instant the control plane is up, and the Netbird management API it must call is not yet listening (`logs/gateway-journal.txt:1634`, `:1671`): ``` Aug 29 21:54:14 … systemd[1]: Started idss-control-plane.service. Aug 29 21:54:14 … systemd[1]: Starting idss-mesh-self-admit.service... Aug 29 21:54:15 … idss-mesh-self-admit-start[2495]: level=ERROR msg="mesh self-admit: minting the gateway's own setup key through the gateway-local management API failed" err="enroll: mesh minter: ensure group \"gateway\": GET /api/groups: Get \"http://localhost:8011/api/groups\": dial tcp [::1]:8011: connect: connection refused" api=http://localhost:8011 ``` systemd considers `netbird-mgmt` started at 21:54:13, but the process only **binds :8011 fifteen seconds later**, after SQLite migrations and two geolocation-database downloads (`gateway-journal.txt:1333`, `:1731`, `:1782`, `:1844`, `:1858`): ``` Aug 29 21:54:13 … systemd[1]: Started The management server for Netbird, a wireguard VPN. Aug 29 21:54:15 … netbird-mgmt[2327]: Geolocation database file GeoLite2-City_20260602.mmdb not found, file will be downloaded Aug 29 21:54:20 … netbird-mgmt[2327]: Geolocation database file geonames_20260602.db not found, file will be downloaded Aug 29 21:54:28 … netbird-mgmt[2327]: geolocation service has been initialized from /var/lib/netbird-mgmt/data Aug 29 21:54:28 … netbird-mgmt[2327]: server.go:226: running HTTP server and gRPC server on the same port: [::]:8011 ``` The self-admit unit burns its whole restart budget inside that window — identical ECONNREFUSED at **21:54:15.000**, **21:54:20.182**, **21:54:25.411**, then once more when `switch-to-configuration` re-triggers it (`"Scheduled restart job immediately on client request"`, `:1819`) at **21:54:27.937**. That last attempt missed the listener by **243 ms**. The switch gives up on the next line pair (`gateway-journal.txt:1859-1861`): ``` Aug 29 21:54:28 … nixos[2562]: switching to system configuration /nix/store/s46fsm5j…-nixos-system-gateway-26.11… failed (status 4) Aug 29 21:54:28 … systemd[1]: clan-switch-gateway-bdf57ef6.service: Main process exited, code=exited, status=4/NOPERMISSION ``` Five seconds after the deploy was already declared failed, the next scheduled restart succeeds against the now-listening API (`:1873-1925`): ``` Aug 29 21:54:33 … systemd[1]: idss-mesh-self-admit.service: Scheduled restart job, restart counter is at 2. Aug 29 21:54:33 … idss-mesh-self-admit-start[2766]: idss-mesh-self-admit: the gateway's own peer joined its mesh plane on wt0 Aug 29 21:54:33 … systemd[1]: Finished idss-mesh-self-admit.service. ``` The forensics snapshot taken at 21:54:45 confirms the box converged on its own — `logs/gateway-units.txt` shows `=== systemctl --failed ===` with **no failed units**, and `:8011` healthy: `LISTEN 0 4096 *:8011 users:(("netbird-mgmt",pid=2327,fd=11))`. So the machine is fine; the *deploy* is what failed, because a unit that self-heals on its next restart still counts as a failed unit to `switch-to-configuration`, which exits 4. `clan` then exited 0 over the top of that — the harness's `masked_exit` detector is correct here, not over-firing. ## Suspected layer **Product / infra — the `idss-mesh-self-admit.service` unit definition landed by #998.** It is ordered `After=` the Netbird management *unit*, but `netbird-mgmt` reaches "started" ~15 s before it reaches "serving". Ordering-on-unit-start is not a readiness gate against a daemon with a long, network-dependent warm-up (the GeoLite2/geonames fetch), so the retry budget (3 × ~5 s ≈ 15 s) is a coin-flip against it. Not a harness bug: the masked_exit scan reported a genuine `status 4` switch failure that `clan` swallowed. Secondary, worth noting but not the cause: `netbird-mgmt[2327]: listen tcp 127.0.0.1:6060: bind: address already in use` (`:1360`) — `netbird-signal` already holds :6060 (`ss` confirms `netbird-signal,pid=2224,fd=8`). Non-fatal (pprof port) but it is a real port collision between the two units. ## What plugging it needs 1. Give `idss-mesh-self-admit` a real readiness precondition on the management API rather than on the unit: an `ExecStartPre` that polls `http://localhost:8011/api/groups` (or a plain TCP wait on :8011) until it answers, with a bounded deadline comfortably past the geolocation warm-up — 90–120 s, not 15. 2. Or push the retry into the minter itself: have the mesh-minter client treat connection-refused against the gateway-local API as retryable with its own deadline, so the unit exits non-zero only after the API is genuinely never coming. 3. Failing either, at minimum widen the systemd budget (`RestartSec`/`StartLimitBurst`) so it cannot exhaust inside a first-boot warm-up — but this only shrinks the race window; (1) or (2) closes it. 4. Pre-seed or disable the Netbird geolocation database fetch on the gateway image, so first-boot management startup is not gated on an outbound download whose duration varies with the droplet's network. A useful ratchet alongside the fix: the masked_exit scan cannot distinguish a unit that failed-then-converged from one that stayed down, so it will keep reporting whichever `Failed to start` line it sees first. Correlating each `Failed to start X` against a later `Finished X` before calling it a real failure would keep this class of red honest — though in *this* run it would not have changed the verdict, since `switch-to-configuration` itself exited 4. ## What is absent - No live-box section was appended to this diagnosis request, so I had no shell on the droplet and diagnosed from the harvested logs alone. They were sufficient: `gateway-units.txt` already carries the post-hoc `systemctl --failed` and `ss -tlnp` that a live box would have been asked for. - `logs/droplet-journal.txt` as named in the brief does not exist; the harvest instead carries per-role `gateway-journal.txt` (335 KB) and `device-journal.txt` (150 KB). - `logs/broker-journal.txt` harvested nothing — `dev@100.98.48.68: Permission denied (publickey)`, with its own note that an off-mesh executor harvests no broker journal by design (ADR 0208, #681); the verdict does not depend on it. - `logs/state-logs.log` is an ENOENT against `test-results/standing-rented/state/logs` — a stale path, unrelated to this red. - All `guest-*.log` files are the same 129-byte stub; there is no guest VM in this drive (`host.json` records `qemu: exit ENOENT: spawn qemu-system-x86_64 ENOENT`). drive `20260829T213942Z` red at `enroll-activate`: `journey leg "enroll-activate" went red: founding: stand up the rented server: clan: masked_exit on gateway: clan reported success but the log shows a real failure: [gateway] Aug 29 21:54:20 idss-gatew` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260829T213942Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 073c79de3e67 -->
Owner

Closing as already fixed (ADR 0174, session hands). This is the same fault the rehearsal healer fixed on this very drive's red: commit 9ef8509af35476d35b1808bf52063faa95fc0045 (landed on main before this ticket was filed). The self-admit now waits for the plane to answer inside its attempt (2 s polls within a 120 s budget) instead of dying on the first refused dial — after= start-vs-readiness recorded as GOTCHAS #126, red-first tests included.

The reporter and healer double-filed the same signature; this ticket blocking #854 would park the drive on a defect that no longer exists. #854 re-fires on the next fresh-pin tick.

**Closing as already fixed (ADR 0174, session hands).** This is the same fault the rehearsal healer fixed on this very drive's red: commit `9ef8509af35476d35b1808bf52063faa95fc0045` (landed on main before this ticket was filed). The self-admit now waits for the plane to answer inside its attempt (2 s polls within a 120 s budget) instead of dying on the first refused dial — `after=` start-vs-readiness recorded as GOTCHAS #126, red-first tests included. The reporter and healer double-filed the same signature; this ticket blocking #854 would park the drive on a defect that no longer exists. #854 re-fires on the next fresh-pin tick.
ben closed this issue 2026-08-29 22:08:22 +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#1002
No description provided.