0011-the-first-boot-is-the-installer.md (6341B)
1 # 0011. The first boot is the installer; the live disc only picks a drive 2 3 Date: 2026-11-20 4 5 ## Status 6 7 Proposed, and [ADR-0014](0014-the-live-disc-boots-straight-into-the-installer.md) makes the live disc boot straight into the installer, with no desktop. Its no-user-session question is answered in 8 [ADR-0012](0012-a-login-manager-of-our-own-greetd-and-a-patina-greeter.md): the setup runs in the login 9 screen itself, a Patina greeter on greetd. The user's direction: a machine should be set up the way a Mac is. The system is put on a 10 drive and expanded, and the first boot, when no user exists, runs a setup built into Patina. Amends 11 [ADR-0010](0010-a-live-installer-built-from-the-image.md): the live installer stays, but its job 12 shrinks to choosing a drive. Nothing here has been built; "to verify" marks what has not been 13 looked at. 14 15 ## Context 16 17 [ADR-0010](0010-a-live-installer-built-from-the-image.md) planned a live disc with an installer that 18 runs `bootc install`, and left open how the first user gets made: the published image has no 19 accounts (only the test image has one), so a fresh install would boot to a login screen with 20 nobody on it. 21 22 [ADR-0008](0008-install-by-receiving-the-system-as-a-zfs-stream.md) (superseded, written for ZFS) 23 had already worked out what an image-based install has to get right: every machine must differ in 24 a few things (machine ID, SSH host keys, encryption keys), and a cloned encrypted image would give 25 every machine the same master key. It assumed an installer that took the whole disk. The reasons it 26 gave for that still hold. 27 28 The comparison the user draws is macOS: a new machine boots into Setup Assistant, and "Erase All 29 Content and Settings" returns it there without reinstalling the OS. Raspberry Pi OS, Chromebooks 30 and the Steam Deck work the same way. Our architecture suits it: `/usr` is the read-only image, and 31 everything that belongs to a person lives in `/etc` and `/var`. 32 33 On a desktop there is often more than one drive, and a drive per system is the cleaner arrangement 34 than sharing one. 35 36 ## Decision (proposed) 37 38 Two jobs, kept apart: 39 40 **1. The live disc picks a drive and puts the whole system on it.** 41 - It boots the Patina desktop and offers an Install app that lists the machine's drives. 42 - The user picks one; it is erased and the system installed on all of it, with 43 `bootc install to-disk --wipe --filesystem btrfs` from the payload in the ISO (ADR-0010), so no 44 network is needed. 45 - **Whole drive only.** Installing into a partition beside other things is a later option, and so 46 is putting `/home` on a second drive. 47 - **The picker is the dangerous part**, so it shows each drive's model, size and serial and what is 48 on it (partition names, filesystem labels, a Windows or Linux install), never offers the drive 49 the live system booted from or one with something mounted, and asks for a confirmation that 50 names the drive. 51 52 **2. The first boot sets the machine up.** 53 - The installed image has no users. When none exists, a setup assistant (a Patina app, in the 54 family of Files and Settings) runs before any login: the account and its password, hostname, 55 timezone and keyboard, and joining the tailnet if wanted. 56 - It makes the account through AccountsService, the D-Bus service GDM and GNOME use (to verify 57 that it can run without GNOME, and what permissions the setup session needs). 58 - Everything that must differ between machines is made here, not in the image: the machine ID and 59 SSH host keys (systemd and sshd already do this at first boot), and any encryption key, made on 60 the machine it protects. 61 62 **3. Factory reset is the same first boot again.** A reset action clears `/var`, restores `/etc` to 63 the image's defaults and reboots into setup, with no live disc and no reinstall of the system. 64 Separate Btrfs subvolumes for `/var` and `/home` would make it quick, and systemd has a 65 factory-reset mechanism (to verify that it fits an ostree system, and how the image's `/etc` is 66 restored: how ostree stores local `/etc` changes has not been looked at). 67 68 ## Open questions 69 70 - **Does the installed system boot from the chosen drive on a real, multi-drive desktop?** 71 `bootc` writes the bootloader to that drive's EFI partition. Whether it also registers a 72 firmware boot entry, which a machine with a Windows drive or two may need, is unchecked. 73 - **A no-user session for the setup.** Settled in ADR-0012: the login screen is a Patina greeter on 74 greetd, with the setup as its first-run mode and a small helper that makes the first account. 75 - **Encryption.** It cannot be in a shared image. Creating the encrypted storage at first boot with 76 a key made on that machine (`systemd-repart` can, with the TPM or a passphrase), or an encrypted 77 home per user (`systemd-homed`), are options; neither has been tried on this stack. 78 - **The Btrfs layout.** Whether `bootc install` can create subvolumes for `/var` and `/home`, or 79 the first boot has to. 80 - **Joining the tailnet** (a pre-auth key, or approving the new node), and anything else the 81 assistant should ask. 82 83 ## Order of work 84 85 1. **A quick experiment:** on a VM installed from the published image, which has no users, make an 86 account over D-Bus at first boot and log it into the Patina session. It shows whether the 87 assistant is mostly a Patina interface over existing plumbing, or whether the session needs real 88 work. 89 2. **The live disc boots in QEMU** with two blank virtual disks (ADR-0010, step 1). 90 3. **The drive picker**, as a script first, tested on the two disks: the chosen one gets the 91 system, the other is untouched. 92 4. **The setup assistant.** 93 5. **The boot entry on real multi-drive hardware.** 94 6. **Factory reset**, and the `/var` and `/home` layout. 95 7. **Encryption.** 96 97 ## Consequences 98 99 - The installer needs no account screens and no partition editor, so the live app is a drive 100 picker with a progress bar. Its code is small; the setup assistant is where the work is. 101 - The same assistant serves a new install and a reset, so what a user sees the first time is what 102 they see after "erase and start again". 103 - Releases can also ship as a plain disk image that is written to a drive and grown on first boot, 104 for machines installed from another computer, with no live disc. 105 - The whole-drive rule means a dual-boot on one drive is not supported, by choice.