Restart dashboard systemd unit after hermes update if one is installed - #69044
Closed
rahlquist wants to merge 2 commits into
Closed
Restart dashboard systemd unit after hermes update if one is installed#69044rahlquist wants to merge 2 commits into
hermes update if one is installed#69044rahlquist wants to merge 2 commits into
Conversation
`hermes update` only auto-restarts hermes-gateway* units; the dashboard is killed by PID and never relaunched, so users who installed a hermes-dashboard.service (systemd docs / packaging) get a silently dead dashboard after every update. Add `_restart_dashboard_via_service_manager()`, which probes for an active hermes-dashboard* systemd unit in both --user and system scope and restarts it via the same reset-failed -> restart (+ retry) -> is-active poll path used for gateways, including the non-interactive sudo -n privilege probe. When no systemd unit owns the dashboard, fall back to the existing PID-kill so the default (no service manager) behavior is unchanged. Fixes: dashboard not auto-restarting after `hermes update` when run as a systemd service.
Covers `_restart_dashboard_via_service_manager()` (added by the sibling fix commit): - no systemd support -> returns False (PID-kill fallback) - no hermes-dashboard* unit -> returns False - active user-scope unit -> restart issued (reset-failed + restart) + True - system-scope unit without non-interactive sudo -> skips, prints manual hint, returns True (no polkit hang) - first restart fails -> retries once and succeeds - inactive unit -> ignored, not restarted All 28 tests in the file pass; the new class is 6 tests.
Collaborator
Related: #40616 and #39166 address the same dashboard-update/systemd lifecycle. This patch uses active-unit discovery and restart-before-PID cleanup, while #40616 validates service ExecStart after cleanup; maintainer direction is needed on the intended service-management policy. |
Author
|
Apologies for the duplication |
Author
|
Closing as a duplicate of #40616 and #39166, which cover the same |
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.
Problem
hermes updateonly auto-restartshermes-gateway*systemd units. The web dashboard is killed by PID at the end of the update and never relaunched, so users who run the dashboard as a systemd service (hermes-dashboard.service, per the dashboard docs / packaging) end up with a silently dead dashboard after every update.Root cause confirmed in
hermes_cli/main.py:hermes-gateway*units (line ~11184),_kill_stale_dashboard_processes()(line ~6428) SIGTERMs the dashboard PID and prints a manual relaunch hint, with an explicit comment that the dashboard "has no service manager".Fix
Add
_restart_dashboard_via_service_manager(). At the end of the update, instead of unconditionally PID-killing the dashboard, it:hermes-dashboard*systemd unit in both--userand system scope (systemctl list-units hermes-dashboard*).reset-failed->restart(+ one retry) ->is-activepoll path already used for gateways, including the non-interactivesudo -nprivilege probe so it cannot hang on a polkit prompt._kill_stale_dashboard_processes) only when no systemd unit owns the dashboard — i.e. the upstream default (no service manager) behavior is fully preserved.Scope note: systemd-only. There is no standardized upstream launchd label for the dashboard (only the gateway has
get_launchd_label()), so adding launchd guesswork would be speculative. Linux systemd units are the real, reproducible case.Verification
75be8fb46(live install) and against the fresh fork clone (32a9f2a);git apply --checkpasses in both.ast.parse-valid.Restart=always) confirmed working independently on the reporter's machine.Test plan
hermes-dashboard.serviceactive:hermes updaterestarts it (visible insystemctl --user status hermes-dashboard).