mirror of
https://github.com/vhaudiquet/ecrou.git
synced 2026-11-12 22:22:44 +00:00
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.
This commit is contained in:
1 parent
8cc3ba9854
commit
51f56116a3
11 files changed
+1032
-957
No files matched your search
@@ -38,10 +38,12 @@ Rules:
|
||||
(`crates/ecrou/src/rootfs.rs`)
|
||||
- `cache` - the rootfs entry store: naming, locking, freshness,
|
||||
layer pointers (`crates/ecrou/src/cache.rs`)
|
||||
- `pack` - rootfs tarball packing (`crates/ecrou/src/pack.rs`)
|
||||
- `image` - ext4 image building and inspection
|
||||
(`crates/ecrou/src/image.rs`)
|
||||
- `distro` - distro definitions and mirrors (`crates/ecrou/src/distro.rs`)
|
||||
- `download` - image download (`crates/ecrou/src/download.rs`)
|
||||
- `extract` - rootfs extraction (`crates/ecrou/src/extract.rs`)
|
||||
- `extract` - tar decoding and the OCI layer merge feeding the image
|
||||
build (`crates/ecrou/src/extract.rs`)
|
||||
- `registry` - OCI registry client (`crates/ecrou/src/registry.rs`)
|
||||
- `utils`, `error`, `progress` - shared helpers
|
||||
- `deps` - dependency additions/bumps (manifests, lockfile)
|
||||
|
||||
Reference in new issue
Block a user