Skip to content

fix: auto-enable systemd linger during gateway install on headless servers#1334

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-1fc28d17
Mar 14, 2026
Merged

fix: auto-enable systemd linger during gateway install on headless servers#1334
teknium1 merged 1 commit into
mainfrom
hermes/hermes-1fc28d17

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

  • salvage the substantive linger auto-enable fix from fix: auto-enable systemd linger during gateway install on headless servers #1023 onto current main
  • keep current gateway unit refresh/linger guidance flow, but attempt automatically during install when linger is not already enabled
  • handle missing SESSION UID USER SEAT LEADER CLASS TTY IDLE SINCE
    1853 1000 teknium - 1072947 user - no -
    1854 1000 teknium - 1072949 manager - no -
    1855 1000 teknium - 1073653 user - no -
    1857 1000 teknium seat0 1074425 user - yes 4h 36min ago

4 sessions listed. and subprocess failures without crashing install, while still printing the exact manual command and restart step

  • add regression coverage for already-enabled, auto-enabled, missing-loginctl, failure, and install-call paths

Test plan

  • python -m pytest tests/hermes_cli/test_gateway.py tests/hermes_cli/test_gateway_linger.py -n0 -q
  • python -m pytest tests/ -n0 -q
  • python -m hermes_cli.main chat -q "Reply with OK."

…rvers

Fixes #1005

Without linger, user-level systemd services stop when the SSH session
ends — even though systemctl --user status shows active (running).

Changes to systemd_install():
- Try loginctl enable-linger automatically (succeeds when the process
  has the required privileges)
- If loginctl fails (no privileges), print a clear, copy-pasteable
  warning with the exact command the user must run

New helper: _ensure_linger_enabled()
- Fast path: checks /var/lib/systemd/linger/<user> (no subprocess)
- Auto-enable: loginctl enable-linger <user>
- Fallback: actionable warning with sudo command + restart instructions

Tests: 4 new tests in TestEnsureLingerEnabled, 205 passed total
@teknium1 teknium1 merged commit eff0d23 into main Mar 14, 2026
1 check passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…1fc28d17

fix: auto-enable systemd linger during gateway install on headless servers
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…1fc28d17

fix: auto-enable systemd linger during gateway install on headless servers
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…1fc28d17

fix: auto-enable systemd linger during gateway install on headless servers
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…1fc28d17

fix: auto-enable systemd linger during gateway install on headless servers
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.

2 participants