Skip to content

Fix first-run login loop caused by unpackaged user units - #367

Open
megabyte0x wants to merge 7 commits into
omacom:quattrofrom
megabyte0x:fix/first-run-missing-user-units
Open

Fix first-run login loop caused by unpackaged user units#367
megabyte0x wants to merge 7 commits into
omacom:quattrofrom
megabyte0x:fix/first-run-missing-user-units

Conversation

@megabyte0x

Copy link
Copy Markdown

Fixes #366.

Problem

omarchy-brightness-keyboard-auto.service and omarchy-speaker-tuning.service ship as source under /usr/share/omarchy but never land in /usr/lib/systemd/user/, because the omarchy-settings PKGBUILD installs user units from a hand-maintained list. install/user/first-run/enable-user-units.sh enabled every unit in a single systemctl --user enable --now call under set -euo pipefail, so the one missing unit failed the whole step, first-run-user was never marked done, and the entire first-run notification stack replayed at every login.

Changes

  • build-packages.sh: new install_all_user_units() patches the omarchy-settings PKGBUILD at build time (same non-forking rewrite mechanism as strip_limine_dependencies / keep_apple_silicon_mkinitcpio_drop_ins) with a glob loop that installs every default/systemd/user/*.service. It fails loudly if upstream restructures the install anchor.
  • install/user/first-run/enable-user-units.sh: enables units one at a time, warns per failing unit, and no longer fails the first-run step. A failed daemon-reload still fails, so a dead user manager retries next login.
  • migrations/1788782695.sh: repairs wedged machines — removes the dangling graphical-session.target.wants symlink migration 1788139121 left behind and re-runs the enable. Idempotent; stays pending without a live user manager.
  • Tests: enable-user-units-test.sh, first-run-units-migration-test.sh, user-units-packaging-test.sh (regression: every referenced omarchy user unit must ship, and the build must glob-install them), plus new assertions in install-mac-test.sh and a pinned migration lookup in brightness-keyboard-auto-test.sh.

Verification

  • ./test/all — only pre-existing failures remain (config-test.sh / unowned-system-paths-test.sh need an omarchy-pkgs checkout; runtime-smoke-test.sh fails identically on quattro at 291a698)
  • bin/omarchy commands --check — passed (458 commands)
  • bash -n / ast.parse over bin/omarchy-* — clean
  • Negative check: hiding default/systemd/user/omarchy-brightness-keyboard-auto.service makes user-units-packaging-test.sh fail, proving it would have caught the 4.0.2 bug

Plan: plans/first-run-loop-missing-units-fix.md

@malik-na

malik-na commented Sep 9, 2026

Copy link
Copy Markdown
Member

Please do not swallow enable failures for every user unit. A transient failure of sleep-lock or migrate-notify would mark first-run complete and never retry. Tolerate only the known missing-unit case, and limit migration cleanup to the known dangling link instead of deleting every dangling service symlink.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First-run replays every login because two shipped user units are never packaged

2 participants