Repository navigation
feat(vm): source.kind: iso — install a distro from its own installer, unattended - #8
Conversation
The fourth build engine, beside BuildCloudImage / BuildBootcVM /
BuildBootstrapVM. It is the SIMPLEST of the four, for a reason both
design passes on this feature got wrong: the installer needs no eject,
no detach and no second boot.
Boot the disk FIRST. An empty disk is not bootable, so the firmware
falls through to the installer on the first boot; once the installer has
written the disk, the disk boots and the ISO is never reached again.
Both cdroms stay attached forever, nothing detects the end of the
install, and the reinstall-forever failure mode is unreachable rather
than defended against. This is upstream Omarchy's own documented recipe
(--boot order='scsi0;ide2', the empty disk first, deliberately).
So BuildIsoVM does four things: fetch and verify the ISO via
kit.FetchArtifact, render the answers, write them to a labelled volume,
and allocate a blank disk. The install happens when the domain first
boots, which is vm create's job.
The DISTRO owns the answer FORMAT (its installer: block — which files,
in what syntax) and the VM ENTITY owns the DATA (this user, this disk,
these keys). installerSeedContext is the data half and knows nothing
about archinstall. A renderer that guessed the format from the distro
name is the failure validateSourceDistro's own comment records as having
burned this codebase already.
Three things that are guards rather than conveniences:
- the PLAINTEXT password is crypt()ed before it can reach the context,
which is all RenderInstallerSeed ever sees. It never lands on the
volume, in a rendered file or in a log. openssl passwd -6, shelled
out to deliberately: Go has no crypt(3), x/crypto has no SHA-crypt,
and charly carrying its own password-hashing primitive would be
strictly worse than a host tool. It is also the exact command the
upstream documentation gives operators.
- encrypt: true with only a password_hash is rejected. LUKS takes the
passphrase, not a hash, so that configuration cannot work — better a
build error than a guest halting at a prompt nobody can answer.
- no credential at all is rejected. An account with no password is
either unreachable or wide open depending on the distro, so charly
refuses to guess. defer_provisioning is the third, explicit option.
The SSH key default is BEST-EFFORT and warns rather than failing. The
first version propagated the resolver's error, which would have broken
every ISO build on a host with no ~/.ssh key — caught by its own test,
which is now the regression pin.
Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3
Review — BLOCKHead SHA: Change class: code change — new Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no unexpected supply-chain changes (sdk/spec bumps and module-path moves are consistent with the described sdk#193–195 / spec#71 deps). Blocks
Placement
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
#VmSource's iso arm declares kernel_args and BuildIsoVM does not implement it. Found by trying to use it: an install appeared to stall, I set console=ttyS0,115200 to get serial diagnostics, and the serial line stayed silent — because the field never reached anything. Implementing it means rewriting the boot configuration INSIDE a multi-GiB ISO: repacking the image, or extracting its kernel and initrd to boot them with -kernel/-initrd, which then diverges from how the medium actually boots. Neither is small, and nothing shipping today needs it. What is not acceptable is accepting the field and doing nothing. The operator reaching for kernel_args is, by construction, already debugging something — and they get exactly the silence they were trying to fix, then conclude the installer never started. That failure shape has cost this cutover real time TWICE today already: spec's ResolveInherits and plugin-distro's resolveDistro each silently dropped fields that every gate accepted. This is the third instance and it is being introduced on purpose, so it errors instead. The guard is a PRECONDITION, before the fetch: someone who set an unsupported field finds out in a second, not after downloading 5.8 GiB. A test asserts that ordering, not just the error. Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3
Review — BLOCKHead SHA: Change class: code change — new Security screen: PASS — no scope mismatch (all diff items map to the described feature), no secrets/exfiltration (plaintext password passed on stdin, never argv; hashed before reaching the render context), no weakened guardrails, no unexpected supply-chain changes (sdk/spec bumps and module-path moves consistent with the described sdk#193–195 / spec#71 deps). Blocks
Placement
Comment intake
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
An answer format states partition geometry as ABSOLUTE NUMBERS — archinstall indexes the partition's size key with no default and has no fill-remaining sentinel — and a seed rendered on the HOST cannot lsblk a disk that does not exist yet. So the number has to come from the vm entity, and spec#80 + sdk#196 built the two halves that carry and compute with it. UNCONDITIONAL, not "when set". The template arithmetic renders a NEGATIVE size from a zero value rather than failing (sdk asserts exactly that in its own test), so a missing number would not surface as an error anywhere — it would reach the installer as a plausible-looking wrong one and mis-partition a disk. parseDiskSizeBytes, the parser the bootstrap path already uses for the same string, rather than a second one (R3). An unparseable value is an error here rather than a silent zero, for the same reason. Two tests: the four suffix forms an operator actually writes (40G, 40GiB, 10240M, a bare byte count) all reach the context as the right byte count, and an unparseable value is rejected with the field named. Negative control: dropping the assignment fails the first with a readable got/want. Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3
Review — BLOCKHead SHA: Change class: code change — new Security screen: PASS — no scope mismatch (all diff items map to the described feature), no secrets/exfiltration (plaintext password hashed before reaching the render context, passed on stdin never argv), no weakened guardrails, no unexpected supply-chain changes (sdk/spec bumps and module-path moves consistent with the described deps). Blocks
Placement
Comment intake
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (all 9 diff items map to the described feature), no secrets/exfiltration (plaintext password hashed before reaching the render context, passed on stdin never argv), no weakened guardrails, no unexpected supply-chain changes (sdk/spec bumps and module-path moves consistent with the described sdk#193–195 / spec#71 deps). Checklist: All applicable rules PASS or NA. Prior-review findings re-derived against the CURRENT body/diff:
R2 issues surfaced are routed to named tasks (distro-omarchy#4, charly#488, plugin-distro#6, spec#79), not vague deferrals. Placement CORRECT — all capability code lives in the Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
…uild it (#497) `charly vm build omarchy-vm` fails on main: charly: error: command "vm": vm "omarchy-vm": unsupported source.kind "iso" (want one of cloud_image, bootc, bootstrap) and `charly check run check-omarchy-iso-vm` therefore dies at its first step, [vm-build], after 637ms. The bed cannot assert anything. ## Root cause `source.kind: iso` is implemented in plugin-vm and landed in opencharly/plugin-vm#8, first tagged `v0.2026242.1242`: v0.2026242.812 var knownVmSourceKinds = []string{"cloud_image", "bootc", "bootstrap"} v0.2026242.1242 var knownVmSourceKinds = []string{"cloud_image", "bootc", "bootstrap", "iso"} charly/go.mod required `v0.2026242.812` — the version immediately BEFORE it. charly#495 and #496 advanced the `box/omarchy` gitlink to a distro-omarchy that ships `omarchy-vm` (`source.kind: iso`) and `check-omarchy-iso-vm`, but neither bumped the plugin-vm require. So charly gained the ENTITIES that need the capability without gaining the capability. Nothing caught it: the entity is data, `charly box validate` checks it against the schema (which has the iso arm, from spec#71), and the rejection only happens at `vm build` time inside the plugin — a path no unit test and no CI job exercises. This is the "partial repin" class: a gitlink advanced while its consumer's own dependency pin stayed put, and the two only disagree at runtime. ## The fix Bump to the newest published plugin-vm, `v0.2026242.1912`, which also carries the per-domain serial log (#15) that makes a headless guest's console readable. `go get` also resolved sdk from a pseudo-version onto a released tag — `v0.2026242.914-0.20260830150119-f476722d55eb` → `v0.2026242.1217` — which is a strict improvement: an untagged commit pin becomes a released one. ## How tested Before, on a `task build:binary` of main: $ charly vm build omarchy-vm charly: error: ... unsupported source.kind "iso" ... [exit 1] After, same command, same tree, rebuilt: $ charly vm build omarchy-vm Building VM "omarchy-vm" (source.kind=iso) ... Disk .../omarchy-vm/disk.qcow2 is content-fresh (installer sha256=69cbb4e10d98ad831c3c9f245b5757a9d1fedfd0c9592780e977d6f950dea8c3) Wrote .../omarchy-vm/disk.qcow2 (blank — the installer partitions it) Wrote .../omarchy-vm/seed.iso (answers: authorized_keys, user_configuration.json, user_credentials.json, user_email_address.txt, user_full_name.txt) [exit 0] Full unit suite from the module dir, uncached, complete output: $ go test -count=1 ./... ok github.com/opencharly/charly/charly 91.423s ok github.com/opencharly/charly/charly/internal/pluginsgen 27.047s [exit 0] $ task build:binary [exit 0] (go.work.sum unchanged — the tracked-checksum guard did not trip) Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3 Co-authored-by: atrawog <[email protected]>
Summary
Implements
source.kind: iso— building a VM by running a distro's own officialinstaller.
BuildIsoVMis the fourth build engine besideBuildCloudImage/BuildBootcVM/BuildBootstrapVM, plus the resolve arm, the dispatch arm, and thelibvirt attachment.
Schema from spec#71; renderer from sdk#193; fetcher from sdk#194; runtime attachment from
sdk#195. This is the consumer that makes them a working feature.
It is the simplest of the four engines, and that is the finding
Both earlier design passes assumed the installer had to be ejected or detached when it
finished, and specified machinery to detect that moment. None of it is needed:
the installer.
Both cdroms stay attached forever and the reinstall-forever failure mode is unreachable
rather than defended against. This is upstream Omarchy's own documented recipe
(
--boot order='scsi0;ide2'— the empty disk first, deliberately).The split: distro owns the FORMAT, vm entity owns the DATA
installerSeedContextis the data half and knows nothing about archinstall. A rendererthat guessed the format from the distro name is the failure
validateSourceDistro's owncomment records as having burned this codebase.
Guards, not conveniences
The plaintext password is
crypt()ed before it can reach the context, which is allRenderInstallerSeedever sees.openssl passwd -6deliberately: Go's stdlib has nocrypt(3),x/cryptohas no SHA-crypt, and charly carrying its own password-hashingprimitive would be worse than a host-tool dependency. Passed on stdin, never argv, so
it is not visible in
ps.encrypt: truewith only apassword_hashis rejected — LUKS takes the passphrase, nota hash, so that configuration cannot work.
No credential at all is rejected — an account with no password is either unreachable or
wide open depending on the distro.
defer_provisioningis the third, explicit option.kernel_argsis rejected, not ignored — see below.How tested
The changed code paths were executed LIVE, against a real 5.8 GiB Omarchy ISO and a real
libvirt domain. A previous revision of this body claimed
fully tested and validatedongo testalone and was correctly BLOCKed for it; this run is the answer to that.The binary was built from this branch plus the unmerged charly#485 (the omarchy
installer:block, without which no seed renders at all). Thosereplacedirectives areworking-tree only and are not in any commit here —
grep -c '^replace'on the committedgo.modis 0. The run is reproducible from two public refs,plugin-vm@98077d9+charly@5401b6f2, but not from this tree alone, which is why the tier below isanalysed on a live systemrather than the full one.1 —
charly vm build omarchy-vm(the engine, end to end)FetchArtifactdownloaded and sha256-verified the ISO into the content-addressed cacheunder the
.isoextension, resolving the checksum from the.sha256sidecar (no checksumvalue was authored).
The answers volume, inspected on disk:
Label case preserved, Rock Ridge long names intact (the installer reads these, not the 8.3
forms), and exactly the five files the
when:guards should emit for an unencrypted,non-deferred install with keys.
The password never reached the volume in plaintext —
user_credentials.jsonas written:{ "root_enc_password": "$6$a6/YhahdrEulp/Un$UcHaTGFNyV6qsz6dRF5aKHuGGUsi5pF3802Fle…", "users": [ { "enc_password": "$6$a6/YhahdrEulp/Un$UcHaTGFNyV6qsz6dRF5aKHuGGUsi5pF3802Fle…", "groups": [], "sudo": true, "username": "user" } ] }The disk is blank and sparse, as an installer needs:
2 —
charly vm create omarchy-vm(the libvirt attachment)The live domain XML — boot order and both cdroms:
Disk-then-cdrom, both cdroms on distinct targets, blank
vda. Exactly what the unit testsassert, now confirmed against a real libvirt domain rather than a rendered string.
3 — the guest booted the ISO and consumed the seed
Console screenshot of the running domain:
The firmware fell through the blank disk to the installer ISO, the Omarchy live environment
booted, and cloud-init ran against the
cidatavolume charly rendered. That is thewhole boot-order mechanism working, observed rather than argued.
4 — THE INSTALL COMPLETED
An earlier revision of this body reported the guest booting the medium but the installer
never starting, and claimed only
analysed on a live systemfor it. That has since beenroot-caused and fixed, and the install now runs to completion.
The stall was not in this engine. It was three defects in the answers this engine
renders — charly's
installer:templates omitting keys archinstall indexes with no default(
sector_size,mount_options) and a#comment inside a YAML block scalar landing in theJSON. All three surfaced only on the guest's tty1, behind the ISO's
quiet splashcmdline,and all three are fixed in charly#485.
With those fixed, from a seed this engine built:
The guest rebooted from disk into its own greeter — a graphical password prompt, where
the live ISO instead autologins to a root shell — and
user/user, the credentials thisengine hashed to
$6$, logged in to a working Omarchy desktop: Hyprland with the Quickshellbar, workspaces, clock, tray, wallpaper and the first-run cards.
Both cdroms stayed attached the whole time and nothing ejected anything. That is the
disk-first boot order doing exactly what it was designed to do, observed rather than argued:
blank disk falls through to the installer, installed disk boots, ISO never reached again.
Omarchy's own
omarchy-cidata-loadaccepted this engine's volume without modification:One thing this run did surface that is not fixed and is filed rather than papered over:
at BOOT the ISO's
.automated_script.shdoes not find the cidata drive (itsudevadm settledoes not cover the enumeration of a SATA cdrom that has not been queued yet), fallsback to the interactive wizard, and exits. Running the same entry point a minute later
succeeds — which is how the install above was driven. That is an Omarchy ISO race, not this
engine, and it is opencharly/distro-omarchy#4 with the full evidence.
4 — a defect in this PR's own code, found by that attempt
#VmSource's iso arm declareskernel_argsandBuildIsoVMdid not implement it. I setconsole=ttyS0,115200to get serial diagnostics on the stalled install and the serial linestayed silent — because the field reached nothing.
Implementing it means rewriting the boot config inside a multi-GiB ISO. Nothing shipping
needs that. But accepting the field and doing nothing is not an option: the operator
reaching for
kernel_argsis by construction already debugging, and gets exactly thesilence they were trying to fix.
That failure shape cost this cutover real time twice today (spec#79 and plugin-distro#6,
both silent field drops). So it now errors, as a precondition before the fetch — a test
asserts that ordering, so nobody waits on a 5.8 GiB download to learn their field is
unsupported.
5 — unit tests and negative controls
17 new tests — 15 in
vm_iso_seed_test.go, 2 inlibvirt_installer_iso_test.go.Two earlier revisions of this body got this number wrong (11, then 15). Both were caught by
the validator, and the second was wrong because the count was pasted from a
greprunBEFORE the last two tests were added. Taken from the committed tree:
They call
installerSeedContextandBuildIsoVM— the functions production calls — not acopy of the mapping.
R9 — the openssl dependency
hashPasswordSHA512shells out toopenssl passwd -6, which is a new runtime OSdependency of the charly binary. It is declared in opencharly/charly#488, which adds
opensslto all four realdependslists (archlinux, rpm, deb, apk) — it cannot bedeclared from this repo, since
packaging:lives on charly's own candy.depends, notoptdepends: an operator authoringinstaller.passwordwithout openssl getsa hard failure with no hash, and meets it only after a multi-GiB ISO download.
Seven negative controls, each confirmed to fail the intended test:
the PLAINTEXT password reached the seed context — it would land on the answers volume verbatiman installer with no password, password_hash or defer_provisioning must be an errorencrypt: true with only a password_hash must be an error — LUKS needs the passphrase, not a hashkernel_argsinsteadsource.kernel_args must be rejected for iso VMs while it is unimplementedboot order is cdrom-first — the guest would reinstall over itself on every bootthe two cdroms must have distinct targets (sda, sdb)a VM with no installer must not gain a cdrom boot deviceThe last is the important one: a boot-order change leaking into every existing
cloud_image/bootc/bootstrapVM would be a serious regression hiding inside afeature addition.
Full suite,
-count=1, complete output:go build ./...,go vet ./...andgofmt -l .all clean.Two defects in OTHER repos that this work uncovered
Both were found by running
charly vm build, and both are silent drops of the same class:resolveDistro's hand-written field copy droppeddisk_layoutandinstaller.ResolveInheritsdroppedDiskLayout,Installer,InheritPackagesandRawon every distro with a parent.Together they meant the btrfs subvolume feature has been inert since it merged (spec#72,
plugin-vm#6, plugin-vm#7, charly#476 — all green, all doing nothing). Both fixes ship with
field-walking parity guards.
This PR depends on both. Until they merge,
charly vm buildon an iso source reportsdistro "omarchy" declares no installeragainst a distro that plainly declares one.Rulebook compliance
vm buildfailure was chased through two repos(plugin-distro#6, spec#79) rather than worked around at the first layer that would have
hidden it. The install stall was root-caused to three defects in the answers, not in
this engine, and each is named with the exact error the installer printed.
build engine, the resolve arm, the dispatch arm and the libvirt attachment. The
knownVmSourceKindslist and thedefault:error message were both updated so no pathstill claims three kinds.
kernel_argsis the one declared field this engine does notimplement, and it is rejected rather than deferred silently.
FetchArtifactrather than a second downloader,RenderInstallerSeedrather than an omarchy-specific renderer,parseDiskSizeBytesrather than a second size parser, the existing cdrom attachment path rather than a
parallel one.
qemuImgCreateBlankis genuinely new: no existing helper creates a diskwith no backing file.
files. The disk-first boot order makes the terminating condition structural.
kernel_argsis the test of this rule: rather thandocument it as a limitation, it now errors with the reason, so nobody authors a field
that does nothing. Implementing it means repacking a multi-GiB ISO and is filed as such.
installerSeedDigesthelper was writtenand then deleted rather than shipped unused.
git statusinspected before each commit; the devreplaceon sdkwas dropped and replaced with a published pin before committing (
grep -c '^replace'= 0in the committed
go.mod). No force-push, no direct push tomain.intended test — including one where the test PASSED with the behaviour deleted and had to
be rewritten. Plus a live build, a live create, the real domain XML, and a completed
install.
domain XML, and both are validated at their real boundary:
isoinfo/blkidon thewritten ISO,
virsh dumpxmlon the defined domain, and Omarchy's ownomarchy-cidata-loadaccepting the volume (LOADRC=0).task build:binary's ownsteps from this branch, and
openssl— the one new runtime OS dependency, fromhashPasswordSHA512— is declared in fix(packaging): declare openssl — plugin-vm shells out to it charly#488, sincepackaging:lives oncharly's candy and cannot be edited from here. The binary additionally carried unmerged
charly#485, without which the seed cannot render; see the tier note.
freshly created domain and a fresh 40 GiB qcow2, destroyed and undefined afterwards. All
seven negative controls ran against deliberately broken trees restored from backups. It
is NOT yet a
disposable: truebed —check-omarchy-iso-vmis blocked ondistro-omarchy#4, the ISO's boot-time cidata race.
Change classification
go test -count=1 ./...+ seven negative controls, plus a livevm build/vm createcycle with the ISO, seed volume, disk and domain XML inspectedanalysed on a live system— every changed path ran live with retained output and the end product installed itself unattended, but the proof binary also carried the unmerged charly#485 (without which the seed cannot render), so it is not reproducible from this tree alone. Reproducible from two public refs:plugin-vm@98077d9+charly@5401b6f2.check-omarchy-iso-vmindistro-omarchystill has to wrap this in adisposable: truebed; it is blocked on distro-omarchy#4 (the boot-time cidata race), because a bed cannot
type a command on tty1.
Assisted-by: Claude Code claude-opus-4-6-20260401 (analysed on a live system)