sector-f-linux

Sector F Linux
git clone https://git.sectorflabs.com/sector-f-linux.git
Log | Files | Refs | README | LICENSE

commit c33a512c3b88ae16d0963f5edfac11692428d1ba
Author: Divan Visagie <me@divanv.com>
Date:   Thu, 15 Oct 2026 23:21:55 +0200

Notes: an Ubuntu bootc image for the Patina desktop, ZFS for /home

The core system is locked in an image built like any container; the
user's apps live in their home folder, on a ZFS pool. ADR-0001 records
the choice; docs/notes.md the research and what's still open.

Diffstat:
AREADME.md | 40++++++++++++++++++++++++++++++++++++++++
Adocs/adr/0001-bootc-image-with-zfs-for-data.md | 44++++++++++++++++++++++++++++++++++++++++++++
Adocs/notes.md | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 166 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -0,0 +1,40 @@ +# Patina OS + +An operating system image for the Patina desktop: Ubuntu as a bootc image, so a machine boots +one known-good build, updates by moving to the next one whole, and rolls back if it breaks. +The user's data lives on a ZFS pool beside it. + +Nothing is built yet; these are notes. See [docs/adr](docs/adr) for decisions and +[docs/notes.md](docs/notes.md) for the research and open questions behind them. + +## Principles + +- **The core is locked; apps are the user's.** The image is the whole system, the same on + every machine and read-only while it runs. Everything a user adds (apps, tools, their + settings) lives in their home folder, so it survives every system update and rollback, and + never changes the system under it. +- **Built like any container.** The image comes from a Containerfile, built and pushed with + the same tools and registries as Docker images, and as reproducible as we pin it. No + from-scratch distro to maintain: Ubuntu provides the packages, we choose and arrange them. +- **Opinionated.** One desktop (Patina), one way to add apps, one way to keep data (ZFS). + +## The shape of it + +- **The system** is a container image built from a Containerfile: an Ubuntu bootc base, the + Patina desktop (patina-compositor and its pieces, from `../patina-desktop`), its session file + and PAM service, and the few packages a desktop needs. It's deployed with bootc on ext4 or + xfs: `/usr` is read-only, `/etc` keeps local changes across updates, `/var` is kept. +- **Updates** are a new image in a registry; `bootc upgrade` stages it for the next boot and + `bootc rollback` goes back one. +- **Data** is a ZFS pool for `/home` (and anything else worth snapshotting), using the ZFS + module Ubuntu builds for its own kernel, so it always matches. + +## Why not ... + +- **ZFS root with boot environments (ZFSBootMenu):** the FreeBSD way, and it works, but + rollback is only as good as the snapshots taken by hand, and nothing builds a known-good + system to ship. +- **bootc on a ZFS root:** two rollback systems doing one job, and a combination bootc isn't + tested on. +- **Fedora as the base:** bootc's best-supported base, but Fedora can't ship ZFS and its + kernels run ahead of what OpenZFS supports. diff --git a/docs/adr/0001-bootc-image-with-zfs-for-data.md b/docs/adr/0001-bootc-image-with-zfs-for-data.md @@ -0,0 +1,44 @@ +# 0001. An Ubuntu bootc image for the system, ZFS for the data + +Date: 2026-10-15 + +## Status + +Proposed + +## Context + +The Patina desktop runs as the whole session on nifl, an Ubuntu laptop, installed by hand with +`make install`. We want machines that run a known-good build of the system and the desktop +together, update atomically and roll back, and we want ZFS (snapshots, send/receive, +compression, encryption) for the data that matters. + +bootc builds the whole OS as an OCI image and deploys it through ostree/composefs: a read-only +`/usr`, `/etc` merged across updates, `/var` kept, the next image staged for the next boot and +the last one kept to roll back to. Its supported bases are Fedora, CentOS Stream and RHEL; Ubuntu +bases exist from the community, not Canonical. + +ZFS can't ship with Fedora (its licence), and Fedora's kernels often run ahead of what OpenZFS +supports. Ubuntu builds the ZFS module for each of its kernels. + +Three ways were weighed: + +1. bootc on ext4/xfs for the system, ZFS for the data. +2. Ubuntu on a ZFS root with boot environments (ZFSBootMenu), as FreeBSD does with `bectl`. +3. bootc on a ZFS root. + +## Decision + +Option 1: an Ubuntu bootc image for the system on ext4 or xfs, and a ZFS pool for `/home` and +other data. The image is built from a Containerfile with the Patina desktop in it. + +## Consequences + +- The system is atomic and can be rolled back; the data has ZFS's snapshots, separately, so + rolling the system back never touches it. +- Packages go into the image, not onto the running system with apt. +- We depend on a community Ubuntu bootc base until Canonical packages bootc, and inherit its + rough edges (the kernel, the initramfs with dracut instead of initramfs-tools, the + bootloader). See docs/notes.md. +- Importing the ZFS pool at boot (and unlocking it, if encrypted) is ours to set up in the image. +- Option 2 stays the fallback if the bootc bases for Ubuntu don't hold up. diff --git a/docs/notes.md b/docs/notes.md @@ -0,0 +1,82 @@ +# Notes + +Research for Patina OS, and what's still open. Dated, since this moves quickly. + +## Ubuntu bootc bases (checked 2026-10-15) + +- **bootcrew/ubuntu-bootc** (the Universal Blue people's experiment) is archived since March + 2026; its Ubuntu work moved to **bootcrew/mono**, a collection of bootc images for several + OSes (Ubuntu, Debian, openSUSE, SteamOS). It uses the composefs-native backend. +- A separate **ubuntu-bootc** GitHub organisation has Ubuntu 26.04 LTS bases: a minimal one (no + desktop, no flatpak, no ZFS), plus desktop and server variants. Updated May 2026. +- **Canonical** doesn't support bootc; its own image-based system is Ubuntu Core (snaps). A talk + at Ubuntu Summit 26.04 argued for officially packaged bootc components and base images. +- One guide (jmarrero/ubuntu-bootc) says Ubuntu 26.04's kernel 7.0 has a regression that breaks + composefs boot, and works around it with kernel 6.17. **Check this**: nifl and huginn are + both Ubuntu 26.04.1 on 7.0.0-38-generic. Single source. + +## ZFS + +- Ubuntu ships the OpenZFS module built for its kernels (`zfs.ko` in linux-modules), and + zfsutils-linux. In the image: install zfsutils-linux, and make sure the module matches the + image's kernel (it should, if both come from Ubuntu's archive). +- The pool is for data: `/home` at least. Created once per machine, not by the image. +- Open: importing the pool at boot (zfs-import-cache or zfs-import-scan, and the cache file in + `/etc/zfs`, which bootc keeps), mounting `/home` from it, and native encryption: unlocking with + a passphrase at boot (an initramfs prompt, or a systemd unit before the display manager). +- Open: whether `/var` (containers, flatpaks, logs) also goes on the pool. + +## Apps in the home folder + +The system is locked, so apps go where the user can write: their home folder, on the ZFS pool, +snapshotted with the rest of their data. Ways to get them there, all needing nothing from root: + +- **Flatpak, per user** (`flatpak --user`, in `~/.local/share/flatpak`): the usual answer for + desktop apps on image-based systems. Sandboxed; the launcher already reads the .desktop files + it exports (in `~/.local/share/flatpak/exports/share/applications`, on XDG_DATA_DIRS; check). +- **AppImages in `~/Applications`**: one file per app. patina-desktop's ADR-0010 already lists + "an `~/Applications` folder of AppImages joins the launcher's list" as a revisit trigger. +- **Distrobox / toolbox containers**: a mutable Ubuntu (or anything) in a container, with apt, + for tools that want a normal distro; their apps can be exported to the launcher. +- **Per-user language tools**: cargo, rustup, npm in `~/.cargo`, `~/.local`; Homebrew is what + Universal Blue uses for command-line tools (it needs a home of its own, `/home/linuxbrew`). +- Open: which of these is *the* way (opinionated: probably Flatpak for desktop apps, a distrobox + for development), and whether the launcher should know about each. + +## Reproducible builds + +- Pin the base image by digest, not tag. +- apt fetches whatever is newest at build time, so two builds of one Containerfile can differ. + Ubuntu's snapshot service (snapshot.ubuntu.com) serves the archive as it was at a given time; + building against a fixed snapshot makes the packages repeatable. Check how it's used from a + Containerfile. +- Build the Patina desktop from a tagged commit, with `cargo build --locked`. + +## The image + +- A Containerfile `FROM` an Ubuntu bootc base, adding: + - the Patina desktop's binaries, built in an earlier stage from `../patina-desktop` + (`cargo build --release`), into `/usr/bin` rather than `~/.local/bin`; + - its session file (`/usr/share/wayland-sessions/patina.desktop`) and the PAM service for + patina-lock (`/etc/pam.d/patina-lock`), as `make install-session` puts them now; + - a display manager (gdm, or something lighter like greetd), PipeWire and wireplumber + (`wpctl` is the default for the volume keys), NetworkManager (patina-wifi), fonts. +- Open: where images are pushed (a registry: ghcr.io, or our own), and signing them. +- Open: how a machine is installed: `bootc install to-disk` from the image, or an ISO + (bootc-image-builder). + +## Questions for Patina itself + +- The desktop now assumes binaries beside each other in `~/.local/bin`; in an image they're in + `/usr/bin`. The compositor puts its own folder first on clients' PATH, so this should just + work; check. +- Config defaults (`~/.config/patina-*`) stay per user; system-wide defaults could go in + `/etc/xdg` or `/usr/share` if we want the image to choose them. + +## Sources + +- [bootcrew on GitHub](https://github.com/bootcrew), [bootcrew/mono](https://deepwiki.com/bootcrew/mono) +- [ubuntu-bootc organisation](https://github.com/ubuntu-bootc) +- [jmarrero/ubuntu-bootc guide](https://github.com/jmarrero/ubuntu-bootc/blob/main/GUIDE.md) +- [The Register, June 2026: Red Hat and bootc at the Ubuntu Summit](https://www.theregister.com/software/2026/06/15/red-hat-gives-ubuntu-a-bootc-up-the-backside-at-canonical-shindig/5255608) +- [Ubuntu Summit 26.04 bootc talk](https://discourse.ubuntu.com/t/bootc-use-your-container-knowledge-and-infrastructure-to-build-and-deploy-your-ubuntu-hosts/79498)