rented gateway: enroll-activate restarts the whole cloud-init unit set on an already-initialised box — the concurrent stages race /var/lib/cloud/instance into a real directory and poison cloud-init permanently #892
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
Matou/idss#892
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Drive
20260827T065053Zred at legstanding/ journey legenroll-activate(sig25304f657c24), commit5d64bee7. This is the furthest a device drive has reached —wizard-rentthroughenroll-copyall green (artifacts/legs.json), so the #884/#885 prefix work and the prior heal hold. The fault is new and it is real: the masked_exit detector is behaving correctly here.Failure
artifacts/legs.json(legenroll-activate, 235022ms),artifacts/verdict.json(firstRedLeg: standing, 11 green / 2 red),logs/founding-state.log(theenroll-activatestage events and the terminalfault).Mechanism — proven on the box, timestamp by timestamp
The standing gateway is never released on a device drive (
scripts/smoke-private-path.sh:643-650), so168.144.173.213is still up. Its journal, read over the app's rent-operator key (test-results/standing-rented/state/rent-operator/id_ed25519), pins the race exactly:switch-to-configurationrestartscloud-init-local(2110) andcloud-config(2113) concurrentlycloud-finalandcloud-init(2304) start too — all four stages in flight at onceCreating symbolic link from '/var/lib/cloud/instance' => '/var/lib/cloud/instances/595525745'/var/lib/cloud/instancebirth as a directory (stat -c %w→2026-08-27 07:03:58.281330793)Writing to /var/lib/cloud/instance/obj.pkl—write_file'sensure_dir()is what made it a dirinstances/iid-datasource-none/sem/{config_mounts,config_set_passwords,config_ssh}— a second cloud-init that resolved no datasource and whose own_reflect_cur_instanceunlinked the symlink in the gapdel_file(instance_link)→os.unlink()on a directory →IsADirectoryError,cloud-init.serviceexits 2cloud-final(2301) writesboot-finishedinto the directory, cementing itcloud-init.service, identical crashUpstream path:
cloudinit/stages.py:469(_reflect_cur_instance→util.del_file(self.paths.instance_link)) →cloudinit/util.py:2072(os.unlink). cloud-init 25.2,cloudinit.distros.nixos.Distro,DataSourceConfigDrive [net,ver=2][source=/dev/vdb]._reflect_cur_instanceis unlink-then-symlink with no lock. Any concurrent stage that writes throughinstance_linkin that window recreates the path as a plain directory — and from then on the box is permanently poisoned: every subsequentcloud-init initcrashes on the same line.Suspected layer
The deployed rented-gateway config keeps the full cloud-init unit set enabled:
internal/clan/vmguest.go:361-375—rentedHostNetworking()splicesnetworking.useNetworkd = trueplusservices.cloud-init = { enable = true; network.enable = true; settings.ssh_deletekeys = false; }state/clan-config/machines/gateway/gateway-guest.nix:155-165(the captured flake for this run)Because the community generation resolves a different cloud-init store path than the golden image, activation sees all four units as changed and restarts them — concurrently, on a box whose cloud-init completed at 06:52. Re-running the init/config/final stages against already-written state is what opens the race. This will recur on every converge onto a rented droplet, not just this one.
GOTCHAS #64 / #703 is why the block exists, but read it closely: the load-bearing half is
networking.useNetworkd = true— cloud-init's/etc/systemd/network/10-cloud-init-ens3.networkis a runtime file in/etcthat activation does not touch, so the address and default route survive without cloud-init re-running. Theservices.cloud-inithalf is what re-runs and poisons. Note the guarding testinternal/clan/vmguest_test.go:45(TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit) asserts all five lines are present, so it must move with any change.What plugging it needs
networking.useNetworkd = trueand dropservices.cloud-initfrom the deployed config, relying on the already-written.networkfile as GOTCHAS #64 itself describes — verify live that the default route survives activation; (b) keep cloud-init declared but make the units not restart on switch (restartIfChanged = false/X-RestartIfChanged=falseon the four units); (c) leave the units but make the state idempotent. (a) and (b) both need a live converge to prove; (b) is the smaller step and does not touch #64's ruling at all, so it is probably where to start.168.144.173.213hascloud-init.serviceinfailedright now and/var/lib/cloud/instanceas a directory holdingboot-finished+obj.pkl. Until it is replaced with a symlink to/var/lib/cloud/instances/595525745(whose real contents are intact), every re-drive that adopts this standing community reds atenroll-activateagain — the box is the fault, not the code path under test. Either repair on-box or re-found the standing community.scripts/smoke-private-path.sh:623-650takes thetarget == devicebranch, which runsoc_device_teardownand gathers no droplet-side evidence at all — it never readsartifacts/droplet-ip.txt(written byapp/tests/e2e/fixtures/rentedPrefix.ts:291) nor setsOC_E2E_DROPLET_IP. Therentedbranch at:651-661does exactly that beforeoc_rented_cleanup. Result: the run dir has nologs/droplet-journal.txtdespite the prompt naming one, and the whole mechanism above was only recoverable because the standing gateway happens to outlive the drive.oc_droplet_gather_evidence(scripts/lib/rehearsal-droplet.sh:425-470) already does the work; the device branch just needs to reach it.The masked_exit detector needs no change:
logSaysFailed(internal/clan/errors.go:268-345) correctly refused to exempt a line where two systemd units genuinely failed.drive
20260827T065053Zred atstanding: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] Failed to start cloud-initevidence:
/home/swarm/swarm/Matou/idss/test-results/drive-device/20260827T065053Zon matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was capturedclose-report for #892 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope