The rented gateway's deployed config declares the QEMU guest's root fs and grub — a rented droplet that reboots never comes back (follow-on to #703) #710

Closed
opened 2026-08-23 16:48:38 +00:00 by matou-build-agent · 1 comment

What

The rented (VMMode) gateway's deployed machine config declares a root filesystem
and a bootloader that only fit the QEMU guest image, not a rented
DigitalOcean droplet. VMMode never reboots (GOTCHAS #62), so this does not bite
the drive that deploys it — it bites the first restart after one, at which
point the box never comes back.

Found while settling #703's dark-box question live (GOTCHAS #64, commit
458d006a); deliberately left unfixed there because it changes what the box
boots and wants its own live proof, rather than riding a same-session second
change.

Evidence (live, 2026-08-23, droplets rented from snapshot idss-gateway-01eedc890405)

renderVMGuestBaseline (internal/clan/vmguest.go) — which the rented path
bakes verbatim via renderGatewayGuest, since enrollment.go's configure stage
takes the s.NodeConfig == nil branch for VMMode and renders no disko.nix —
declares:

boot.loader.grub = { enable = true; device = "/dev/vda"; };   # no efiSupport, no efiInstallAsRemovable
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; autoResize = true; };

by-label/nixos is the label make-disk-image puts on the QEMU guest's qcow2
(see flake.nix). On a live rented droplet:

$ blkid
/dev/vda1: UUID="0135a89f-…" TYPE="ext4" PARTLABEL="disk-main-root"
/dev/vda3: TYPE="vfat" PARTLABEL="disk-main-ESP"
$ ls /dev/disk/by-label/
config-2

There is no nixos label — the image's disko (nix/gateway-image/disko.nix)
mounts by PARTLABEL. And the built system really does carry the missing device:

$ grep / /nix/store/…-nixos-system-gateway-…/etc/fstab
/dev/disk/by-label/nixos / ext4 x-systemd.growfs,x-initrd.mount 0 1

The image's own grub block, by contrast, sets efiSupport = true and
efiInstallAsRemovable = true for exactly the hybrid BIOS+UEFI layout
disko.nix partitions — the deployed config drops both.

Corroborating (not isolating): the forensics droplet given a real
switch-to-configuration switch (bootloader + system profile updated) never
came back from a DigitalOcean power_cycle. That box's darkness is also
explained by #64's networking defect, so it does not by itself prove the
boot half — the blkid/fstab mismatch above is the direct evidence.

Why it matters

A community's rented gateway that reboots for any reason (provider maintenance,
an operator power-cycle, a kernel panic) lands in stage-1 waiting for a root
device that does not exist. This is GOTCHAS #47's failure shape reached by a
different route: #47 guards the image's disko against DiskoLayout
(TestGatewayImageDiskoMatchesRenderDisko, green), but the rented path never
renders DiskoLayout at all — it deploys the VM guest's by-label root instead,
which no test compares against the image.

Likely shape of the fix

Give the rented shape its own host-level facts instead of the QEMU guest's, the
way #703's fix gave it its own networking: on g.Public != nil, render the
root/boot facts the image actually has (by-partlabel/disk-main-root, the ESP
at /boot, grub with efiSupport + efiInstallAsRemovable), and add a
contract test that pins them against nix/gateway-image/disko.nix +
configuration.nix the way gateway_image_disko_test.go pins the takeover
layout — so the two can never drift silently again.

Must be proven live before it is believed: rent a droplet from the current
snapshot, deploy the changed config with switch-to-configuration switch, then
power_cycle it via the DigitalOcean API and confirm the box boots and answers
SSH. Note DigitalOcean exposes no console-log API — see GOTCHAS #64's method
note for how to keep the evidence when a box goes dark (stream logs off-box,
persistent journal, and use test rather than switch while probing).

