Repository navigation
Enable first-run user units one at a time - #10582
fresh3nough wants to merge 4 commits into
Conversation
systemctl enable with multiple unit names validates the whole list before applying any of it. Under set -e, one missing unit (for example a package that never installed a unit into /usr/lib/systemd/user/) aborted enable-user-units.sh and left every later omarchy user unit disabled (issue omacom#10484). Enable and start each shipped unit individually, warn on failure, and only exit non-zero when none of them could be enabled. Fixes omacom#10484 Signed-off-by: fresh3nough <anonwurcod@proton.me>
Quattro added owed.service to the first-run list and installs the OWE theme hook after it. Both carry over into the per-unit loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Quattro's first-run script now installs the OWE theme hook after enabling units. Run against the real command, the test wrote into the caller's ~/.config and failed wherever /usr/share/owe is absent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The exit check named every unit a second time, so a unit added to the list but not to the check was silently left out of it, as owed.service nearly was. Count the enables the loop already made instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed by Claude Opus 5.5, with Codex at medium effort as a second opinion. The fix works, and it is still needed: Reproduced on a worker (a VM built from the Omarchy ISO, with real systemd). I hid Pushed to your branch:
Tests on the worker: Second opinion: Codex found no defect in the script and agreed with the reproduction; its independence is not guaranteed. It also pointed out two test blocks I've left in place, since trimming them is your call. The source greps at the top of the test check the script's wording rather than its behaviour, so an equivalent loop written differently would fail them. The "multi-arg enable" block only runs its own For the maintainer: when one unit fails and another enables, the step now succeeds, so first-run marks itself done and the failed unit is never retried. That stops the onboarding notifications replaying on every login, as reported in #10484, but it also means a unit that later becomes available stays disabled until someone enables it. The other way round, the step would fail after trying every unit, and first-run would keep retrying at every login. That choice is yours. This waits on CI and on you. |
|
| # A unit that fails must not fail the step while others enabled, or first-run | ||
| # never completes; fail it only when none did. | ||
| if (( ! enabled )); then | ||
| echo "error: no omarchy user units could be enabled" >&2 | ||
| exit 1 |
There was a problem hiding this comment.
Failed sleep lock is not retried If
omarchy-sleep-lock.service fails to enable while another unit succeeds, this script reports success. First-run is then marked complete, so later logins do not retry the failed unit. The service starts the monitor that locks the session before general suspend; without it, the session can remain unlocked after waking, even if the missing unit is later restored. Preserve the partial enablement, but keep failed units eligible for retry.
How this was verified: The sleep-lock unit starts the suspend-event monitor, while the first-run completion marker prevents another enable attempt.
| # enable --now: fail the injected missing unit, or every unit. | ||
| if [[ $1 == "--user" && $2 == "enable" && $3 == "--now" ]]; then | ||
| unit=$4 | ||
| if [[ $unit == "${OMARCHY_TEST_MISSING_UNIT:-}" || -n ${OMARCHY_TEST_ALL_MISSING:-} ]]; then |
There was a problem hiding this comment.
Mock misses multi-unit calls The mock checks only
$4 for the missing unit. If the script passed more than one unit per enable call, a missing unit in a later argument could go unnoticed by the mock, while real systemctl would reject the call. The log assertions do not require one unit per call, so the test could pass while missing the regression it is meant to catch. Check every unit argument and assert that each enable call contains just one unit.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Fixes #10484.
install/user/first-run/enable-user-units.shran a single multi-unit:systemctl --user enable --now \ bt-agent.service \ ... \ omarchy-crash-watch.serviceunder
set -euo pipefail.systemctl enablevalidates the entire list before applying any unit. One missing unit (the reporter hit this with a package that never installedomarchy-brightness-keyboard-auto.serviceinto/usr/lib/systemd/user/) fails the call, aborts the script, and leaves every later omarchy user unit disabled — bt-agent, sleep-lock, fcitx5, crash-watch, migrate-notify, recover-internal-monitor.Change
Note: this tree does not currently ship
omarchy-brightness-keyboard-auto.serviceunderdefault/systemd/user/(the reporter saw it only under/usr/share/omarchy/...on an older package build). The blast-radius fix is still required so any future missing unit cannot disable the rest.Evidence
Bug reproduced (source + systemctl semantics)
Fix validated
Test plan
bash test/shell.d/systemd-test.sh