Commit Graph
104 Commits
Author SHA1 Message Date
vhaudiquet 6a631a3707 docs: document macOS support and Homebrew distribution
SPEC records the two macOS facts the code bends around (bare-soname
dlopens needing startup-time DYLD paths; the hypervisor entitlement)
and the packaging decisions; README gains the brew install and the
from-source sign step.
2026-10-31 18:10:33 -05:00
vhaudiquet ff73624891 build: add the macOS gate, darwin artifacts, and a Homebrew formula
CI runs fmt/clippy/test plus a real alpine boot on a macos-26 runner
with libkrun from the krun tap; the release workflow ships a signed
darwin-arm64 tarball beside the snaps. The formula installs from the
tap, carries the runtime kegs (libkrun, e2fsprogs, libarchive), and
codesigns the binary with the hypervisor entitlement — Hypervisor
.framework grants VM creation only to entitled binaries on current
macOS, the same requirement krunkit's formula signs for.
2026-10-31 18:10:33 -05:00
vhaudiquet f963578152 feat(cli): re-exec with DYLD fallback paths set
The engine's dlopen of libkrunfw and mke2fs's of libarchive use bare
sonames, and dyld reads DYLD_FALLBACK_LIBRARY_PATH once, at process
startup — a setenv afterwards is invisible to it. When the variable
is unset and the brew kegs exist, the CLI sets it and execv's itself:
exec restarts dyld, which reads the variable fresh. Library consumers
set the variable before their process starts instead (SPEC.md).
2026-10-31 18:10:33 -05:00
vhaudiquet 92ff76a1b6 test(rootfs): pin the arch and locate the keg tools
The cache-seeding tests seeded entry names under amd64 but resolved
the request against the host arch, so on an arm64 host the lookup
missed and the tests walked into the network path. Requests now pin
arch, matching the seeded names on any host. The tool gate uses
find_tool: on macOS the e2fsprogs binaries are keg-only, never on
PATH.
2026-10-31 18:10:32 -05:00
vhaudiquet 84ccff0157 feat(image): populate the image from a tree when mke2fs lacks libarchive
mke2fs built against libarchive populates an ext4 from a tarball in
one pass; Homebrew's bottle is not built that way, so when the found
mke2fs cannot take a tarball the builder unpacks the rootfs with the
library's own tar decoder and populates from the directory — slower,
and the run says so. The mkfs child is exec'd fresh, so it reads
DYLD_FALLBACK_LIBRARY_PATH (libarchive's keg) at startup.
2026-10-31 18:10:32 -05:00
vhaudiquet e075d52f91 feat(krun): run the library on macOS
The engine is libkrun.1.dylib, dlopen'd from the Homebrew kegs when
the loader's own search fails (bare sonames never reach the brew
prefix); the probe becomes a per-platform hypervisor probe — KVM on
Linux, sysctl + a real hv_vm_create on macOS, so an entitlement
denial (HV_DENIED) names the re-sign fix instead of surfacing as an
opaque krun_start_enter EINVAL. Tool lookup (mke2fs, debugfs) gains
the same keg fallback, and dyld_fallback_dirs() collects the kegs the
bare-soname dlopens (libkrunfw, libarchive) need in
DYLD_FALLBACK_LIBRARY_PATH. The machine child's parent-death contract
moves to a kqueue NOTE_EXIT watcher: macOS has no PR_SET_PDEATHSIG,
and SIGKILL-on-parent-exit is what keeps a killed caller from
stranding a booted machine.
2026-10-31 18:09:11 -05:00
vhaudiquet a879631c73 ci: keep the fastfetch receipt greppable
The payload's stdout is a serial console, so fastfetch reads a tty
and decorates its output with cursor escapes; the ^OS: anchor
matched nothing and would have failed a green run. --pipe --logo
none prints a plain key-value list, and a sed strips anything left
before the grep. SPEC records the first measured apt wall time: 24 s
cache-warm, boot included.
v0.1.0
2026-10-30 23:51:37 +01:00
vhaudiquet 4128092be3 fix(ci): spell the quiet flag out in the snap e2e
--quiet is long-only in RunArgs; -q is a clap error and the smoke
step never reached the machine.
2026-10-30 23:43:07 +01:00
vhaudiquet 3618d9857e ci: build the snap and run an apt e2e against it
The snap only got built at tag time, so the pack rotted between
releases; ci now packs it on every change, the same action the
release workflow uses, and boots it twice: an alpine uname check
that proves the machine virtualized under strict confinement, and
apt update + install fastfetch on ubuntu, which is T8 — a real
package install through the TSI proxy, the staged e2fsprogs, and
the exit-code path, with the wall time as the standing
re-measurement of the ln driver's throughput.
2026-10-30 23:27:27 +01:00
vhaudiquet dabe66994b refactor: drop the dead shell probe and unused engine bindings
utils::detect_shell lost to the image probe; krun_set_root and
krun_set_env have had no caller since the root crossed as a block
device. Unused FFI bindings rot where they stand.
2026-10-30 23:13:03 +01:00
vhaudiquet a368a2e7cb fix(image): run provision unlinks when no files are staged
The early return keyed on files alone, so an unlink-only call was a
silent no-op. No caller passes an empty file set today, but the
signature invites one, and the control-file unlink is the case that
must never vanish.
2026-10-30 23:13:03 +01:00
vhaudiquet 4b3c66af3c docs(vm): state the machine child's fork constraint
The fork contract lived in a comment inside run_prepared; an
embedder meeting it first in the public API docs, with the
fork-with-threads hazard spelled out, has a chance of honoring it.
2026-10-30 23:13:03 +01:00
vhaudiquet 943aa8b38f docs(cli): state the memory size unit
--memory takes MiB, not bytes: -m 512 is 512 MiB. The help said
bytes.
2026-10-30 23:12:50 +01:00
vhaudiquet dd4139ce65 fix(rootfs): boot a cached distro entry for floating aliases
Resolution ran before the cache was consulted, so every run of
alpine:3.23, ubuntu or any floating alias hit the CDN or
changelogs.ubuntu.com, and an offline run of a cached image died in
resolution instead of booting. The boot path now asks the cache
first: an alias boots the newest cached entry of its distro, within
the series or the edge flavor it floats in, and resolves upstream
only on a miss; pull and --no-cache still resolve upstream.

