Add systemd user unit for running pat without root - #530
Open
mwthomson wants to merge 1 commit into
Open
Conversation
Finishes the packaging started by @raek in a WIP commit linked from la5nta#459 (raek/pat@70005bb): debian/rules copied the new user unit to lib/systemd/user/ but never created that directory, which would have broken the .deb build. This adds the missing mkdir. The unit intentionally has no After=/Wants= ordering against ax25.service: Pat's inbound listeners retry every second until their transport is available (app/listener_hub.go), and outbound transports (Ardop/Vara/AGWPE/AX.25/Pactor) are only initialized when a connection is requested (app/connect.go), so there's nothing at startup that needs system services to already be running. See la5nta#459
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.
Summary
Finishes the systemd user-unit packaging started by @raek in #459
(WIP commit raek/pat@70005bb). That commit added
debian/pat.servicebut never created its install directory in
debian/rules, whichwould have broken the
.debbuild — fixed here.Why no ax25.service dependency is needed
@raek's stated concern was that a user-manager unit can't depend on
(
After=) a system-manager unit likeax25.service, and worriedabout a race condition on boot. Traced this in the Pat source:
initialized inside
Connect(), triggered by the user — nothingruns at startup (
app/connect.go).available (
app/listener_hub.go'slistenLoop), logging"Will try to re-establish listener in the background..." rather
than failing. The underlying AX.25 port check
(
wl2k-go/transport/ax25'scheckPort) is a fast, non-blockingread, so this retry is bounded at ~1 second, not indefinite.
So no unit ordering against system services is required.
Known limitation
Like any systemd user unit, this stops on logout and won't start at
boot unless the admin runs
sudo loginctl enable-linger <user>once.That's standard systemd behavior, not something this PR can fix, but
worth calling out explicitly here since it differs from the always-on
system unit.
Test plan
dpkg-buildpackage -us -uc -bsucceeds and the built.debcontains
lib/systemd/user/pat.service, byte-for-byte identicalto
debian/pat.servicein the repogo fmt ./...,go build ./..., andgo test ./...all pass(no Go code changed by this PR)
systemctl --user start patwas not exercised against a realsystemd user session — the environment this PR was developed in
has no systemd/D-Bus user session available to test against. The
unit's static syntax and packaging placement are verified; the
actual start/stop/status lifecycle under
systemctl --userstillneeds confirmation on a real system before merge.
Fixes #459