## What The rented (VMMode) gateway's deployed machine config declares a root filesystem and a bootloader that only fit the **QEMU guest image**, not a rented DigitalOcean droplet. VMMode never reboots (GOTCHAS #62), so this does not bite the drive that deploys it — it bites the **first restart after** one, at which point the box never comes back. Found while settling #703's dark-box question live (GOTCHAS #64, commit `458d006a`); deliberately left unfixed there because it changes what the box boots and wants its own live proof, rather than riding a same-session second change. ## Evidence (live, 2026-08-23, droplets rented from snapshot `idss-gateway-01eedc890405`) `renderVMGuestBaseline` (`internal/clan/vmguest.go`) — which the rented path bakes verbatim via `renderGatewayGuest`, since `enrollment.go`'s configure stage takes the `s.NodeConfig == nil` branch for VMMode and renders no `disko.nix` — declares: ```nix boot.loader.grub = { enable = true; device = "/dev/vda"; }; # no efiSupport, no efiInstallAsRemovable fileSystems."/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; autoResize = true; }; ``` `by-label/nixos` is the label `make-disk-image` puts on the QEMU guest's qcow2 (see `flake.nix`). On a live rented droplet: ``` $ blkid /dev/vda1: UUID="0135a89f-…" TYPE="ext4" PARTLABEL="disk-main-root" /dev/vda3: TYPE="vfat" PARTLABEL="disk-main-ESP" $ ls /dev/disk/by-label/ config-2 ``` There is **no** `nixos` label — the image's disko (`nix/gateway-image/disko.nix`) mounts by PARTLABEL. And the built system really does carry the missing device: ``` $ grep / /nix/store/…-nixos-system-gateway-…/etc/fstab /dev/disk/by-label/nixos / ext4 x-systemd.growfs,x-initrd.mount 0 1 ``` The image's own grub block, by contrast, sets `efiSupport = true` and `efiInstallAsRemovable = true` for exactly the hybrid BIOS+UEFI layout `disko.nix` partitions — the deployed config drops both. Corroborating (not isolating): the forensics droplet given a real `switch-to-configuration switch` (bootloader + system profile updated) never came back from a DigitalOcean `power_cycle`. That box's darkness is also explained by #64's networking defect, so it does **not** by itself prove the boot half — the `blkid`/`fstab` mismatch above is the direct evidence. ## Why it matters A community's rented gateway that reboots for any reason (provider maintenance, an operator power-cycle, a kernel panic) lands in stage-1 waiting for a root device that does not exist. This is GOTCHAS #47's failure shape reached by a different route: #47 guards the image's disko against `DiskoLayout` (`TestGatewayImageDiskoMatchesRenderDisko`, green), but the rented path never renders `DiskoLayout` at all — it deploys the VM guest's by-label root instead, which no test compares against the image. ## Likely shape of the fix Give the rented shape its own host-level facts instead of the QEMU guest's, the way #703's fix gave it its own networking: on `g.Public != nil`, render the root/boot facts the image actually has (`by-partlabel/disk-main-root`, the ESP at `/boot`, grub with `efiSupport` + `efiInstallAsRemovable`), and add a contract test that pins them against `nix/gateway-image/disko.nix` + `configuration.nix` the way `gateway_image_disko_test.go` pins the takeover layout — so the two can never drift silently again. **Must be proven live before it is believed:** rent a droplet from the current snapshot, deploy the changed config with `switch-to-configuration switch`, then `power_cycle` it via the DigitalOcean API and confirm the box boots and answers SSH. Note DigitalOcean exposes no console-log API — see GOTCHAS #64's method note for how to keep the evidence when a box goes dark (stream logs off-box, persistent journal, and use `test` rather than `switch` while probing).
Author
Member

Close report — fixed and proven live

Ruled by agent under ADR 0174 — veto anytime. Two-way door: a revertible source change, proven by Go contract tests, a real nix eval of the rented gateway toplevel, and a live rent → switch → power-cycle round trip on two throwaway lab droplets. No personal credentials, no security-posture widening, no data destroyed, routine lab-droplet spend (two s-2vcpu-4gb in syd1 for ~30 minutes, both destroyed).

Commit b7ac77fd on main.

What landed

renderGatewayGuest's public branch (g.Public != nil, internal/clan/vmguest.go) now STRIPS the VM-guest baseline's boot.loader.grub block and its root-filesystem block, and splices rentedHostBoot() in their place — the boot-half sibling of #703's rentedHostNetworking:

fileSystems."/"     = { device = "/dev/disk/by-partlabel/disk-main-root"; fsType = "ext4"; };
fileSystems."/boot" = { device = "/dev/disk/by-partlabel/disk-main-ESP";  fsType = "vfat"; };
boot.loader.grub = { enable = true; efiSupport = true; efiInstallAsRemovable = true; device = "/dev/vda"; };

No autoResize, no boot.growPartition — the image declares neither; DigitalOcean grows the root partition at snapshot restore and cloud-init's growpart owns it thereafter. Confirmed against a live rented droplet's own fstab, which reads x-initrd.mount,defaults with no x-systemd.growfs.

The three baseline strips now go through a shared stripBaselineBlock, which panics naming the block rather than silently no-op'ing if the baseline text ever drifts (the existing port-line discipline, extended to the two new strips).

The PRIVATE VM guest is untouched — its disk really is the labelled qcow2 the baseline describes — and the warm-repo shape is byte-identical, so no closure churns.

The contract test

internal/clan/rented_boot_test.go → TestRentedGatewayBootFactsMatchTheImage reads the expected facts out of nix/gateway-image/disko.nix and nix/gateway-image/configuration.nix rather than restating them: it derives each mounted partition's PARTLABEL from disko's own disk-<disk>-<partition> scheme and pulls the grub block's attribute lines straight out of the image config. A rename, a reformat or a dropped ESP in the image now fails a Go test instead of a droplet. It is the boot-half sibling of #47's TestGatewayImageDiskoMatchesRenderDisko, closing exactly the gap the issue named: the rented path never renders DiskoLayout, so nothing compared what it deploys against what the image installed.