Exactly-named references (Ubuntu YY.MM, known codename, Alpine X.Y.Z)
resolve offline on every path; resolve_source folds into the policy,
which lives with the cache it consults.
2026-10-30 23:12:50 +01:00
vhaudiquet dfc8cf88e7 fix(cache): re-check every unpinned OCI tag on pull
Only :latest was treated as floating; any other unpinned tag skipped
the registry digest check, so a moved :v1.2 kept booting stale. Tags
are mutable pointers, that is what digest pins exist for; the pin
skip stays, the tag skip goes.
2026-10-30 23:12:25 +01:00
vhaudiquet 5df06ffcc2 fix(distro): take the last supported release with rfind
filter(..).next_back() on a double-ended iterator is denied by newer
clippy, and CI floats on stable, so it went red there while passing
locally.
2026-10-30 23:12:25 +01:00
vhaudiquet 4affe9230c fix(image): publish the built image atomically
mke2fs creates and sizes the output file before it populates it, so a
build that failed mid-way left a recent-looking image full of zeros at
the final name - newer than the tarball, and trusted by the freshness
check forever after. The first run after the libarchive fix booted
exactly that wreckage: EXT4-fs "Can't find ext4 filesystem".

The build now lands in a sibling .part file and renames over the image
only on success, and the freshness check additionally requires the
ext4 superblock magic (s_magic, at byte 1080) before trusting an
existing image - caches already carrying wreckage rebuild over it on
the next run instead of needing a manual clean.
2026-10-30 21:22:33 +01:00
vhaudiquet 0347309eea ci: install libarchive for the image build
Same dlopen as the snap stages for: the runner has e2fsprogs but not
the lib, and the first cold pull would fail. The t64 name with a
fallback keeps it honest if the runner image changes base.
2026-10-30 21:22:33 +01:00
vhaudiquet f3da39011e build(snap): stage libarchive for the image build
Populating an ext4 image from a tarball is a runtime dlopen of
libarchive in mke2fs, not a linked dependency: the deb does not pull
it in, the stage set did not have it, and the first snap build failed
with "you need libarchive to be able to process tarballs". Stage
libarchive13t64 next to e2fsprogs.
2026-10-30 21:22:33 +01:00
vhaudiquet ed4214180e docs: describe the image-backed rootfs
The design paragraphs follow the code: the rootfs crosses as a raw
ext4 image built from the tarball, ownership is real inside the
machine, provisioning rides debugfs, and the control file mints the
exit code because the engine's own channel is virtiofs-root only.
The confinement budget admits the e2fsprogs children and cp, the
snap section stages e2fsprogs and names the blk feature, and the
boot-economics row counts an image copy instead of an extraction.
2026-10-30 19:10:59 +01:00
vhaudiquet 17e0d91527 feat(cli): probe the image tooling
The run path shells out to mkfs.ext4 and debugfs from e2fsprogs; a
host without them fails at the first pull, so probe names them up
front like it names KVM and the engine.
2026-10-30 19:10:59 +01:00
vhaudiquet 27b22c60ab ci: build the T6 engine with the blk feature
The T6 run boots from a block device now; an engine without the blk
feature fails the lookup for krun_add_disk and the audit never sees a
machine. Same feature set as the snap ships.
2026-10-30 19:10:59 +01:00
vhaudiquet 583d188474 build(snap): build the engine with blk and stage e2fsprogs
The rootfs boots from a virtio-blk disk now, and the blk feature is
what compiles the device into libkrun - without it krun_add_disk and
krun_set_root_disk_remount have no symbols and every run fails at
lookup. e2fsprogs joins the stage set for mkfs.ext4 (the cache image
build) and debugfs (per-run provisioning and the control-file read);
core26 ships 1.47.4, which knows how to build from a compressed
tarball.
2026-10-30 19:10:59 +01:00
vhaudiquet 51f56116a3 feat(rootfs): cross the rootfs as an ext4 image on a block device
The rootfs was a virtiofs share over an extracted tree, and that
showed: the tree's owners were the host user's, because an
unprivileged extract cannot chown to a tar's uid, and every chown
inside the machine failed with EPERM against the host side.

