sector-f-linux

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

commit 9c824555f69b69ccb66a9ec3b6a6a485ce211775
parent 87a5c9d13851a9a2874c6078c4757e2c5ece7b50
Author: Divan Visagie <me@divanv.com>
Date:   Sat, 28 Nov 2026 00:33:31 +0100

adr: the first-run setup becomes several steps (ADR-0019, proposed)

Why: a machine installed from the ISO came up on UTC while its owner is in Stockholm, so its clock was
an hour out; the first-run setup only makes an account. The user asked for more steps and chose the
clock, the computer's name, Wi-Fi and the keyboard layout (Language was offered and left out).

What it records, so the code that follows has something to be checked against:
- the order: keyboard, Wi-Fi, clock, computer name, then the account;
- why the account is last: the polkit rule that lets the greeter manage accounts only holds while no
  human account can log in, so every other system change has to be made before the account exists,
  each when its step is confirmed;
- the service each step talks to (timedated, hostnamed, NetworkManager, localed) and the polkit
  rules that open for the greeter in the same window;
- the awkward one, the keyboard: neither the greeter's cage (environment variables only) nor the
  desktop's compositor (its own config, or Debian's /etc/default/keyboard) would read what localed
  writes on Fedora, so that step needs plumbing on both sides.

Nothing is implemented in this commit. It is Proposed: the user's direction, my details.

Diffstat:
Adocs/adr/0019-the-first-run-setup-is-several-steps.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+), 0 deletions(-)

diff --git a/docs/adr/0019-the-first-run-setup-is-several-steps.md b/docs/adr/0019-the-first-run-setup-is-several-steps.md @@ -0,0 +1,73 @@ +# 0019. The first-run setup is several steps: keyboard, Wi-Fi, clock, computer name, then the account + +Date: 2026-11-28 + +## Status + +Proposed. The user asked for it: the setup only makes an account, a machine installed from the ISO +came up on UTC (the user is in Stockholm, so the clock was an hour out), and they chose the clock, the +computer's name, Wi-Fi and the keyboard layout as what else it should ask. Language was offered and +not chosen. The order, the mechanisms and the plumbing below are mine and wait for their say. + +## Context + +[ADR-0012](0012-a-login-manager-of-our-own-greetd-and-a-patina-greeter.md) and +[ADR-0013](0013-the-greeter-is-a-patina-app-of-our-own.md) made the first run a single screen: full name, +user name, password. The greeter runs as the unprivileged `greetd` user inside `cage`, and what it +may do to the system it does over D-Bus, through polkit. A rule (`50-patina-first-user.rules`) lets it +administer accounts only while no human account can log in, which closes the moment the first +account has a password. + +That window is the constraint on the new steps. Everything the setup changes on the system has to +happen **before** the account is made, because after that the greeter has no more rights. So the +account is the last step, and each earlier step applies its change when it is confirmed, not at the end. + +## Decision + +- **The steps, in this order:** Keyboard layout, Wi-Fi, Clock (time zone), Computer name, Account. + The keyboard comes first because the rest is typed on it (the Wi-Fi password, the account's + password). Each step but the last can be skipped, and Back goes to the one before. +- **Each step applies at once, through the service that owns it,** over the system bus with `zbus` + as the greeter already does for AccountsService: + - Clock: `org.freedesktop.timedate1` `SetTimezone`. The zone list is timedated's own + `ListTimezones`; NTP is already on, so only the zone needs choosing. Nothing is guessed (there + is no network to guess from at this point), so the list starts on what is set (UTC) with a search. + - Computer name: `org.freedesktop.hostname1` `SetStaticHostname` (and the pretty name as typed). + - Wi-Fi: NetworkManager's `AddAndActivateConnection` for the chosen access point and its password. + - Keyboard: `org.freedesktop.locale1` `SetX11Keyboard` and `SetVConsoleKeyboard`. +- **Polkit lets the greeter do those only in the same window as the account:** the rules file's check + ("no human account can log in") becomes one function that the account rule and the new ones share + (`org.freedesktop.timedate1.set-timezone`, `org.freedesktop.hostname1.set-static-hostname`, + `org.freedesktop.locale1.set-keyboard`, and NetworkManager's `network-control` and + `settings.modify.system`). Any doubt closes it, as the account rule does. +- **Settings has the same pages** for later (its Date and Time page, ADR-0157 of patina-desktop, sets + the time zone through the same timedated), so the setup only asks what a fresh machine cannot work + without and what is best set before the first login. + +## What the keyboard step needs besides the call + +The layout that localed writes has to reach two compositors, and today neither would read it: + +- **The greeter's `cage`** reads only `XKB_DEFAULT_*` from its environment, so the layout chosen is + not the one it types with, and the next screens would still use the old one. A small wrapper as + greetd's command would read `/etc/vconsole.conf` and localed's X11 file into those variables, and + the greeter would restart the session after the step (greetd starts a fresh one) with its place kept + in `/run`, so the next screens type on the layout just chosen. +- **The desktop's `patina-compositor`** reads `[keyboard]` in its own config, else + `/etc/default/keyboard` (patina-desktop's ADR-0019), a Debian file Fedora does not write. Either + the compositor also reads localed's `/etc/X11/xorg.conf.d/00-keyboard.conf` (a patina-desktop + change, the better one), or the setup writes `/etc/default/keyboard` as well. + +## Order of work + +1. The steps' framework in the greeter, with the Clock step and the polkit rule it needs. +2. Computer name. +3. Wi-Fi. +4. Keyboard layout, with the two compositors' side. + +## Open questions + +- Whether the clock should offer a guess when there is a network by then (Wi-Fi comes first). +- A Language step, offered and not chosen. +- Hardware without a keyboard that localed can name (an unusual one): the step lists what localed + lists; a layout it does not know cannot be chosen.