0019-the-first-run-setup-is-several-steps.md (6704B)
1 # 0019. The first-run setup is several steps: Wi-Fi, clock, computer name, then the account 2 3 Date: 2026-11-28 4 5 ## Status 6 7 Proposed. The user asked for it: the setup only makes an account, a machine installed from the ISO 8 came up on UTC (the user is in Stockholm, so the clock was an hour out), and they chose the clock, the 9 computer's name, Wi-Fi and the keyboard layout as what else it should ask. Language was offered and 10 not chosen. **The keyboard layout step is left out for now, at the user's word;** what it would need 11 is kept below as notes for when it is added. The order, the mechanisms and the plumbing are mine and 12 wait for their say. 13 14 ## Context 15 16 [ADR-0012](0012-a-login-manager-of-our-own-greetd-and-a-patina-greeter.md) and 17 [ADR-0013](0013-the-greeter-is-a-patina-app-of-our-own.md) made the first run a single screen: full name, 18 user name, password. The greeter runs as the unprivileged `greetd` user inside `cage`, and what it 19 may do to the system it does over D-Bus, through polkit. A rule (`50-patina-first-user.rules`) lets it 20 administer accounts only while no human account can log in, which closes the moment the first 21 account has a password. 22 23 That window is the constraint on the new steps. Everything the setup changes on the system has to 24 happen **before** the account is made, because after that the greeter has no more rights. So the 25 account is the last step, and each earlier step applies its change when it is confirmed, not at the end. 26 27 ## Decision 28 29 - **The steps, in this order:** Wi-Fi, Clock (time zone), Computer name, Account. Each step but the 30 last can be skipped, and Back goes to the one before. (When the keyboard step is added it goes 31 first, because the rest is typed on it: the Wi-Fi password, the account's password.) 32 - **Each step applies at once, through the service that owns it,** over the system bus with `zbus` 33 as the greeter already does for AccountsService: 34 - Clock: `org.freedesktop.timedate1` `SetTimezone`. The zone list is timedated's own 35 `ListTimezones`; NTP is already on, so only the zone needs choosing. Nothing is guessed (there 36 is no network to guess from at this point), so the list starts on what is set (UTC) with a search. 37 - Computer name: `org.freedesktop.hostname1` `SetStaticHostname` (and the pretty name as typed). 38 - Wi-Fi: NetworkManager's `AddAndActivateConnection` for the chosen access point and its password. 39 - Keyboard (later): `org.freedesktop.locale1` `SetX11Keyboard` and `SetVConsoleKeyboard`. 40 - **Polkit lets the greeter do those only in the same window as the account:** the rules file's check 41 ("no human account can log in") becomes one function that the account rule and the new ones share 42 (`org.freedesktop.timedate1.set-timezone`, `org.freedesktop.hostname1.set-static-hostname`, and 43 NetworkManager's `network-control` and `settings.modify.system`; the keyboard's 44 `org.freedesktop.locale1.set-keyboard` with its step). Any doubt closes it, as the account rule does. 45 - **Settings has the same pages** for later (its Date and Time page, ADR-0157 of patina-desktop, sets 46 the time zone through the same timedated), so the setup only asks what a fresh machine cannot work 47 without and what is best set before the first login. 48 49 ## What the keyboard step will need besides the call (not built; notes) 50 51 The layout that localed writes has to reach two compositors, and today neither would read it: 52 53 - **The greeter's `cage`** reads only `XKB_DEFAULT_*` from its environment, so the layout chosen is 54 not the one it types with, and the next screens would still use the old one. A small wrapper as 55 greetd's command would read `/etc/vconsole.conf` and localed's X11 file into those variables, and 56 the greeter would restart the session after the step (greetd starts a fresh one) with its place kept 57 in `/run`, so the next screens type on the layout just chosen. 58 - **The desktop's `patina-compositor`** reads `[keyboard]` in its own config, else 59 `/etc/default/keyboard` (patina-desktop's ADR-0019), a Debian file Fedora does not write. Either 60 the compositor also reads localed's `/etc/X11/xorg.conf.d/00-keyboard.conf` (a patina-desktop 61 change, the better one), or the setup writes `/etc/default/keyboard` as well. 62 63 ## Order of work 64 65 1. The steps' framework in the greeter, with the Clock step and the polkit rule it needs. 66 2. Computer name. 67 3. Wi-Fi. 68 4. Later: the keyboard layout, with the two compositors' side. 69 70 ## Done so far 71 72 - **The framework and the Clock step** (2026-11-28): the setup is a list of steps with Skip and Back 73 and "Step n of m", the account last; the Clock step searches timedated's zone list (by any words of the 74 name, so `stock` finds Europe/Stockholm), starts on the zone the machine is on, and sets the zone 75 when Continue is pressed (nothing is asked of the system if it is unchanged). Its polkit rule is in 76 the rules file. Seen in the greeter's mock; not yet on the real machine. 77 78 - **The Computer name step** (2026-11-28): one field, started on the name the machine has now 79 (`sectorf`), checked as a host name (letters, numbers and hyphens, 63 at most, case folded) before 80 Continue is allowed; set through hostnamed's `SetStaticHostname`. After the clock, before the account. 81 82 - **The Wi-Fi step** (2026-11-28), first in the order on a machine that has Wi-Fi (NetworkManager lists 83 a wireless device) and left out on one that does not: the networks in range, one per name, strongest 84 first, asked again every few seconds; a password field (the greeter's own secret field, wiped 85 when sent) for a secured one; Connect saves the connection for every user through 86 `AddAndActivateConnection` and waits for it to be up, and takes a network that would not join back 87 out. WPA2, WPA3 and open networks are offered; WEP and a work network with its own login are not. 88 Tried against a real NetworkManager in the test VM (a virtual radio and a WPA2 access point): the list, 89 a refused wrong password that leaves nothing saved, and a join saved system-wide. Also tried as the 90 `greetd` user with the real polkit rules: the zone, the name and the join all work while the only 91 account is locked and are all refused once an account can log in. That test found one fault (a join 92 waited for an IP address, so a network without DHCP looked like a failure); fixed. Not tried on 93 real Wi-Fi hardware, nor the whole wizard on a real first boot. 94 95 ## Open questions 96 97 - Whether the clock should offer a guess when there is a network by then (Wi-Fi comes first). 98 - A Language step, offered and not chosen. 99 - Hardware without a keyboard that localed can name (an unusual one): the step lists what localed 100 lists; a layout it does not know cannot be chosen.