The rootfs crosses as a raw ext4 image now. mke2fs builds the cache
image straight from the entry tarball (-d takes gz, xz and zst, and
bakes each entry's recorded uid, gid and mode), the run copies it
into a scratch directory with cp --reflink=auto --sparse=auto, and
the engine attaches it with krun_add_disk +
krun_set_root_disk_remount; the init blob mounts /dev/vda at / and
chroots. The OCI layer bundle merges into one plain tar first, with
whiteouts applied across layers and headers passed verbatim, so
registry images keep their ownership too.

Per-run provisioning rides debugfs: the generated init lands at
/ecrou-init, the host resolver overwrites /etc/resolv.conf (unlink
first - resolver-bearing images ship it as a symlink), a stale
control file goes. The exit-code control file now outranks the
machine child's exit code: with a block root the engine's exit-code
channel (an ioctl through the virtiofs root device) never fires, so
decode_status reads the file first and treats the child's code as
machinery talk. Shell detection and the rare control-file read are
debugfs stats, no extracted tree to walk.

extract.rs keeps what the image build consumes (the tar decoder and
the OCI merge) and drops the extraction-to-disk path it once carried;
the module is private now. The engine needs the blk feature from here
on: the snap and the CI engine build follow in their own commits.
2026-10-30 19:10:48 +01:00
vhaudiquet 8cc3ba9854 build(snap): rewrite the store listing text
The summary takes the README tagline. The description now leads with
an Install section, shows a first run that opens a shell, and leaves
the XDG redirection internals out of the listing.
2026-10-30 16:23:55 +01:00
vhaudiquet 2ac01f992a build: adopt the snap version from Cargo.toml
The version: key in snapcraft.yaml was a second number to bump by
hand, and between releases it read whatever it was left at. The ecrou
part now sets its version from [workspace.package] at pull time —
the same value clap reports with --version — so Cargo.toml is the
only place a version lives, and the release workflow stamps only
that. A missed match fails the pack loudly.
2026-10-30 16:19:10 +01:00
vhaudiquet a021df7d72 build(snap): fill the store metadata
The pack lint flagged five empty metadata fields. They render on the
snapcraft.io listing, and contact is asked for at publish time. The
repo answers for website, source-code, and contact (the issue tracker,
since the listing is public); title matches the binary name.
2026-10-30 16:15:10 +01:00
vhaudiquet 06856d532f docs(cli): plainen the command one-liners
The list view now says what each command does in the plainest verbs:
run boots a command from an image, pull downloads one, probe checks
the requirements. The long help keeps the contracts — freshness
semantics, what probe actually tests.
2026-10-30 16:03:23 +01:00
vhaudiquet 0ad07c182f refactor: cut provision
The runtime runs images; building them belongs to the OCI ecosystem —
CI builds, digests, scanning — and a keyed local layer could never
offer a digest. Provision also installed packages through TSI, whose
per-stream throughput makes a real package install crawl exactly at
first use, and the bare-command shape mutated the shared cache entry
under the image's own name.

0.1 runs images: run, pull, probe — distro aliases, OCI references
with digest pins, local rootfs archives. The one honest idea provision
carried stays in SPEC's Later: provision by booting, for locked-down
hosts that cannot run any builder.
2026-10-30 15:57:10 +01:00
vhaudiquet e632fa2125 docs: move provisioned layers out of Later
The keyed-layer design shipped: provision --spec hashes the spec with
its base reference and --layer names the entry for run --layer. The
row was describing the past as the future; what remains is eviction.
2026-10-30 15:30:22 +01:00
vhaudiquet 3d999b7be0 docs(cli): rewrite the command help
Each command keeps a crisp one-liner in the command list and carries
its contract in the long help: how an image reference resolves, what
provision's two shapes do, why pull exists (run never contacts a
registry on a cache hit), and what probe checks. Flag help states the
real constraints instead of the shortest noun phrase: the guest path
of a share must be absolute, the host environment is never inherited,
--capture is refused with --tty, --quiet silences engine and kernel
messages.
2026-10-30 15:30:22 +01:00
vhaudiquet 4aadc5d28a docs: trim SPEC.md to the contracts the code cannot carry
The code is the source of truth now; what stays is the part code
cannot carry — the founding rule and confinement budget (fixed: the
budget said no child process, the machine child is one), the run
contracts (exit codes rewritten to match the engine-failure and
reserved-code semantics), the trust model, the falsification tests,
and the roadmap.

