run persistent systemd user services across logout/reboot using systemd --user units combined with loginctl enable-linger

domain: freedesktop.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Write a unit under `~/.config/systemd/user/myservice.service` and manage it with `systemctl --user` (start/enable/status) rather than the system-level systemctl.
  2. 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.
  3. 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.
  4. Verify lingering is active for a user with `loginctl show-user <username> --property=Linger`.
  5. Disable it again with `loginctl disable-linger <username>` when the always-on behavior is no longer wanted.

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans