sector-f-linux

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

README.md (5611B)


      1 # The test VM
      2 
      3 Builds the Patina desktop and the Sector F Linux image (Fedora 45's bootc image on Btrfs, ADR-0009),
      4 installs it onto a disk file the way it would go onto a real disk, and boots it in QEMU, then
      5 lets the VM upgrade from the published image and roll back. Needs Docker, QEMU with KVM, and OVMF
      6 (`apt install qemu-system-x86 ovmf`); no root, no podman on the host. Paths here are relative to
      7 `linux/`. From the repository root, `make build`, `make disk`, `make run` and `make upgrade`
      8 call these.
      9 
     10 ```
     11 vm/build.sh          build the desktop and the image on this machine (nothing is pushed; ../publish.sh pushes)
     12 vm/disk.sh           install the image onto out/disk.raw (and make the SSH key and an empty second disk)
     13 vm/vm.sh start       boot it in the background (serial console in out/serial.log)
     14 vm/vm.sh wait        wait until SSH answers
     15 vm/vm.sh ssh [cmd]   a root shell, or a command
     16 vm/vm.sh console     boot it on this terminal instead (Ctrl-a x quits)
     17 vm/vm.sh view        its screen in a VNC viewer (localhost:5901)
     18 vm/vm.sh screenshot  its screen, saved to out/screen.png
     19 vm/vm.sh log         follow the serial console
     20 vm/vm.sh stop        power it off
     21 vm/clean.sh          stop it and delete out/ (--all: the built images too)
     22 ```
     23 
     24 The Patina greeter comes up on the screen; log in as **patina**, password **patina**, and the Patina session
     25 starts (the VM's image adds that user, in `wheel`; the real image, and so the ISO, has none).
     26 
     27 Trying an update:
     28 
     29 ```
     30 make build && make publish                  # a new build, pushed
     31 vm/vm.sh ssh rpm-ostree upgrade             # the VM fetches and stages it
     32 vm/vm.sh ssh systemctl reboot               # boots into it
     33 vm/vm.sh ssh cat /usr/lib/patina-os/build   # which build is running
     34 vm/vm.sh ssh rpm-ostree rollback            # the previous one, at the next reboot
     35 ```
     36 
     37 Use `rpm-ostree upgrade`, not `bootc upgrade`: once a package is layered (`rpm-ostree install`),
     38 bootc refuses ("Deployment contains local rpm-ostree modifications") and rpm-ostree upgrades the
     39 image underneath and keeps the layer.
     40 
     41 ## How it works
     42 
     43 - **The desktop** is patina-desktop's own bundle, built by `desktop/build.sh`: it runs that
     44   repository's `packaging/deb/build.py --stage` (what `make install-full` runs there) on its last
     45   commit (beside this checkout, or `PATINA_DESKTOP`), in a Fedora 45 container with rustup's Rust
     46   (pinned in `desktop/builder.Containerfile`). The tree lands in `build/desktop/` as it goes under
     47   `/`, and the Containerfile copies it in, so the image gets what `make install` puts in place;
     48   the libraries and programs it needs come from dnf. `/usr/lib/patina-os/desktop` names the commit.
     49 - **The image** has two stages: `system`, the real one, and `dev`, which adds the test user.
     50   vm/build.sh builds both, locally: `sector-f-linux:build` (what `make publish` pushes, and so
     51   what `make iso` carries) and `sector-f-linux-dev:build` (the VM only). Neither is pushed by the build.
     52 - **The registry** is GitHub's, `ghcr.io/sector-f-labs/sector-f-linux`. Only `make publish`
     53   (`../publish.sh`) writes to it, and only the real image, logged in with `gh`'s token (needs the
     54   `write:packages` scope). The VM follows that name, so `make upgrade` works after a publish.
     55   Building, installing the VM and making the ISO need no registry. The package must be public for
     56   machines to pull without a login.
     57 - **The push is OCI.** Docker pushes an OCI manifest whose own layers carry Docker's media type,
     58   which bootc rejects on an upgrade (`Unhandled layer type`), and skopeo won't convert that from a
     59   registry. publish.sh pushes the image from Docker's daemon with `skopeo copy --format oci`,
     60   which takes a few minutes.
     61 - **The install** runs the image itself, privileged, with the host's `/dev` for a loop device: its
     62   own podman loads it from a file saved from Docker, and its own `bootc install to-disk` writes the disk, with
     63   a Btrfs root, and puts `out/id_ed25519.pub` in root's `authorized_keys`. The installed system
     64   follows the published `ghcr.io/sector-f-labs/sector-f-linux:latest`.
     65 - **The VM** has 4 CPUs, 4 GB, UEFI, the system disk, an empty 10 GB second disk (not used now that
     66   ZFS is gone), SSH on localhost:2222 with the key in `out/id_ed25519`, a virtio GPU shown over VNC
     67   (Mesa draws in software), a USB tablet and keyboard, and QEMU's monitor on `out/monitor.sock`
     68   (screenshots, and `sendkey` to type into it).
     69 
     70 ## Found along the way
     71 
     72 - Passing `--pid=host` to the install container (as Fedora's docs do) breaks it here: bootc
     73   compares `/var/lib/containers` with the host's, which doesn't exist.
     74 - An update staged while `/boot` has idled out is dropped at shutdown: systemd's EFI-partition
     75   automount sits in front of ostree's `/boot`, and `ostree admin finalize-staged` fails with
     76   "Remounting /boot read-write: Invalid argument". `boot.automount` is masked in the image
     77   (`system/etc/systemd/system/`); the Containerfile has the upstream issues.
     78 - The accounts' session comes from `system/etc/accountsservice/user-templates` (Patina), and greetd starts `patina-session` itself; there is no GNOME session in the image any more (ADR-0012).
     79 - Fedora's `fedora-bootc` image runs out of disk when `dnf` installs into it with `docker run`:
     80   inspect packages in `quay.io/fedora/fedora` instead.
     81 - Docker here has only the legacy builder (no BuildKit), so the Containerfile uses `COPY --from`
     82   rather than `RUN --mount`.
     83 - The Ubuntu bootc image's findings (the fs-verity kernel regression, the splitstream error,
     84   the netplan and AccountsService workarounds) are in ADR-0006 and ADR-0009.