sector-f-linux

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

comparison.md (11013B)


      1 # Comparing the bases
      2 
      3 > **Superseded 2026-11-20 by [ADR-0009](adr/0009-seflos-a-fedora-bootc-image-on-btrfs.md):** the base is Fedora's bootc image on Btrfs. This comparison is kept as the record of the earlier choice, which was between FreeBSD and Ubuntu on ZFS.
      4 
      5 How the bases for Patina OS compare on what matters to the product: keeping the user's software apart from the system's, updating safely, letting the user decide when to update, ZFS, laptops, and whether it could be sold. Written 2026-10-22.
      6 
      7 **Decided 2026-10-22 (ADR-0007): plain Ubuntu, no snaps, root on ZFS, snapshotted before every apt run.** The comparison below is between the two image-based designs that led there, kept as the record. Ubuntu with apt in place was ruled out below for being assembled on each machine rather than built and shipped whole; that was given up for hardware support (laptops and CUDA on one OS) and software compatibility, with snapshots and ZFSBootMenu standing in for atomic updates. ADR-0006's boot environments remain a possible later stage.
      8 
      9 Before that decision, two remained (ADR-0006):
     10 
     11 - **FreeBSD** (its folder has since been removed): FreeBSD 15.1 on a ZFS root. Tried in a VM.
     12 - **Ubuntu** ([linux/](../linux/)): Ubuntu 26.04 built from a Containerfile, written into a ZFS boot environment and booted by ZFSBootMenu. No bootc, no snaps. Not tried yet: the VM in linux/ is still the bootc one this replaced.
     13 
     14 Both are updated the same way, so that's no longer what separates them. What's left is mostly laptops.
     15 
     16 What each claim rests on is marked: **seen** means a VM here showed it; everything else is what the base documents or is known for, and the ones marked *(check)* need confirming before a decision leans on them.
     17 
     18 ## At a glance
     19 
     20 | | FreeBSD | Ubuntu, Containerfile on ZFS |
     21 |---|---|---|
     22 | **User and system software kept apart** | Strong: read-only system dataset *(not tried)* | Strong: the same |
     23 | **Safe upgrades** | Strong: the shared model; boot-once fallback built in (`bectl activate -t`) | Strong: the shared model; boot-once fallback is ours to add *(check ZFSBootMenu)* |
     24 | **Letting the user turn updates off** | Strong: our updater, same on both | Strong: the same |
     25 | **ZFS** | Strong: in the base, its installer and loader | Strong, with a licence question: Canonical's module, ZFS root |
     26 | **Laptops** | Weak: graphics, Wi-Fi and sleep trail Linux *(check on hardware)* | Strong: newest kernel, widest support |
     27 | **Commercialisation** | Strong licence; hardware is the limit | Workable: GPL source duty, Ubuntu trademark, CDDL-on-GPL question |
     28 | **Building the system** | `pkg -r` into a dataset, or FreeBSD's OCI images *(check)*; recipe not written yet | The Containerfile we have, from Canonical's `ubuntu` image |
     29 | **Our upkeep** | Medium: build recipe, `/etc` | Medium: image-to-dataset step, ZFSBootMenu, `/etc` |
     30 
     31 The short version: FreeBSD is the cleaner system, where ZFS and boot environments are the base's own; Ubuntu runs on far more laptops. The update model, the app model (ADR-0002, ADR-0005) and the pool are the same on both, so the decision rests on how FreeBSD runs on the laptops Patina OS is for, which no test has tried yet.
     32 
     33 ## Updates: one model for both
     34 
     35 The same on either base (ADR-0006):
     36 
     37 - **A build is a boot environment**: a ZFS dataset, `patina/ROOT/<build>`, holding the whole system with its kernel. It's built on a build machine and never assembled on the user's.
     38 - **A build ships as a ZFS stream.** Incremental streams carry only the blocks that changed: on FreeBSD, a build with one binary and a file changed was 5.1 MB, against 2.9 GB for the whole system (**seen**). The machine receives it beside the running system and boots into it next time; the running system is never touched (**seen**, on FreeBSD).
     39 - **Rollback is booting the previous one** (**seen**, on FreeBSD). Old builds are kept as long as wanted, costing only the blocks that differ, and any of them can be picked from the boot menu.
     40 - **Streams are checked and resumable.** Every block carries its checksum, so a corrupt download isn't booted; `zfs receive -s` resumes an interrupted one. Checksums don't stop tampering, so streams are signed.
     41 - **Incremental streams need the build they were made from.** The server keeps streams from a few recent builds to the newest, plus a whole one. The system dataset is read-only so a machine's copy never drifts from what was shipped.
     42 - **The user decides when**: one Rust updater on both, which stages a build, never reboots for the user, and can be turned off.
     43 - **`/etc` is the open design question, for both.** A new build would replace the machine's users, hostname and networks. Either merge three ways after receiving (as FreeBSD's `etcupdate` does, and bootc did), or keep the machine's state outside the boot environment.
     44 
     45 What differs is only the last step:
     46 
     47 | | FreeBSD | Ubuntu |
     48 |---|---|---|
     49 | Boot loader | FreeBSD's own, reads ZFS | ZFSBootMenu on the ESP |
     50 | Boot the next build | `bectl activate` | set the pool's `bootfs` |
     51 | Boot once, then fall back | `bectl activate -t`, built in | ours to add *(check what ZFSBootMenu offers)* |
     52 | What's in `/etc` to keep | `master.passwd`, `rc.conf`, `wpa_supplicant.conf` | `passwd`, `shadow`, NetworkManager's connections |
     53 
     54 ### How stable the ground under it is
     55 
     56 - **FreeBSD**: 15 is supported to about the end of 2029 *(check)*, with a minor release about every six months. Packages come from the quarterly branch (fixed for three months at a time) or latest. Since 15 the base system is packages too (pkgbase, **seen**: 719 `FreeBSD-*` packages), so one tool builds everything. Boot environments have been in FreeBSD since 12.0 (2018); nothing in the VM needed working around (**seen**).
     57 - **Ubuntu**: 26.04 LTS has standard support to April 2031. Its kernel moves every six months (HWE), and Canonical builds the ZFS module for every kernel, so the kernel moving doesn't break ZFS. `zfs-dracut` and `zfs-initramfs` (OpenZFS 2.4.1) are in main, so the initramfs can import a ZFS root. Building from Canonical's own `ubuntu` image removes the community bootc base and its workarounds. ZFSBootMenu is a third-party project, though an established one.
     58 
     59 ## Keeping user software and system software apart
     60 
     61 Both run the same app model: apps are folders in `~/Apps`, on the pool, needing nothing from the system but the Patina platform (ADR-0002, ADR-0005). On both, the system dataset is mounted read-only, so not even root's `pkg install` or `apt install` changes it; the only way to change the system is a new build *(not tried)*. Tools a user wants that aren't apps go in their home: `flatpak --user`, distrobox on Ubuntu, cargo and the like.
     62 
     63 The separation means the system and apps update independently: a user can hold the system back and still update their apps, or the reverse.
     64 
     65 ## ZFS
     66 
     67 - **FreeBSD**: part of the base system, its installer and its boot loader. `/` and `/home` are datasets out of the box, and boot environments are ZFS itself (**seen**). The licence (CDDL) sits comfortably beside BSD.
     68 - **Ubuntu**: Canonical builds the module for every kernel and ships the tools and initramfs support (**seen**, for the data pool in the bootc VM). With a ZFS root, the system can't boot without it. Shipping the CDDL module with the GPL kernel is Canonical's call, which the FSF and the Software Freedom Conservancy dispute; a product built on it inherits that question.
     69 
     70 Both run OpenZFS, so a pool made with a shared compatibility setting imports on either.
     71 
     72 ## Laptops
     73 
     74 - **Ubuntu**: the best supported. A 7.0 kernel, Wi-Fi and Bluetooth for nearly everything, modern standby (s2idle), Thunderbolt, fingerprint readers, NVIDIA's driver packaged, and a list of certified laptops. New hardware arrives with each six-monthly kernel. nifl, the Patina desktop's own laptop, runs Ubuntu.
     75 - **FreeBSD**: the weakest, and untested here (the VM ran the desktop nested, with no FreeBSD graphics driver). Graphics come from drm-kmod, ported from Linux and some versions behind it, so the newest Intel and AMD GPUs arrive late. Wi-Fi uses Linux's drivers through LinuxKPI and trails Linux in speed and chips. Bluetooth is limited. Suspend works on many machines with S3, but most new laptops only have modern standby, which FreeBSD is still catching up on. The FreeBSD Foundation has been funding laptop work since 2024 (sleep, Wi-Fi, graphics, with Framework laptops as a target) *(check how far it got by 15.1)*.
     76 
     77 ## Commercialisation
     78 
     79 - **FreeBSD**: the most room. The BSD licence lets a product keep its changes closed and owes no source, which is why Sony, Apple, Netflix and Juniper have built on it. ZFS's CDDL is compatible. Not calling the product FreeBSD avoids its trademark. Consultancies sell FreeBSD support. The limit is the hardware: a laptop OS can only be sold for laptops it runs well on, so commercialising FreeBSD means choosing and certifying a few models.
     80 - **Ubuntu**: sellable, with duties. The kernel and much of the userland are GPL, so we'd publish the source of what we ship. Canonical's trademark policy means a changed Ubuntu is shipped without Ubuntu's name and branding (Patina OS is its own name already). The packages are Canonical's own archive, which is better footing than the community bootc base was, though Canonical supports Ubuntu, not our way of building and shipping it. Then the ZFS licence question above, sharper with ZFS as the root.
     81 
     82 ## Ruled out
     83 
     84 - **Ubuntu + bootc** (ADR-0001, linux/ today): it worked in the VM, but on a community base, with a newer kernel than the base's, bootc built from source, and an open bug (upgrades that change a large layer fail). bootc can't sit on ZFS well (its composefs backend wants fs-verity, which ZFS lacks), so the system and data stayed on two filesystems. Everything it gave us (building with containers, atomic updates, rollback) the ZFS model gives too.
     85 - **CentOS Stream 10 + bootc**: bootc's best-tested path and a commercial one (RHEL image mode), but still bootc, with ZFS from a third-party repository and a 6.12 kernel that trails on new laptops.
     86 - **Fedora + bootc**: its kernels outrun OpenZFS.
     87 - **Ubuntu on a ZFS root, upgraded with apt in place**: snapshots to roll back to, but the system is assembled package by package on each machine rather than built and shipped whole.
     88 
     89 ## What would decide it
     90 
     91 1. **FreeBSD on real laptops.** If 15.1 runs the Patina desktop on drm-kmod, with Wi-Fi, suspend and resume and battery working, on hardware we'd ship, FreeBSD is the cleaner OS. If not, it's Ubuntu.
     92 2. **The Ubuntu boot environment in a VM**: Containerfile, written into a dataset, booted by ZFSBootMenu, then an incremental stream from a second build, switched to and rolled back.
     93 3. **`/etc`**: one design for how a new build keeps the machine's users, hostname and networks, on both.
     94 4. **A FreeBSD build recipe** on a build machine (`pkg -r` into a new dataset, or a Containerfile on FreeBSD's OCI images), the counterpart of the Containerfile.