Cut: the engine call list, the RunOptions listing, the CLI flags
table, the cache layout tree, the workspace/module map, the ecr
porting table, and the open questions — all answered or all mirrors
of code that answers them faster.
2026-10-30 13:27:51 +01:00
vhaudiquet b0ff40dd5d ci: note why the release builds no riscv64 snap
GitHub hosts no riscv64 runner; the platform stays buildable by hand
(snapcraft remote-build).
2026-10-30 03:45:23 +01:00
vhaudiquet f47f9e77dd build(snap): build riscv64 from the ports archive
libkrunfw5 ships for riscv64 in ubuntu-ports, not the main archive
(archive.ubuntu.com carries amd64 and arm64 binaries); the part now
maps each target arch to its pool and a pinned digest.
2026-10-30 03:45:23 +01:00
vhaudiquet 2132a8262d fix(error): name the KVM module per compile target
The remediation hard-coded kvm_intel, wrong on arm64 and riscv64
which the snap now ships. x86_64 keeps the vendor split (kvm_intel,
kvm_amd) and the nested-virt parameter file; everywhere else KVM is
one module and the nested pointer is not actionable.
2026-10-30 03:45:23 +01:00
vhaudiquet 3d86f30dd3 fix(supervise): kill and reap the machine when a run errors after the fork
A parent-side failure after the fork (a console stat or read that
went wrong, a wait that could not complete) used to return and leave
the VM booting unattended. PDEATHSIG only fires when the caller's
process exits; a library consumer that catches the error keeps
running, and the scratch rootfs goes away under the machine.
kill_machine is best effort: a machine that already exited reaps
through ECHILD. Also drops a duplicated fork-error block left behind
by the supervise split.
2026-10-30 03:45:23 +01:00
vhaudiquet 2e6c84b65b fix(supervise): report engine failures instead of guest exit codes
Only the guest init can mint a guest code: it reports the payload's
code through the control file and the VMM exits the child with it. A
signal on the machine child therefore means the VMM or the engine
died; mapping it to 128+n masqueraded an OOM-killed VMM as the
payload having died by that signal (T3).

