0006-updates-are-zfs-streams-of-boot-environments.md (5080B)
1 # 0006. Updates are ZFS streams of boot environments, on either base; no bootc 2 3 Date: 2026-10-22 4 5 ## Status 6 7 Superseded by [ADR-0009](0009-seflos-a-fedora-bootc-image-on-btrfs.md): bootc is the update mechanism after all, on Fedora and Btrfs, and boot environments shipped as ZFS streams are no longer planned. The FreeBSD base stays as the record. 8 9 Before that: Deferred by ADR-0007: Patina OS is Ubuntu updated with apt on a ZFS root for now. Built boot environments stay a possible later stage. Its ruling-out of bootc stands. 10 11 ## Context 12 13 ADR-0001 chose an Ubuntu bootc image for the system and a ZFS pool for the data. The VM showed it working (linux/vm/README.md), but every step leaned on bootc's young Ubuntu support: a newer kernel than the base's (fs-verity), bootc built from source, a community base image rather than Canonical's, and an upgrade bug still open (an upgrade that changes a large layer fails). bootc also can't sit on ZFS well: its composefs backend wants fs-verity, which ZFS doesn't have, so the system and the data stay on two filesystems. 14 15 FreeBSD's VM (freebsd/README.md) did the same job with ZFS alone: the system is a boot environment (a dataset), an update is a new one, a build ships as a `zfs send` stream (2.9 GB whole, 5.1 MB as an increment), and rollback is booting the previous one. Nothing in that is FreeBSD's: OpenZFS is the same code on Linux, and ZFSBootMenu boots Linux from boot environments the way FreeBSD's loader does. 16 17 So the update strategy doesn't have to depend on the base. What bootc gave the Linux side (building with containers, no snaps) doesn't need bootc either: the Containerfile builds the system, and its filesystem is what goes into the boot environment. 18 19 Weighed and ruled out: 20 21 - **Ubuntu + bootc** (ADR-0001): for the reasons above. 22 - **CentOS Stream 10 + bootc**: bootc's best-tested path, but still bootc, with ZFS from a third-party repository and a 6.12 kernel that trails on new laptops. 23 - **Fedora + bootc**: its kernels outrun OpenZFS. 24 - **Ubuntu on a ZFS root, upgraded with apt in place**: snapshots, but the system is assembled on each machine, not built and shipped whole. 25 26 ## Decision 27 28 - **Two bases remain: FreeBSD and Ubuntu.** Both on a ZFS root, both updated the same way. Which one is decided mostly by laptops (docs/comparison.md). 29 - **One pool per machine**, laid out the same on both: `patina/ROOT/<build>` for each system build, `patina/home/<user>` for each user. Pools are made with `compatibility=openzfs-2.2` (or whatever both bases' OpenZFS share), so either OS can import them. 30 - **A build is a boot environment.** On Ubuntu, the Containerfile builds the system (with its kernel and an initramfs that imports the pool) and its filesystem is written into a new dataset. On FreeBSD, `pkg -r` installs into a new dataset. Either way it's built on a build machine, never assembled on the user's. 31 - **A build ships as a ZFS stream**: incremental from recent builds, whole for machines too far behind, signed, served as plain files. The machine receives it beside the running system (`zfs receive -s`, so a broken download resumes) and boots into it next time. 32 - **The system is read-only** (`readonly=on` on its dataset), so nothing changes it but a new build. That keeps incremental streams applying cleanly and the system apart from the user's software (ADR-0002). 33 - **One updater, in Rust, for both**: check, fetch, verify, receive, set the next boot, and after the reboot confirm it or fall back. Only the last steps differ: `bectl activate -t` on FreeBSD, ZFSBootMenu and the pool's `bootfs` on Ubuntu. 34 - **The user decides when**: updates are staged, never rebooted into for them, and can be turned off. 35 36 ## Consequences 37 38 - The update system is designed once and doesn't change with the base. Choosing FreeBSD or Ubuntu later costs a build recipe and a boot loader, not a new update model. 39 - What bootc did for us is ours: the updater, the boot-once-then-confirm on Ubuntu (check what ZFSBootMenu offers), and the machine's state in `/etc` (users, hostname, networks), which a new build would otherwise replace. That's one design for both bases: an `etcupdate`-style merge, or the machine's state kept outside the boot environment. 40 - Streams carry their checksums, so corruption is caught, but not tampering: signing them (minisign or similar) is required, not optional. 41 - The server keeps streams from a few recent builds to the newest, and one whole build. A machine whose system dataset differs from what was shipped can't take an increment; read-only prevents that. 42 - On Ubuntu the root is ZFS, so the system can't boot without the CDDL module Canonical ships with its GPL kernel. A product inherits that licence question in full (docs/comparison.md). 43 - On Ubuntu the Containerfile can start from Canonical's own `ubuntu` image instead of the community bootc base. 44 - The bootc VM in linux/ stays until the Ubuntu boot environment loop replaces it; it's no longer the direction. 45 - ZFS everywhere: native encryption can cover the system's `/etc` and `/var` as well as the homes.