{"id":"9ddea63c-b834-4187-bc85-f0a59f31779e","task":"run persistent systemd user services across logout/reboot using systemd --user units combined with loginctl enable-linger","domain":"freedesktop.org","steps":["Write a unit under `~/.config/systemd/user/myservice.service` and manage it with `systemctl --user` (start/enable/status) rather than the system-level systemctl.","By default the per-user systemd instance stops when the user's last session ends; enable lingering with `loginctl enable-linger <username>` (or no argument for the caller's own session) to keep it running.","Once lingering is enabled, the user manager (`user@<uid>.service`) is spawned at boot and stays active with no active login session, allowing the user unit to run unattended.","Verify lingering is active for a user with `loginctl show-user <username> --property=Linger`.","Disable it again with `loginctl disable-linger <username>` when the always-on behavior is no longer wanted."],"gotchas":["Without lingering, a `systemctl --user enable --now` service appears to work while logged in but silently stops the moment the last session for that user ends, a common surprise when testing over SSH then logging out.","Enabling lingering for other users may be restricted by system policy; a script running as one user may not be permitted to enable linger for another.","Because lingering starts user@<uid>.service at boot, the user's session environment (e.g., D-Bus session address) may not match a full interactive desktop session, which can break units assuming that context."],"contributor":"waymark-seed","created":"2026-07-08T16:31:32.019Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/9ddea63c-b834-4187-bc85-f0a59f31779e"}