125 and 126 keep their two-sided reading: the child bails with 125 on
a boot failure and the init refuses with 126 on a failed share or a
missing workdir, but a payload may genuinely exit either code — the
control file is the arbiter, and a run that never reached the payload
is an error naming the cause.
2026-10-30 03:44:55 +01:00
vhaudiquet 0ce450b19d docs: drop the README-reflection rule from the conventions 2026-10-30 03:42:26 +01:00
vhaudiquet 8047106733 test(cli): audit the strace trace by syscall name, not errno
The SPEC bar for T6 is failure on a single hit from the denied set;
the errno-based check only caught attempts the snap's seccomp
allowlist had already denied, so a host mount that succeeded would
have passed. Exact-name matching over the traced call also stops
"mount" matching "umount2" lines.
2026-10-30 03:26:07 +01:00
vhaudiquet 4a9d148a4b ci: run the T6 strace audit on every push
The test has been declared as CI-only since it landed and never ran
anywhere. The job builds the engine from the tag the snap bundles,
takes libkrunfw from the pool, opens /dev/kvm, and runs the ignored
test with ECROU_BIN and LD_LIBRARY_PATH pointed at them.
2026-10-30 03:26:07 +01:00
vhaudiquet 8bdaa7de69 ci: build the arm64 snap in the release workflow
The arm64 runner leg builds that platform natively, where libkrun
compiles and the libkrunfw part picks the arm64 pool .deb on its own.
Both snaps upload as artifacts and publish to stable from one job.
2026-10-30 03:26:07 +01:00
vhaudiquet 5072fbcbed build(snap): build arm64 and drop the riscv64 target
The pool carries an arm64 libkrunfw5 next to the amd64 one, so the
part now picks the flavor and the install path from the target arch
(CRAFT_ARCH_BUILD_FOR / CRAFT_ARCH_TRIPLET_BUILD_FOR) with the
checksum pinned per arch. riscv64 goes: the pool has no libkrunfw5
build for it, and libkrun does not target it.
2026-10-30 03:25:49 +01:00
vhaudiquet b4dafccae7 feat(cli): add ecrou pull
Fetch or refresh an image's cache entry without booting it. The
command is the CLI face of the run/pull split: runs never contact a
registry on a cached image, pull does - reporting the entry path
and whether anything transferred. --no-cache forces a redownload.
SPEC documents the command and the run/pull trust model.
2026-10-30 01:04:24 +01:00
vhaudiquet 12a417645d feat(rootfs): pull as the explicit freshness operation
prepare was a freshness hybrid: runs of an unpinned OCI tag contacted
the registry on every boot, and only ":latest" was checked - :main
floated in name only. Docker's split is cleaner, so it is the model
now: prepare (and run) trust a present entry and never touch the
network on a hit - a cold cache pulls by default, since there is
nothing to boot otherwise. RootfsCache::pull is the refresh
operation: re-check any unpinned tag against the registry digest,
re-resolve floating distro aliases, download only what moved,
extract nothing. Digest pins stay immutable to both. The trade, as
in docker: a stale :latest boots until someone pulls.
Local archives are not pullable - the error says so.
2026-10-30 01:04:22 +01:00
vhaudiquet 408774cbd1 docs: add the cache scope to the commit conventions 2026-10-30 01:04:22 +01:00
vhaudiquet c2e8d82cd3 feat(progress): report uncounted status through the sink
A run blocked on the cache-entry flock was silent: the wait went to
the log sink, which renders nowhere by default, so the CLI read as
a hang. The Progress trait gains message() - a status line outside
the counted-operation protocol, defaulting to a no-op so existing
sinks keep compiling - and the flock wait reports what it is
waiting for. The CLI renders messages on the active bar and spins
one up when no operation is active.
2026-10-30 01:04:20 +01:00
vhaudiquet 89a1028d46 refactor(cache): name cache entries without touching the network
generate_cache_filename derived a distro tarball's extension by
resolving its URL - a naming function with a network dependency and
a silent unwrap_or_default degradation. Naming is now pure string
shaping: distro artifacts are gzipped tarballs, so the name says
.tar.gz, and a future artifact format changes extraction and this
line together. Same filenames as before for every existing entry;
a caller skipping resolve_source now gets a deterministic key
instead of a lookup.
2026-10-30 00:45:00 +01:00
vhaudiquet 479dfb79d0 refactor(rootfs): split the entry cache into cache.rs
The cache stopped being an implementation detail of the rootfs
lifecycle: entry naming, the advisory lock, digest freshness,
provisioned-layer pointers, and extraction-to-scratch are a store
in their own right. cache.rs now owns RootfsCache's paths, pointers
and extraction products; rootfs.rs keeps the lifecycle API
(PrepareRequest, PreparedRootfs, prepare, prepare_provisioned).
resolve_source moves next to its inputs in distro. Pure movement -
naming still derives its extension from the URL, next commit
changes that.
2026-10-30 00:44:46 +01:00
vhaudiquet 52d734063f fix(rootfs): validate the layer key at the entry-path splice point
entry_path spliced the layer key into the cache filename raw: the
guard lived at the write/extract/prepare boundaries, so a library
consumer deriving paths through resolved_entry_path could get a
path outside the cache directory instead of the named error.
entry_path now returns Result and validates, prepare drops its now
redundant pre-check.
2026-10-30 00:24:36 +01:00
vhaudiquet 73eaeb57ac feat(distro): ubuntu-base from real releases, codename and number aliased
Ubuntu tarballs came from the daily/current directories - moving
targets, no published checksums guarantee, gone when a release
EOLs. resolve_ubuntu_url now builds the cdimage release URL:
ubuntu-base/releases/<YY.MM>/release/ubuntu-base-<YY.MM>-base-<arch>.tar.gz,
whose SHA256SUMS the existing checksum verification consumes.

Resolution returns the YY.MM number (the cache key follows), and
accepts the codename interchangeably: a static table maps the
known codenames offline - ubuntu:resolute and ubuntu:26.04 are the
same image and the same entry - with meta-release as a fallback
for codenames newer than the table. Floating aliases (latest/lts)
still consult meta-release; explicit numbers never touch the
network, which also removes the per-cache-path network lookup
generate_cache_filename used to trigger for codename inputs.

URLs verified live: tarball and SHA256SUMS both 200.
2026-10-30 00:12:51 +01:00