fix: auto-enable systemd linger during gateway install on headless servers#1023
Closed
teyrebaz33 wants to merge 1 commit intoNousResearch:mainfrom
Closed
fix: auto-enable systemd linger during gateway install on headless servers#1023teyrebaz33 wants to merge 1 commit intoNousResearch:mainfrom
teyrebaz33 wants to merge 1 commit intoNousResearch:mainfrom
Conversation
…rvers Fixes NousResearch#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
Contributor
|
Merged via #1334. I cherry-picked your substantive linger auto-enable change onto current main, resolved it against the newer gateway unit-refresh flow, and added a small follow-up to handle missing SESSION UID USER SEAT LEADER CLASS TTY IDLE SINCE 4 sessions listed. gracefully while keeping clear manual guidance/tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1005
Problem
On headless servers,
hermes gateway installsets up a user-level systemd service that stops when the SSH session ends — even thoughsystemctl --user statusshowsactive (running). Root cause: user services require linger to survive logout.Solution (Option A + C from the issue)
New helper
_ensure_linger_enabled()called at the end ofsystemd_install():/var/lib/systemd/linger/<user>— no subprocess neededloginctl enable-linger <user>— succeeds when the process has sufficient privileges (e.g. running as root or sudo-less loginctl access)Out of scope
Option B (
--systemflag for system-level service) — can follow in a separate PR.Tests
4 new tests in
TestEnsureLingerEnabled, 205 passed total.