fix(install.sh): sorting out systemd issues #4

Merged
joshtronic merged 2 commits from devel into master 2026-05-16 20:20:02 +00:00
Owner
No description provided.
Hitting `bin/install.sh` from a sudo -iu / su - session fails with a
cryptic DBus / XDG_RUNTIME_DIR error because pam_systemd didn't run
and the user-systemd instance isn't reachable. Even with
`loginctl enable-linger` set, the active shell still needs to have
gone through pam_systemd to have the runtime dir + DBus envs.

Detect XDG_RUNTIME_DIR unset (or its dir missing) at the top of
install.sh and print the fix: enable linger, then grab a proper
login session via `machinectl shell <user>@.host` or `ssh
<user>@localhost`. Avoid sudo -iu / su - for this account.

The error is unhelpful and recurring (every fresh install on a new
machine hits it). Replacing it with actionable instructions is
worth the eight lines.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: install.sh auto-recovers from missing user-systemd env
All checks were successful
Lint / check-sync (push) Successful in 4s
Lint / check-sync (pull_request) Successful in 4s
c66bc00629
The previous pre-flight told the operator what was wrong but made
them fix it manually -- pointed at machinectl shell or ssh-to-
localhost. Neither helps if machinectl isn't installed and the bot
account has no sudo access.

The actual fix is dumb: if linger is enabled, /run/user/<uid>/ and
its bus socket exist. The sudo session just doesn't have
XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS pointing at them
because pam_systemd was skipped. Set the env vars ourselves and
continue.

New pre-flight:
- If XDG_RUNTIME_DIR unset but /run/user/$(id -u)/bus exists,
  export the env vars and proceed. Log that we did it.
- If the runtime dir genuinely doesn't exist, linger isn't set up
  -- print clear instructions for the operator with sudo to enable
  it, and bail.

No more machinectl recommendation. No more "get a fresh login
session" theater. Either we can fix it in this shell or linger
needs enabling.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
joshtronic deleted branch devel 2026-05-16 20:20:02 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
joshtronic/igor!4
No description provided.