0014-the-live-disc-boots-straight-into-the-installer.md (13561B)
1 # 0014. The live disc boots straight into the installer 2 3 Date: 2026-11-21 4 5 ## Status 6 7 Proposed (the direction is the user's; the details are mine). Steps 1 to 3 are built and tried. Amends 8 [ADR-0010](0010-a-live-installer-built-from-the-image.md) and 9 [ADR-0011](0011-the-first-boot-is-the-installer.md): the live disc has no "try" mode and no desktop, 10 and boots into the installer and nothing else. Nothing here is built; "to verify" marks what has 11 not been looked at. 12 13 ## Context 14 15 ADR-0010 planned a live disc that boots the Patina desktop with an Install app on it, and ADR-0011 16 cut the installer down to choosing a whole drive, leaving the account to the first boot. The next 17 idea was a welcome screen with two choices, Try and Install. The user cut that too: the disc boots 18 into the installer. That removes most of what the live system would have to carry, and makes the 19 live disc one job. 20 21 The pieces already exist from [ADR-0012](0012-a-login-manager-of-our-own-greetd-and-a-patina-greeter.md) 22 and [ADR-0013](0013-the-greeter-is-a-patina-app-of-our-own.md): greetd runs a Patina egui app inside 23 `cage`, a kiosk compositor, with no window frame. The boot and shutdown splash is an animated 24 flask (ADR-0012, "The boot and shutdown splash"). 25 26 ## Decision (proposed) 27 28 - **The live system boots straight into a Patina installer app**, `patina-installer`: greetd, `cage` 29 and the app, with no desktop session and no `liveuser`. It looks as the greeter does (Everforest, no 30 frame, pills) so the path from USB stick to first account is one visual language: splash, installer, 31 splash, first-run setup. 32 - **Its screens:** 33 1. **Choose the drive**, as ADR-0011 has it: the whole drive only; each drive's model, size, serial and 34 what is on it (partition names, filesystem labels, a Windows or Linux install); never the drive 35 the live system booted from or one with something mounted; a confirmation that names the drive. 36 2. **Installing:** the Sector F flask animation from the splash, in the middle, animating itself, and 37 under it a progress bar and a line saying what is happening, if the install reports progress it 38 can be followed (to verify: whether `bootc install` can, e.g. through a progress file 39 descriptor, or whether the bar has to count steps of our own: partition, copy, bootloader). If 40 it cannot be followed, the flask alone, with no bar that lies. 41 3. **Done / failed:** a restart button, or what went wrong and how to try again. 42 - **The installer is unprivileged; one small root command does the install.** The app runs as an 43 ordinary user and calls `patina-install <drive>`, a script that runs `bootc install to-disk --wipe 44 --filesystem btrfs` from the payload on the ISO (offline, ADR-0010) with `--target-imgref` set to 45 the published image. A polkit rule allows that action to the live user only, and only on the live 46 disc. This is the route ADR-0012 chose for the first account (polkit, not a root helper service of 47 our own, which SELinux made expensive). 48 - **The live image is built from the base, not from the full system image:** it needs greetd, `cage`, 49 the installer, `bootc`, podman and what they link, not the Patina desktop, so the part that boots 50 is small. The ISO still carries the system image as the payload, so it is still several GB. 51 - **A text console stays on another VT** (Ctrl+Alt+F2) for when the installer cannot start. 52 - **After the install the machine restarts into the first boot** of ADR-0011: the greeter's first-run 53 setup makes the account. 54 55 ## What this gives up 56 57 - **Trying it first.** Nobody can check that Wi-Fi, the display or the touchpad work before wiping a 58 drive. Accepted for now; a Try option can come back once the installer is solid. 59 - **A rescue desktop.** The disc is no longer a way to get a desktop and repair a machine. The 60 text console is what is left. 61 62 ## Open questions 63 64 - **Progress.** Whether `bootc install` can report it (above). 65 - **The ISO tooling** of ADR-0010: `image-builder`'s `bootc-generic-iso` or titanoboa, and the gaps in 66 our base for it (`dracut-live`, `xorriso`, `isomd5sum`, GRUB's EFI binary, `iso.yaml`). 67 - **Installing from a payload in the ISO** needs podman storage in the live system with the image in 68 it (`--bootc-installer-payload-ref`); how `bootc install` takes `--source-imgref` from there is to verify. 69 - **Secure Boot,** and cage on odd GPUs (the installed greeter has the same question). 70 - **Several drives, and removable ones:** a USB stick or an SD card is a target the picker must not 71 offer by accident beyond the drive the live system booted from. 72 - **A partly done install** (power lost): the drive is wiped and has no system; the next boot of the 73 live disc must be able to start again. 74 75 ## Order of work 76 77 1. **A live ISO that boots in QEMU to a placeholder** kiosk screen (greetd, cage, a stand-in app), 78 with two blank virtual disks attached. This proves the ISO pipeline and the tool. 79 2. **`patina-install` and its polkit rule,** run by hand on the two disks: the chosen one gets the 80 system and boots, the other is untouched. 81 3. **The installer app,** first with a mock like the greeter's, then on the real command; the flask 82 and progress screen; the drive picker and its safety rules. 83 4. The gaps above as they matter, and real hardware. 84 85 ## Step 1 done (2026-11-21): a live ISO boots to a kiosk screen 86 87 The Containerfile's `live` stage (from the base: greetd, cage, the greeter as a stand-in, the splash, 88 `dracut-live`, the ISO tools, GRUB's EFI binaries, `linux/live/iso.yaml`) is turned into an ISO by 89 Fedora 45's `image-builder` 89 (`bootc-generic-iso`; no patched build was needed). The ISO is 1.7 GB, 90 boots on UEFI through shim and GRUB in QEMU (`linux/live/try.sh`, with two blank drives) and shows 91 the greeter's mock first-run screen under cage. The live image itself is 1.5 GB. 92 93 Found on the way: 94 - **The ISO cannot be built on this host.** image-builder runs osbuild in a bubblewrap sandbox, and 95 Ubuntu's AppArmor profile `unpriv_bwrap` denies it `setuid`, `chown` and `sys_admin`, so mounting the 96 image fails with "permission denied" (the kernel log shows `apparmor="DENIED"`). Docker's 97 `--privileged` and podman's `label=disable` (which only affects SELinux) do not help. `linux/live/build.sh` 98 therefore builds in the test VM (Fedora, SELinux), using its second disk (50 GB, sparse) for the 99 container storage and osbuild's work. CI will want a Fedora runner for the same reason. 100 - **The container must keep its SELinux label** in the VM: image-builder labels its own store with 101 `chcon`, which fails with `label=disable`. 102 - **`iso.yaml`'s `default` and `timeout` are integers** in this version, and GRUB still counts down 103 from a default (to look at: a timeout of 0 was not honoured). 104 - Not yet: the installer, the payload, the drive picker, the privileged install command, Secure Boot 105 and real hardware. 106 107 ## Step 2 done (2026-11-21): `patina-install`, on two blank drives 108 109 `linux/live/usr/libexec/patina-install <drive>` (in the live image only) refuses anything but a whole, 110 writable, unmounted disk of at least 12 GB that is not the drive the live system booted from, checks 111 that there is enough scratch memory, and runs `bootc install to-disk --wipe --filesystem btrfs` from 112 the payload in the disc's container storage, offline. A polkit action and rule 113 (`com.sectorflabs.patina.install`, in the live image only) let the `greetd` user run it through 114 `pkexec`, and nobody else. 115 116 Tried in QEMU from the payload ISO (2.8 GB, with the development image as payload), 4 GB RAM, two blank 117 16 GB drives: the bad targets (the optical drive, a partition, a missing device) were refused; `nobody` 118 was refused by polkit; the install of drive A took about 5 minutes and ended with "Installation 119 complete"; drive B had no signature and nothing allocated on the host; drive A booted on its own, 120 without the ISO, to the greeter's login with the account of the payload image. 121 122 Found on the way: 123 - **bootc's scratch space is the live system's `/var/tmp`, not the container's.** It reads the payload 124 through a helper in the host's mount namespace, so a bind mount into the container did nothing, and 125 the live disk (RAM, about 550 MB free) filled up: "no space left on device". The command mounts a 126 tmpfs on the live `/var/tmp` for the run, 70% of the RAM (it takes memory only as it is used). 127 Peak use seen: 1.5 GB, with the VM's free memory down to 1.6 GB of 3 GB. 128 - **The largest layer sets the memory the install needs.** The image's big `dnf install` layer is 129 1.53 GB. The command checks the scratch size against the largest layer (with a quarter more) before 130 it wipes anything, and says so. About 4 GB of RAM works; **splitting that layer** into several 131 smaller ones, or rechunking the image, would lower it, and make updates smaller too (to do). 132 - **`podman history --human=false` still prints "797kB"**; the command converts the units itself. 133 - **The installed machine follows `TARGET_IMGREF`** (the published `sectorf-linux` by default; the 134 test build sets the development image). 135 136 Not yet checked: SELinux labelling of the installed system (the live system runs with `selinux=0`; 137 the first boot of the installed drive was not logged in to), several drives and a USB stick as the 138 live medium, Secure Boot, a power cut half way, and the progress reporting for the app (the command 139 prints `STEP n/total` lines, but `bootc install` itself gives no percentage that was looked at). 140 141 ## Step 3 done (2026-11-21): the installer app, and the whole path on the real image 142 143 `installer/` (`patina-installer`, a Patina egui app in the greeter's look) is the live disc's only 144 screen: choose the drive, confirm it by name, the flask and a progress bar while it installs, then 145 done or failed. The drive list comes from `lsblk`; the disc's own drive, mounted and read-only drives 146 and ones under 12 GB are shown but cannot be chosen, with the reason, and `patina-install` checks 147 all of it again. The app is unprivileged and runs `pkexec patina-install`. The flask is drawn from 148 Rust as an SVG per frame in the skin's colours (24 fps, 72 frames in a 3 s loop). 149 150 Tried by the user in QEMU, from the ISO built on the published `sectorf-linux:latest` (no test 151 account, no SSH): picked a blank drive, installed, restarted, and the first-run setup made the 152 account. Before that, on the dev image, the install ran end to end and the machine booted. 153 154 Found on the way: 155 - **`pkexec` refuses a caller whose `SHELL` is not in `/etc/shells`,** and greetd's user has `nologin`: 156 "The value for the SHELL variable was not found in the /etc/shells file". The app sets 157 `SHELL=/bin/sh` for the call. Earlier tests ran `pkexec` from root's shell and missed it. 158 - **The progress bar is the bytes written to the drive** (the kernel's `/sys/block/<disk>/stat`) 159 over the image's size (`patina-install` prints it as `SIZE`), held under 100% until the command 160 ends. `bootc install` prints no percentage. The bar sits at 0% for the first minute or so, while 161 bootc unpacks into RAM, then moves; seen at 51% mid-install. An estimate, not a promise. 162 - **Drawing the flask at the screen's rate** took 127% of a core (and `cage` 54%) on a 2-core VM with 163 software rendering, starving the install; it is drawn at 24 fps now. On real hardware it is not 164 expected to matter. 165 - **The test rig's speed is the host's disk,** not the VM: its disks are on a ZFS dataset with 166 `dedup=on` and 128K records on a SATA SSD, 93% busy at ~23 MB/s. To tune or move to the NVMe later. 167 (The pool, `tank`, also reports DEGRADED on its only device.) 168 - **The image names:** the ISO's payload and the installed machine's update target are both 169 `sectorf-linux:latest` for a release; the dev image keeps its own name. 170 171 **SELinux labelling of the installed system, checked (2026-11-21):** the live system runs with 172 `selinux=0`, so the drive is labelled from outside a running SELinux; the question was whether that 173 comes out right. Booted drive A alone (GRUB's menu is hidden, so by hand from its prompt, with 174 `systemd.debug_shell=1` for that boot only and the entry's other options): enforcing, no denials in the 175 kernel log since boot, and the labels on `/`, `/usr`, `/etc`, `/etc/shadow`, `/var/home`, 176 `/usr/bin/bash`, `/usr/libexec/patina-greeter` and `/var/lib/greetd` (`xdm_var_lib_t`) are the 177 policy's. `restorecon -nR` finds 346 files off, and the dev VM (installed from a host with SELinux on) 178 has the same 346: `/boot/grub2/**` and the like are `default_t` where policy says `boot_t`, and 179 `/var/.ostree-selabeled` is `usr_t`. So the live install labels as well as the stock path does, and the 180 `/boot` mislabel is bootc's or bootupd's, not ours (not looked into; `/boot` is readable by the domains 181 that use it, with nothing denied). `restorecon` over `/sysroot` reports 161k files and means nothing: 182 the deployments' own paths are not where policy expects them. 183 184 Not yet checked, as before: several drives and a USB 185 stick as the live medium, Secure Boot, a power cut half way, real hardware, and GRUB's countdown. 186 The 1.53 GB layer still sets the RAM the install needs. 187 188 ## Consequences 189 190 - The live disc is one job, and the installer is the only new app. The greeter does not get a live mode. 191 - The live system is small, so building and booting the ISO is quick to try, apart from the payload. 192 - The installer's look and the first-run setup's are the same, by reuse of the greeter's widgets 193 (move them into a shared module or crate when the installer needs them, as Patina does for components).