A sibling test pins the private VM guest's QEMU facts so #710's change can never leak onto that path.

Red before / green after. Full internal/clan and internal/founding suites, go vet, gofmt clean, plus TestRentedGateway_EvalSmoke run for real (IDSS_EVAL_SMOKE=1, 33s) — the changed render still evaluates as a NixOS toplevel drvPath.

Live proof — a controlled A/B

Two droplets rented from the current snapshot idss-gateway-c21a86f4facc (syd1). Both were switched (switch-to-configuration switch) onto the same host-level config — including #64's rentedHostNetworking block, so the networking variable is held constant — differing only in the root/boot declarations, then power-cycled through the DigitalOcean API in the same second (power_cycle completed 18:39:17Z / 18:39:18Z).

droplet root declaration fstab after switch after power_cycle
clan-lab-i710fix the fix: by-partlabel/disk-main-root + ESP at /boot /dev/disk/by-partlabel/disk-main-root / ext4 x-initrd.mount 0 1
/dev/disk/by-partlabel/disk-main-ESP /boot vfat defaults 0 2
back in 11 seconds
clan-lab-i710ctl today's baseline: by-label/nixos /dev/disk/by-label/nixos / ext4 x-systemd.growfs,x-initrd.mount 0 1
(no /boot line at all)
never came back

The fixed box, after the cycle:

$ journalctl --list-boots | tail -2
 -1 4879b5bf… Sun 2026-08-23 18:33:16 UTC  Sun 2026-08-23 18:38:44 UTC
  0 47c82bb2… Sun 2026-08-23 18:39:18 UTC  Sun 2026-08-23 18:46:39 UTC   <- a real new boot
$ readlink -f /run/booted-system
/nix/store/g91pgbzmlilf0kd359v693anx9ahjn24-nixos-system-gateway-…   <- the CHANGED toplevel
$ journalctl -b -k | grep disk-main-root
stage-1-init: checking /dev/disk/by-partlabel/disk-main-root...
stage-1-init: [fsck.ext4 (1) -- /mnt-root/] fsck.ext4 -a /dev/disk/by-partlabel/disk-main-root
$ systemctl --failed --no-legend      # (empty)
$ ls /boot/EFI/BOOT
BOOTX64.EFI                            <- efiInstallAsRemovable landed
$ ip route | head -1
default via 168.144.160.1 dev ens3 proto static

Ping and SSH both green. The control box at 10 minutes: DigitalOcean reports the droplet active, ping is 100% packet loss, SSH is Connection timed out. It never returned.

One confounder checked and cleared: cloud-final.service was already failed on the control box before its switch (pre-existing image behaviour, not caused by either config), and on the fixed box it passes after the reboot.

Both droplets destroyed (doctl compute droplet delete), no keys touched.

Docs

  • GOTCHAS #66 — full Symptom → Cause → Rule with the A/B table, plus a method note extending #64's: hold every other variable constant, switch both boxes in the same minute, power-cycle them together. DigitalOcean still exposes no console-log API, so a dark box proves only that it is dark; what makes it evidence is the twin that came back.
  • GOTCHAS #64's corollary paragraph ("Not fixed here … tracked separately") now points at entry 66.
  • STATUS.md header lead updated; #709 demoted to prior lead.

Closing.

