status.sh: don't misreport an unreachable user bus as a missing unit

Running status.sh in the first seconds after a reboot (before
/run/user/$UID exists / the lingering user manager is reachable), or as
the wrong user without a session bus, made every `systemctl --user` call
fail with "Failed to connect to bus". The Service check read that the
same as "unit doesn't exist" and printed a scary "no sunshine user unit
found" for a perfectly healthy, auto-starting install.

Probe the user manager once up front; if the bus is unreachable, say so
explicitly (and point at 'ss -tulnp | grep 47990' to verify Sunshine
independently) instead of cascading into false negatives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 00:04:50 +00:00
parent 84ddf8c1c6
commit cc5daaaf37

View File

@@ -85,6 +85,16 @@ fi
# ---- 2. service unit + state ------------------------------------------------ # ---- 2. service unit + state ------------------------------------------------
section "Service" section "Service"
# Can we even reach the user's systemd manager? Every uctl call below depends on
# it. If the bus is unreachable, a healthy install looks identical to a missing
# one (`cat`/`is-active`/`is-enabled` all just fail) — the classic false alarm
# from running status.sh in the first seconds after reboot (before /run/user/$UID
# exists) or as the wrong user / without a session bus. Distinguish the two.
if ! uctl list-units --type=service >/dev/null 2>&1; then
fail "can't reach ${SUSER}'s user systemd manager (bus unavailable) — unit checks below are blind, NOT proof the service is missing" \
"Run as $SUSER in a normal session (or 'sudo ./status.sh' once boot finishes). Right after reboot, /run/user/$UID_N may not exist yet — retry in a few seconds. Verify Sunshine independently: 'ss -tulnp | grep 47990'."
UNIT=""
else
UNIT="" UNIT=""
for u in sunshine.service app-dev.lizardbyte.app.Sunshine.service; do for u in sunshine.service app-dev.lizardbyte.app.Sunshine.service; do
if uctl cat "$u" >/dev/null 2>&1; then UNIT=$u; break; fi if uctl cat "$u" >/dev/null 2>&1; then UNIT=$u; break; fi
@@ -147,6 +157,7 @@ else
"Run 'systemctl --user status $UNIT' — move Requires=/After= into [Unit]. See TROUBLESHOOTING.md §12." "Run 'systemctl --user status $UNIT' — move Requires=/After= into [Unit]. See TROUBLESHOOTING.md §12."
fi fi
fi fi
fi # end user-manager-reachable guard
# ---- 3. config + capture backend -------------------------------------------- # ---- 3. config + capture backend --------------------------------------------
section "Config & capture backend" section "Config & capture backend"