Skip to content

Add systemd user unit for running pat without root - #530

Open
mwthomson wants to merge 1 commit into
la5nta:developfrom
mwthomson:feature/systemd-user-unit
Open

Add systemd user unit for running pat without root#530
mwthomson wants to merge 1 commit into
la5nta:developfrom
mwthomson:feature/systemd-user-unit

Conversation

@mwthomson

Copy link
Copy Markdown

Summary

Finishes the systemd user-unit packaging started by @raek in #459
(WIP commit raek/pat@70005bb). That commit added debian/pat.service
but never created its install directory in debian/rules, which
would have broken the .deb build — 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 like ax25.service, and worried
about a race condition on boot. Traced this in the Pat source:

  • Outbound transports (Ardop/Vara/AGWPE/AX.25/Pactor) are only
    initialized inside Connect(), triggered by the user — nothing
    runs at startup (app/connect.go).
  • Inbound listeners retry every second until their transport becomes
    available (app/listener_hub.go's listenLoop), logging
    "Will try to re-establish listener in the background..." rather
    than failing. The underlying AX.25 port check
    (wl2k-go/transport/ax25's checkPort) is a fast, non-blocking
    read, 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 -b succeeds and the built .deb
    contains lib/systemd/user/pat.service, byte-for-byte identical
    to debian/pat.service in the repo
  • go fmt ./..., go build ./..., and go test ./... all pass
    (no Go code changed by this PR)
  • systemctl --user start pat was not exercised against a real
    systemd 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 --user still
    needs confirmation on a real system before merge.

Fixes #459

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
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