## Close report — fixed and proven live **Ruled by agent under ADR 0174 — veto anytime.** Two-way door: a revertible source change, proven by Go contract tests, a real `nix eval` of the rented gateway toplevel, and a live rent → switch → power-cycle round trip on two throwaway lab droplets. No personal credentials, no security-posture widening, no data destroyed, routine lab-droplet spend (two `s-2vcpu-4gb` in syd1 for ~30 minutes, both destroyed). Commit `b7ac77fd` on `main`. ### What landed `renderGatewayGuest`'s public branch (`g.Public != nil`, `internal/clan/vmguest.go`) now STRIPS the VM-guest baseline's `boot.loader.grub` block and its root-filesystem block, and splices `rentedHostBoot()` in their place — the boot-half sibling of #703's `rentedHostNetworking`: ```nix fileSystems."/" = { device = "/dev/disk/by-partlabel/disk-main-root"; fsType = "ext4"; }; fileSystems."/boot" = { device = "/dev/disk/by-partlabel/disk-main-ESP"; fsType = "vfat"; }; boot.loader.grub = { enable = true; efiSupport = true; efiInstallAsRemovable = true; device = "/dev/vda"; }; ``` No `autoResize`, no `boot.growPartition` — the image declares neither; DigitalOcean grows the root partition at snapshot restore and cloud-init's `growpart` owns it thereafter. Confirmed against a live rented droplet's own fstab, which reads `x-initrd.mount,defaults` with no `x-systemd.growfs`. The three baseline strips now go through a shared `stripBaselineBlock`, which **panics naming the block** rather than silently no-op'ing if the baseline text ever drifts (the existing port-line discipline, extended to the two new strips). The PRIVATE VM guest is untouched — its disk really is the labelled qcow2 the baseline describes — and the warm-repo shape is byte-identical, so no closure churns. ### The contract test `internal/clan/rented_boot_test.go` → `TestRentedGatewayBootFactsMatchTheImage` reads the expected facts **out of** `nix/gateway-image/disko.nix` and `nix/gateway-image/configuration.nix` rather than restating them: it derives each mounted partition's PARTLABEL from disko's own `disk-<disk>-<partition>` scheme and pulls the grub block's attribute lines straight out of the image config. A rename, a reformat or a dropped ESP in the image now fails a Go test instead of a droplet. It is the boot-half sibling of #47's `TestGatewayImageDiskoMatchesRenderDisko`, closing exactly the gap the issue named: the rented path never renders `DiskoLayout`, so nothing compared what it deploys against what the image installed. A sibling test pins the private VM guest's QEMU facts so #710's change can never leak onto that path. Red before / green after. Full `internal/clan` and `internal/founding` suites, `go vet`, `gofmt` clean, plus `TestRentedGateway_EvalSmoke` run for real (`IDSS_EVAL_SMOKE=1`, 33s) — the changed render still evaluates as a NixOS toplevel `drvPath`. ### Live proof — a controlled A/B Two droplets rented from the current snapshot `idss-gateway-c21a86f4facc` (syd1). Both were switched (`switch-to-configuration switch`) onto the **same** host-level config — including #64's `rentedHostNetworking` block, so the networking variable is held constant — differing **only** in the root/boot declarations, then power-cycled through the DigitalOcean API in the same second (`power_cycle` completed 18:39:17Z / 18:39:18Z). | droplet | root declaration | fstab after switch | after `power_cycle` | |---|---|---|---| | `clan-lab-i710fix` | the fix: `by-partlabel/disk-main-root` + ESP at `/boot` | `/dev/disk/by-partlabel/disk-main-root / ext4 x-initrd.mount 0 1`<br>`/dev/disk/by-partlabel/disk-main-ESP /boot vfat defaults 0 2` | **back in 11 seconds** | | `clan-lab-i710ctl` | today's baseline: `by-label/nixos` | `/dev/disk/by-label/nixos / ext4 x-systemd.growfs,x-initrd.mount 0 1`<br>*(no `/boot` line at all)* | **never came back** | The fixed box, after the cycle: ``` $ journalctl --list-boots | tail -2 -1 4879b5bf… Sun 2026-08-23 18:33:16 UTC Sun 2026-08-23 18:38:44 UTC 0 47c82bb2… Sun 2026-08-23 18:39:18 UTC Sun 2026-08-23 18:46:39 UTC <- a real new boot $ readlink -f /run/booted-system /nix/store/g91pgbzmlilf0kd359v693anx9ahjn24-nixos-system-gateway-… <- the CHANGED toplevel $ journalctl -b -k | grep disk-main-root stage-1-init: checking /dev/disk/by-partlabel/disk-main-root... stage-1-init: [fsck.ext4 (1) -- /mnt-root/] fsck.ext4 -a /dev/disk/by-partlabel/disk-main-root $ systemctl --failed --no-legend # (empty) $ ls /boot/EFI/BOOT BOOTX64.EFI <- efiInstallAsRemovable landed $ ip route | head -1 default via 168.144.160.1 dev ens3 proto static ``` Ping and SSH both green. The control box at 10 minutes: DigitalOcean reports the droplet `active`, `ping` is 100% packet loss, SSH is `Connection timed out`. It never returned. One confounder checked and cleared: `cloud-final.service` was **already** `failed` on the control box **before** its switch (pre-existing image behaviour, not caused by either config), and on the fixed box it passes after the reboot. Both droplets destroyed (`doctl compute droplet delete`), no keys touched. ### Docs - **GOTCHAS #66** — full Symptom → Cause → Rule with the A/B table, plus a method note extending #64's: hold every other variable constant, switch both boxes in the same minute, power-cycle them together. DigitalOcean still exposes no console-log API, so a dark box proves only that it is dark; what makes it evidence is the twin that came back. - **GOTCHAS #64**'s corollary paragraph ("Not fixed here … tracked separately") now points at entry 66. - **STATUS.md** header lead updated; #709 demoted to prior lead. Closing.
matou-build-agent 2026-08-23 18:50:52 +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.

Dependencies

No dependencies set.

Reference
Matou/idss#710
No description provided.