Skip to content

fix(bind-flow): enable systemd user-linger after install#18

Merged
im4codes merged 1 commit intomasterfrom
dev
May 9, 2026
Merged

fix(bind-flow): enable systemd user-linger after install#18
im4codes merged 1 commit intomasterfrom
dev

Conversation

@im4codes
Copy link
Copy Markdown
Owner

@im4codes im4codes commented May 9, 2026

Without loginctl enable-linger, systemd-logind tears down the per-user systemd --user instance after the last session ends, and imcodes goes down with it. Result: every server set up via imcodes bind "mysteriously" loses its daemon overnight, comes back when the operator next SSHes in (which restarts the user manager and auto-starts the unit), then drops again on the next disconnect.

Caught on 212/213/215 (2026-05-09). All three were bound via imcodes bind. setup-flow.ts.installSystemdService already had the linger call (since 2026-04, line 415); bind-flow.ts was missing it — this commit copies the same try/catch pattern over.

Pinned with a contract test that scans both source files for the execSync(... loginctl enable-linger ...) invocation. Source-content scan is the right tool here: a unit-test mock harness for a single execSync call would be heavier than the bug fix, and the failure mode ("daemon disappears overnight") is exactly the kind of silent regression that future refactors invite if the call gets removed without a tripwire.

Without `loginctl enable-linger`, systemd-logind tears down the
per-user `systemd --user` instance after the last session ends, and
imcodes goes down with it. Result: every server set up via
`imcodes bind` "mysteriously" loses its daemon overnight, comes back
when the operator next SSHes in (which restarts the user manager and
auto-starts the unit), then drops again on the next disconnect.

Caught on 212/213/215 (2026-05-09). All three were bound via
`imcodes bind`. `setup-flow.ts.installSystemdService` already had the
linger call (since 2026-04, line 415); `bind-flow.ts` was missing it
— this commit copies the same try/catch pattern over.

Pinned with a contract test that scans both source files for the
`execSync(... loginctl enable-linger ...)` invocation. Source-content
scan is the right tool here: a unit-test mock harness for a single
execSync call would be heavier than the bug fix, and the failure
mode ("daemon disappears overnight") is exactly the kind of silent
regression that future refactors invite if the call gets removed
without a tripwire.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@im4codes im4codes merged commit 6a37e66 into master May 9, 2026
40 checks passed
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.

1 participant