Why the rented droplet from drive 20260823T104013Z never came back on SSH after enroll-activate's verify() — live-droplet forensics needed (follow-on to #702) #703

Closed
opened 2026-08-23 11:49:37 +00:00 by ben · 2 comments
Owner

Context

#702 settled the reboot-vs-no-reboot contradiction definitively from clan-core's own source (clan_lib/machines/update.py, _nixos_activate): clan machines update (VMMode) never reboots the target under any path, and verify()'s shared blocked-remedy text has been fixed to stop claiming a reboot for a mode that never has one. That fix is landed and closed under #702.

What #702 did not resolve, and could not resolve without live infrastructure, is the deeper question its title also raised: why did the droplet from drive 20260823T104013Z (209.38.89.240) never answer SSH again, through every post-hoc probe (droplet-journal.txt, droplet-units.txt, droplet-caddy.txt all show Connection timed out)?

What #702 newly established (read this before investigating)

Reading clan-core's _nixos_activate closely surfaced something that changes the shape of this investigation: it wraps the live switch-to-configuration switch in systemd-run --pipe --wait --collect, specifically (per its own docstring) "so the activation survives SSH connection drops" — the transient unit is systemd-managed on the TARGET box, decoupled from the invoking SSH session's process group.

This means our own defaultPhaseTimeout (internal/clan/enrollment.go:67, 20 minutes) SIGKILLing the LOCAL clan machines update process likely does not stop the REMOTE activation at all. The box's fate may already have been sealed server-side, independent of our local wait. Two consequences for whoever picks this up:

  1. Do not assume widening defaultPhaseTimeout/the enroll-activate PAIR_FRONTIER ceiling (mirroring the #698 enroll-copy precedent) fixes this. That precedent was a LOCAL transfer genuinely gated by local wall-clock; this is a REMOTE detached unit whose completion is not gated by how long our local process waits. A timeout bump is not evidenced to help and could plausibly make things worse (a re-drive firing a SECOND switch-to-configuration against a still-running first one on re-drive — a new, not-yet-reproduced hazard; see GOTCHAS #62).
  2. GOTCHAS #47 (disko/DiskoLayout drift bricking the box on reboot) is checked and ruled out for this failure shape, same as #700's analogous case: TestGatewayImageDiskoMatchesRenderDisko is green, and there is no reboot in this path anyway (see above) so #47's specific reboot-triggered-bootloader-mismatch mechanism cannot be it.

What needs live-droplet access to settle

The interrupted founding-state.log tail showed normal in-progress activation output right up to the kill: sops-install-secrets key imports, then [gateway] NOT restarting the following changed units: systemd-fsck@dev-disk-by\x2dpartlabel-disk\x2dmain\x2dESP.service, … and Failed to reload user unit dbus-broker.service. That last line is the most concrete lead — a reload failure on a live system service during activation is a plausible mechanism for a box losing network/sshd reachability without any reboot or disko involvement at all, but this cannot be confirmed from a killed log's tail.

A future ready-for-session run should, on a fresh rented drive reaching enroll-activate:

  • Either patch defaultPhaseTimeout locally (diagnostic-only, not a production change) to let the LOCAL wrapper wait past 20m without killing its own view of the process, to observe directly whether the remote clan machines update actually completes, hangs, or errors — testing the systemd-run-detachment hypothesis above head-on; or
  • Capture the DigitalOcean droplet's console/serial log during and after a real enroll-activate run, which is the only way to see what happened on-box if our local process has already given up.

This is ready-for-session work (host/droplet standing, not a Ben-specific judgement call) per ADR 0174 rule 5 — no one-way door is anticipated yet, but the live evidence gathered may surface one (e.g. if the root cause turns out to need a security-posture change).

Proposed default ruling

None yet — this ticket is scoped to gather live evidence first; a concrete fix ruling should follow once the mechanism is known.

## Context #702 settled the *reboot-vs-no-reboot contradiction* definitively from clan-core's own source (`clan_lib/machines/update.py`, `_nixos_activate`): `clan machines update` (VMMode) never reboots the target under any path, and `verify()`'s shared blocked-remedy text has been fixed to stop claiming a reboot for a mode that never has one. That fix is landed and closed under #702. What #702 did **not** resolve, and could not resolve without live infrastructure, is the deeper question its title also raised: **why did the droplet from drive `20260823T104013Z` (209.38.89.240) never answer SSH again**, through every post-hoc probe (`droplet-journal.txt`, `droplet-units.txt`, `droplet-caddy.txt` all show `Connection timed out`)? ## What #702 newly established (read this before investigating) Reading clan-core's `_nixos_activate` closely surfaced something that changes the shape of this investigation: it wraps the live `switch-to-configuration switch` in `systemd-run --pipe --wait --collect`, specifically (per its own docstring) "so the activation survives SSH connection drops" — the transient unit is systemd-managed on the TARGET box, decoupled from the invoking SSH session's process group. This means our own `defaultPhaseTimeout` (`internal/clan/enrollment.go:67`, 20 minutes) SIGKILLing the LOCAL `clan machines update` process likely does **not** stop the REMOTE activation at all. The box's fate may already have been sealed server-side, independent of our local wait. Two consequences for whoever picks this up: 1. **Do not assume widening `defaultPhaseTimeout`/the `enroll-activate` `PAIR_FRONTIER` ceiling (mirroring the #698 enroll-copy precedent) fixes this.** That precedent was a LOCAL transfer genuinely gated by local wall-clock; this is a REMOTE detached unit whose completion is not gated by how long our local process waits. A timeout bump is not evidenced to help and could plausibly make things worse (a re-drive firing a SECOND `switch-to-configuration` against a still-running first one on re-drive — a new, not-yet-reproduced hazard; see GOTCHAS #62). 2. **GOTCHAS #47 (disko/`DiskoLayout` drift bricking the box on reboot) is checked and ruled out** for this failure shape, same as #700's analogous case: `TestGatewayImageDiskoMatchesRenderDisko` is green, and there is no reboot in this path anyway (see above) so #47's specific reboot-triggered-bootloader-mismatch mechanism cannot be it. ## What needs live-droplet access to settle The interrupted `founding-state.log` tail showed normal in-progress activation output right up to the kill: `sops-install-secrets` key imports, then `[gateway] NOT restarting the following changed units: systemd-fsck@dev-disk-by\x2dpartlabel-disk\x2dmain\x2dESP.service, …` and `Failed to reload user unit dbus-broker.service`. That last line is the most concrete lead — a reload failure on a live system service during activation is a plausible mechanism for a box losing network/sshd reachability without any reboot or disko involvement at all, but this cannot be confirmed from a killed log's tail. A future `ready-for-session` run should, on a fresh rented drive reaching `enroll-activate`: - Either patch `defaultPhaseTimeout` locally (diagnostic-only, not a production change) to let the LOCAL wrapper wait past 20m without killing its own view of the process, to observe directly whether the remote `clan machines update` actually completes, hangs, or errors — testing the systemd-run-detachment hypothesis above head-on; or - Capture the DigitalOcean droplet's console/serial log during and after a real `enroll-activate` run, which is the only way to see what happened on-box if our local process has already given up. This is `ready-for-session` work (host/droplet standing, not a Ben-specific judgement call) per ADR 0174 rule 5 — no one-way door is anticipated yet, but the live evidence gathered may surface one (e.g. if the root cause turns out to need a security-posture change). ## Proposed default ruling None yet — this ticket is scoped to gather live evidence first; a concrete fix ruling should follow once the mechanism is known.

New evidence from #704 (drive 20260823T115746Z), advances #703

A second independent instance of this mystery, one stage later than #702's enroll-activate red: the deploy's own applyControlPlane reconciled successfully (no clan.DeployError), but the FOLLOW-UP probeControlPlaneActive re-probe of idss-control-plane.service then failed all 6 attempts. The persisted failure tail is a raw OpenSSH refusal — REMOTE HOST IDENTIFICATION HAS CHANGED! — against the app-scoped known_hosts, which held exactly ONE (freshly-learned, non-stale) entry for this host. That rules out a recycled-IP artifact: the key genuinely changed during this drive, between the earlier connect leg (which pinned it fine) and this post-deploy probe. By the time post-drive evidence-gather ran, the box (170.64.230.22) was fully unreachable (Connection timed out), not just key-refusing.

This is direct, now-twice-reproduced proof that the box's presented SSH identity moves across this deploy despite rentedpath.go's documented no-reboot / no-RotateHostKey VMMode contract — the exact mechanism this ticket is scoped to chase live. Folded into docs/GOTCHAS.md #62 as a second data point.

Also fixed while investigating (ruled by agent under ADR 0174 — two-way door, revertible, proven by shell tests): checked #704's own droplet via the DigitalOcean API and found it already gone (zero idss-gateway-tagged droplets live). Root cause: oc_rented_teardown (scripts/lib/rehearsal-droplet.sh) was unconditionally reaping the rented droplet on every red drive — unlike the clan-lab target's existing REHEARSAL_KEEP_RED_DROPLET keep-on-red contract (#412) — so a reproducing box was destroyed before anyone could ever pull its console, independent of whether a human or an agent session was watching. oc_rented_teardown now honours the same flag (skips the broker release + fallback reap on a red drive, still offboards the subdomain, still TTL-reaped by the broker per GOTCHAS #48). Commit 20a342df.

What this means for whoever picks up #703's live-forensics work next: set REHEARSAL_KEEP_RED_DROPLET=1 on the next rented drive that reproduces this — the box will now stay up (broker TTL is the failsafe) long enough to actually pull the DO console, instead of being auto-destroyed before anyone can look, which is what happened to both this drive's box and the earlier 20260823T104013Z one.

Ruled by agent under ADR 0174 — veto anytime.

## New evidence from #704 (drive `20260823T115746Z`), advances #703 A second independent instance of this mystery, one stage later than #702's `enroll-activate` red: the deploy's own `applyControlPlane` reconciled successfully (no `clan.DeployError`), but the FOLLOW-UP `probeControlPlaneActive` re-probe of `idss-control-plane.service` then failed all 6 attempts. The persisted failure tail is a raw OpenSSH refusal — `REMOTE HOST IDENTIFICATION HAS CHANGED!` — against the app-scoped `known_hosts`, which held exactly ONE (freshly-learned, non-stale) entry for this host. That rules out a recycled-IP artifact: the key genuinely changed *during this drive*, between the earlier `connect` leg (which pinned it fine) and this post-deploy probe. By the time post-drive evidence-gather ran, the box (`170.64.230.22`) was fully unreachable (`Connection timed out`), not just key-refusing. This is direct, now-twice-reproduced proof that the box's presented SSH identity moves across this deploy despite `rentedpath.go`'s documented no-reboot / no-`RotateHostKey` VMMode contract — the exact mechanism this ticket is scoped to chase live. Folded into `docs/GOTCHAS.md` #62 as a second data point. **Also fixed while investigating (ruled by agent under ADR 0174 — two-way door, revertible, proven by shell tests):** checked `#704`'s own droplet via the DigitalOcean API and found it already gone (zero `idss-gateway`-tagged droplets live). Root cause: `oc_rented_teardown` (`scripts/lib/rehearsal-droplet.sh`) was unconditionally reaping the rented droplet on every red drive — unlike the clan-lab target's existing `REHEARSAL_KEEP_RED_DROPLET` keep-on-red contract (#412) — so a reproducing box was destroyed before anyone could ever pull its console, independent of whether a human or an agent session was watching. `oc_rented_teardown` now honours the same flag (skips the broker release + fallback reap on a red drive, still offboards the subdomain, still TTL-reaped by the broker per GOTCHAS #48). Commit `20a342df`. **What this means for whoever picks up #703's live-forensics work next:** set `REHEARSAL_KEEP_RED_DROPLET=1` on the next rented drive that reproduces this — the box will now stay up (broker TTL is the failsafe) long enough to actually pull the DO console, instead of being auto-destroyed before anyone can look, which is what happened to both this drive's box and the earlier `20260823T104013Z` one. Ruled by agent under ADR 0174 — veto anytime.

Close report — settled live, fixed, and proven

The answer: the box was never hung, never crashed and never rebooted. Its
own activation took the NIC away from it. The deployed VMMode config drops
networking.useNetworkd and services.cloud-init, so
switch-to-configuration stops networkd and hands the interface to scripted
dhcpcd
— which solicits a lease nothing on DigitalOcean answers (DO hands
out a static address), falls back to IPv4LL and installs its own default
route over the real one
. The box keeps its public address and a healthy
sshd, and every reply leaves via a link-local default and is dropped. From
outside that is exactly Connection timed out, forever — and it also explains
#702's 20m defaultPhaseTimeout burn: our wrapper was waiting on a box that
could no longer answer anyone.

The measurement (live, two droplets rented from idss-gateway-01eedc890405)

Switching a live rented droplet onto the exact renderVMGuestBaseline text,
under clan-core's own systemd-run --pipe --wait --collect shape:

16:35:08 systemd-networkd.service: Deactivated successfully   <- no useNetworkd in the new config
16:35:10 Starting Networking Setup...                          <- scripted networking takes the NIC
16:35:11 dhcpcd-10.1.0 starting
16:35:12 ens3: soliciting a DHCP lease                         <- nothing on DO answers
16:35:17 ens3: probing for an IPv4LL address
16:35:22 ens3: using IPv4LL address 169.254.191.197
16:35:22 ens3: adding default route                            <- the box dies HERE

Last state seen off-box: sshd=active networkd=inactive dhcpcd=active, address
170.64.163.194/20 still present, and
default dev ens3 scope link src 169.254.191.197 where
default via 170.64.160.1 proto static used to be. Reproduced twice; the
activation output matched #702's founding-state.log tail line for line,
including the ESP systemd-fsck "NOT restarting" line.

Why the two sides disagreed

  • The image (nix/gateway-image/configuration.nix) runs cloud-init with
    networking.useNetworkd = true, and DO's metadata is static: cloud-init
    writes /etc/systemd/network/10-cloud-init-ens3.network with DHCP=no, an
    Address= and a [Route] Gateway=.
  • The deployed config is renderVMGuestBaseline, which MIRRORS the QEMU
    guest image and declares neither — correct for a QEMU guest whose user-net
    really serves DHCP, fatal on a droplet. The rented path bakes it verbatim:
    enrollment.go's configure stage takes the s.NodeConfig == nil branch, so
    no networking.nix is rendered at all.

What landed — commit 458d006a

renderGatewayGuest's public branch (g.Public != nil, the rented shape's
existing signal) now splices rentedHostNetworking():
networking.useNetworkd = true + services.cloud-init (carrying #707's
ssh_deletekeys = false, so enabling cloud-init here can never re-open the
host-key flip GOTCHAS #63 closed). It mirrors the image's own proven lines
rather than inventing a shape. The PRIVATE VM guest deliberately does not gain
it, so the QEMU path is untouched.

Proof, three ways:

  1. TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit — red before,
    green after, and it also pins that the private guest does NOT gain the block.
  2. TestRentedGateway_EvalSmoke (IDSS_EVAL_SMOKE=1) green — a real nix eval
    of the whole rented gateway against clan-core's own nixpkgs (26.11), the
    rev the fleet actually deploys, so the options resolve there and not just on
    the image's 24.11.
  3. Live on the same droplet: with the block, switch-to-configuration
    finishes in 2.1s with result: success, the proto static default route
    survives, and SSH/ICMP never drop — where the unfixed config had gone dark
    within 14 seconds.

gofmt, go vet and the full internal/... suite green. GOTCHAS #64
added; #62's and #63's open cross-references to this ticket are now answered in
place. STATUS.md header updated.

Answering this ticket's two proposed approaches

Neither was needed, and the first would have misled. Patching
defaultPhaseTimeout could never have helped — the remote unit was not still
working, it had finished the step that killed reachability. And DigitalOcean
exposes no console-log API (the console is an interactive web VNC), so
"capture the droplet's console log" is not scriptable from a session. What
worked instead, and is now written into GOTCHAS #64 as method: stream the
evidence off-box before breaking it (journalctl -f + a tail -F sampler,
both redirected to local files), enable a persistent journal, and use
switch-to-configuration **test** rather than switch — test leaves the
bootloader and system profile alone, so a DO power_cycle recovers the box and
journalctl -b -1 still has everything. The droplet given a real switch never
came back from its power cycle; the one given test came back in under a
minute.

Filed, not fixed here — #710

The same baseline declares fileSystems."/" = "/dev/disk/by-label/nixos", the
label make-disk-image puts on the QEMU qcow2. A rented droplet's disko root is
/dev/vda1, PARTLABEL=disk-main-root, with no filesystem label (ls /dev/disk/by-label/ shows only config-2), and the deployed system's
/etc/fstab really does read that missing device; its grub also drops the
image's efiSupport/efiInstallAsRemovable. VMMode never reboots, so it bites
the first restart after a drive, not the drive — a latent brick that changes
what the box boots and wants its own live proof, so it gets its own
ready-for-session ticket rather than a same-session second change.

Housekeeping

Both forensics droplets destroyed and the ephemeral DigitalOcean SSH key
deleted; nothing left running. No REHEARSAL_KEEP_RED_DROPLET drive was needed
in the end — the targeted rentals answered the question faster and more
precisely than waiting for a red drive to reproduce.

Ruled by agent under ADR 0174 — veto anytime. Two-way door throughout: one
revertible render change, proven by a Go contract test, a real nix eval on the
deploy rev, and a live before/after on rented droplets. No security-posture
change — cloud-init was already running on these boxes, and #707's key pin rides
along with it.

## Close report — settled live, fixed, and proven **The answer:** the box was never hung, never crashed and never rebooted. Its own activation took the NIC away from it. The deployed VMMode config drops `networking.useNetworkd` and `services.cloud-init`, so `switch-to-configuration` stops networkd and hands the interface to **scripted `dhcpcd`** — which solicits a lease nothing on DigitalOcean answers (DO hands out a **static** address), falls back to IPv4LL and **installs its own default route over the real one**. The box keeps its public address and a healthy `sshd`, and every reply leaves via a link-local default and is dropped. From outside that is exactly `Connection timed out`, forever — and it also explains #702's 20m `defaultPhaseTimeout` burn: our wrapper was waiting on a box that could no longer answer *anyone*. ### The measurement (live, two droplets rented from `idss-gateway-01eedc890405`) Switching a live rented droplet onto the exact `renderVMGuestBaseline` text, under clan-core's own `systemd-run --pipe --wait --collect` shape: ``` 16:35:08 systemd-networkd.service: Deactivated successfully <- no useNetworkd in the new config 16:35:10 Starting Networking Setup... <- scripted networking takes the NIC 16:35:11 dhcpcd-10.1.0 starting 16:35:12 ens3: soliciting a DHCP lease <- nothing on DO answers 16:35:17 ens3: probing for an IPv4LL address 16:35:22 ens3: using IPv4LL address 169.254.191.197 16:35:22 ens3: adding default route <- the box dies HERE ``` Last state seen off-box: `sshd=active networkd=inactive dhcpcd=active`, address `170.64.163.194/20` still present, and `default dev ens3 scope link src 169.254.191.197` where `default via 170.64.160.1 proto static` used to be. Reproduced twice; the activation output matched #702's `founding-state.log` tail line for line, including the ESP `systemd-fsck` "NOT restarting" line. ### Why the two sides disagreed - The **image** (`nix/gateway-image/configuration.nix`) runs cloud-init with `networking.useNetworkd = true`, and DO's metadata is static: cloud-init writes `/etc/systemd/network/10-cloud-init-ens3.network` with `DHCP=no`, an `Address=` and a `[Route] Gateway=`. - The **deployed** config is `renderVMGuestBaseline`, which MIRRORS the QEMU guest image and declares neither — correct for a QEMU guest whose user-net really serves DHCP, fatal on a droplet. The rented path bakes it verbatim: `enrollment.go`'s configure stage takes the `s.NodeConfig == nil` branch, so no `networking.nix` is rendered at all. ### What landed — commit `458d006a` `renderGatewayGuest`'s public branch (`g.Public != nil`, the rented shape's existing signal) now splices `rentedHostNetworking()`: `networking.useNetworkd = true` + `services.cloud-init` (carrying #707's `ssh_deletekeys = false`, so enabling cloud-init here can never re-open the host-key flip GOTCHAS #63 closed). It mirrors the image's own proven lines rather than inventing a shape. The PRIVATE VM guest deliberately does not gain it, so the QEMU path is untouched. Proof, three ways: 1. `TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit` — red before, green after, and it also pins that the private guest does NOT gain the block. 2. `TestRentedGateway_EvalSmoke` (`IDSS_EVAL_SMOKE=1`) green — a real `nix eval` of the whole rented gateway against **clan-core's own nixpkgs (26.11)**, the rev the fleet actually deploys, so the options resolve there and not just on the image's 24.11. 3. **Live on the same droplet:** with the block, `switch-to-configuration` finishes in **2.1s** with `result: success`, the `proto static` default route survives, and SSH/ICMP never drop — where the unfixed config had gone dark within 14 seconds. `gofmt`, `go vet` and the full `internal/...` suite green. GOTCHAS **#64** added; #62's and #63's open cross-references to this ticket are now answered in place. STATUS.md header updated. ### Answering this ticket's two proposed approaches Neither was needed, and the first would have misled. Patching `defaultPhaseTimeout` could never have helped — the remote unit was not still working, it had *finished* the step that killed reachability. And DigitalOcean exposes **no console-log API** (the console is an interactive web VNC), so "capture the droplet's console log" is not scriptable from a session. What worked instead, and is now written into GOTCHAS #64 as method: stream the evidence **off-box** before breaking it (`journalctl -f` + a `tail -F` sampler, both redirected to local files), enable a persistent journal, and use `switch-to-configuration **test**` rather than `switch` — `test` leaves the bootloader and system profile alone, so a DO `power_cycle` recovers the box and `journalctl -b -1` still has everything. The droplet given a real `switch` never came back from its power cycle; the one given `test` came back in under a minute. ### Filed, not fixed here — #710 The same baseline declares `fileSystems."/" = "/dev/disk/by-label/nixos"`, the label `make-disk-image` puts on the QEMU qcow2. A rented droplet's disko root is `/dev/vda1`, `PARTLABEL=disk-main-root`, with **no** filesystem label (`ls /dev/disk/by-label/` shows only `config-2`), and the deployed system's `/etc/fstab` really does read that missing device; its grub also drops the image's `efiSupport`/`efiInstallAsRemovable`. VMMode never reboots, so it bites the first restart **after** a drive, not the drive — a latent brick that changes what the box boots and wants its own live proof, so it gets its own `ready-for-session` ticket rather than a same-session second change. ### Housekeeping Both forensics droplets destroyed and the ephemeral DigitalOcean SSH key deleted; nothing left running. No `REHEARSAL_KEEP_RED_DROPLET` drive was needed in the end — the targeted rentals answered the question faster and more precisely than waiting for a red drive to reproduce. Ruled by agent under ADR 0174 — veto anytime. Two-way door throughout: one revertible render change, proven by a Go contract test, a real nix eval on the deploy rev, and a live before/after on rented droplets. No security-posture change — cloud-init was already running on these boxes, and #707's key pin rides along with it.
matou-build-agent 2026-08-23 16:49:21 +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#703
No description provided.