founding: guest base image — reproducible x86_64 NixOS qcow2 the VM manager boots (split from #196) #216

Closed
opened 2026-07-31 00:18:35 +00:00 by ben · 1 comment
Owner

Parent

Split out of #196 (Ben confirmed 2026-07-30) — the same not-a-single-slice logic as the #191 split: the guest image is buildable today and gates #183's Phase A rehearsal, while #196's carriage ADR is a human decision the image doesn't need.

What's true today

  • The VM manager (#192/#195) boots a guest whose disk backs onto a per-arch NixOS base image (vm.Config.BaseImage, resolved from OURCLOUD_GUEST_IMAGE else <StateDir>/nixos-guest.qcow2), and fails loud legibly when it is absent — but nothing in the repo produces that image. Phase A of #183 cannot boot a VM at all.
  • The clan adapter's VM-mode enroll converges an already-reachable NixOS host (clan machines update — the #191 investigation's finding), so the image must boot to a reachable NixOS the established trust can drive.

What to build

A reproducible recipe (a flake output beside the dev shell, ADR 0040) that builds the x86_64 NixOS guest base image as a qcow2:

  1. Boots headless under the VM manager's QEMU shape (virtio disk/net, KVM accel) to a minimal NixOS.
  2. Reachable for the established trust so the clan-driven converge can take it from there (the enroll seam's contract) — the image carries no per-community secrets or identity; everything identifying is minted at enroll/converge time.
  3. Output lands where the resolution looks: documented copy to OURCLOUD_GUEST_IMAGE / the state-dir default (the packaged-app carriage is #196's).
  4. aarch64 is documented-deferred per the standing multi-arch ruling (ADR 0030's open question) — the recipe should be arch-parametric but only x86_64 is built and proven now.

Acceptance criteria

  • Given the recipe, When built on the pinned toolchain, Then it reproducibly outputs the x86_64 nixos-guest.qcow2
  • Given the image placed per the resolution order, When vm.Manager.Create runs on a KVM-capable host, Then the guest boots, is reachable, and a clan-driven converge can proceed against it
  • Given the image, When inspected, Then it contains no community identity, secrets, or credentials — a blank slate the enroll mints onto
  • Given a host without the image, When the private path is driven, Then the existing legible fail-loud is unchanged

Task manifest

task: founding:guest-base-image
implements_seam: "vm.Config.BaseImage contract (#192/#195) + the clan VM-mode enroll's already-reachable-NixOS precondition; recipe as a flake output (ADR 0040)"
interface: "the built qcow2 artifact + its build command"
seam: "boot the built image under the VM manager's QEMU shape; prove reachability"
acceptance:
  - given: the pinned toolchain; when: the recipe builds; then: a bootable, reachable, secret-free x86_64 guest image the VM manager accepts
depends_on: []
out_of_scope: [the carriage ADR and packaged-app bundling (#196), aarch64 build (documented-deferred), gateway-cache serving of the artifact (ADR 0054, post-gateway)]
needs_human_decision: []

Blocks

#183 — Phase A leg A·1 (nothing boots without it).

## Parent Split out of #196 (Ben confirmed 2026-07-30) — the same not-a-single-slice logic as the #191 split: the guest image is buildable today and gates #183's Phase A rehearsal, while #196's carriage ADR is a human decision the image doesn't need. ## What's true today - The VM manager (#192/#195) boots a guest whose disk backs onto a per-arch NixOS base image (`vm.Config.BaseImage`, resolved from `OURCLOUD_GUEST_IMAGE` else `<StateDir>/nixos-guest.qcow2`), and fails loud legibly when it is absent — but **nothing in the repo produces that image**. Phase A of #183 cannot boot a VM at all. - The clan adapter's VM-mode enroll converges an **already-reachable NixOS host** (`clan machines update` — the #191 investigation's finding), so the image must boot to a reachable NixOS the established trust can drive. ## What to build A reproducible recipe (a flake output beside the dev shell, ADR 0040) that builds the **x86_64 NixOS guest base image** as a qcow2: 1. Boots headless under the VM manager's QEMU shape (virtio disk/net, KVM accel) to a minimal NixOS. 2. Reachable for the established trust so the clan-driven converge can take it from there (the enroll seam's contract) — the image carries **no per-community secrets or identity**; everything identifying is minted at enroll/converge time. 3. Output lands where the resolution looks: documented copy to `OURCLOUD_GUEST_IMAGE` / the state-dir default (the packaged-app carriage is #196's). 4. aarch64 is documented-deferred per the standing multi-arch ruling (ADR 0030's open question) — the recipe should be arch-parametric but only x86_64 is built and proven now. ## Acceptance criteria - [ ] Given the recipe, When built on the pinned toolchain, Then it reproducibly outputs the x86_64 `nixos-guest.qcow2` - [ ] Given the image placed per the resolution order, When `vm.Manager.Create` runs on a KVM-capable host, Then the guest boots, is reachable, and a clan-driven converge can proceed against it - [ ] Given the image, When inspected, Then it contains no community identity, secrets, or credentials — a blank slate the enroll mints onto - [ ] Given a host without the image, When the private path is driven, Then the existing legible fail-loud is unchanged ## Task manifest ```yaml task: founding:guest-base-image implements_seam: "vm.Config.BaseImage contract (#192/#195) + the clan VM-mode enroll's already-reachable-NixOS precondition; recipe as a flake output (ADR 0040)" interface: "the built qcow2 artifact + its build command" seam: "boot the built image under the VM manager's QEMU shape; prove reachability" acceptance: - given: the pinned toolchain; when: the recipe builds; then: a bootable, reachable, secret-free x86_64 guest image the VM manager accepts depends_on: [] out_of_scope: [the carriage ADR and packaged-app bundling (#196), aarch64 build (documented-deferred), gateway-cache serving of the artifact (ADR 0054, post-gateway)] needs_human_decision: [] ``` ## Blocks #183 — Phase A leg A·1 (nothing boots without it).
Author
Owner

Done in 11e4a72 (on origin/main).

The repo now produces the qcow2 vm.Config.BaseImage resolves to (#192/#195) — a reproducible flake output (.#guest-image over nix/guest/configuration.nix, ADR 0040) that bakes a minimal blank-slate x86_64 NixOS into a legacy-BIOS qcow2.

  • Boots the VM manager's shape (AC §1/§2): qemu-guest virtio initrd, virtio disk/net, KVM, serial ttyS0 (-nographic), DHCP over the user-mode virtio NIC. Legacy BIOS (grub→MBR of /dev/vda) matches the manager's default SeaBIOS (ADR 0056).
  • Blank slate (AC §3): no community identity/secret/credential — generic hostname, root only, no baked SSH key. Reachability is minted-never-baked: sshd root-login-by-key-only, and the ourcloud-enroll-trust oneshot installs root's authorized key at first boot from QEMU fw_cfg (opt/ourcloud/authorized_key) — what the enroll/converge shape hands in. Absent → honestly unreachable, the blank slate the clan machines update already-reachable precondition (#191) mints onto.
  • Placement (resolution order): scripts/build-guest-image.sh builds on the pinned toolchain and installs nixos.qcow2 to OURCLOUD_GUEST_IMAGE else /var/lib/ourcloud/vm/nixos-guest.qcow2.
  • Fail-loud unchanged (AC §4): internal/vm/manager.go untouched.
  • aarch64 documented-deferred (ADR 0030): arch-parametric (nixosConfigurations.ourcloud-guest-{x86_64,aarch64}), only x86_64 built/proven.

The build + boot + reachability proof is driver-gated (needs a Nix builder + /dev/kvm, no swarm substrate carries either — same posture as scripts/smoke-vm.sh, #192): scripts/smoke-guest-image.sh boots the built image under the virtio/KVM shape twice — reachable with a per-run trust key minted through fw_cfg (prints nixos-version), SSH-refused with none (blank slate). Docs: docs/founding/guest-base-image.md.

Unblocks #183 Phase A leg A·1.

Done in `11e4a72` (on `origin/main`). The repo now produces the qcow2 `vm.Config.BaseImage` resolves to (#192/#195) — a reproducible flake output (`.#guest-image` over `nix/guest/configuration.nix`, ADR 0040) that bakes a minimal blank-slate x86_64 NixOS into a legacy-BIOS qcow2. - **Boots the VM manager's shape** (AC §1/§2): `qemu-guest` virtio initrd, virtio disk/net, KVM, serial `ttyS0` (`-nographic`), DHCP over the user-mode virtio NIC. Legacy BIOS (grub→MBR of `/dev/vda`) matches the manager's default SeaBIOS (ADR 0056). - **Blank slate** (AC §3): no community identity/secret/credential — generic hostname, root only, **no baked SSH key**. Reachability is minted-never-baked: sshd root-login-by-key-only, and the `ourcloud-enroll-trust` oneshot installs root's authorized key at first boot from QEMU fw_cfg (`opt/ourcloud/authorized_key`) — what the enroll/converge shape hands in. Absent → honestly unreachable, the blank slate the clan `machines update` already-reachable precondition (#191) mints onto. - **Placement** (resolution order): `scripts/build-guest-image.sh` builds on the pinned toolchain and installs `nixos.qcow2` to `OURCLOUD_GUEST_IMAGE` else `/var/lib/ourcloud/vm/nixos-guest.qcow2`. - **Fail-loud unchanged** (AC §4): `internal/vm/manager.go` untouched. - **aarch64** documented-deferred (ADR 0030): arch-parametric (`nixosConfigurations.ourcloud-guest-{x86_64,aarch64}`), only x86_64 built/proven. The build + boot + reachability proof is **driver-gated** (needs a Nix builder + `/dev/kvm`, no swarm substrate carries either — same posture as `scripts/smoke-vm.sh`, #192): `scripts/smoke-guest-image.sh` boots the built image under the virtio/KVM shape twice — reachable with a per-run trust key minted through fw_cfg (prints `nixos-version`), SSH-refused with none (blank slate). Docs: `docs/founding/guest-base-image.md`. Unblocks #183 Phase A leg A·1.
ben closed this issue 2026-07-31 00:41:33 +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.

Reference
Matou/idss#216
No description provided.