From 6717cfc80519b1e0efc3830ae628827c77debc72 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 27 Jun 2026 19:04:29 -0700 Subject: [PATCH] docs(gateway): warn against custom ExecStopPost kill drop-in (restart loop) (#53903) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A user-added systemd drop-in like ExecStopPost=/bin/kill -9 $MAINPID fires on every stop, including clean restarts — it SIGKILLs the freshly spawned gateway before it stabilizes and Restart=always respawns it, producing an infinite restart loop (issue #23272). The unit Hermes installs already shuts down cleanly via KillMode=mixed + KillSignal=SIGTERM with Restart=always + RestartForceExitStatus, so no extra kill is needed. Document this as a danger callout in the gateway service-management section. --- website/docs/user-guide/messaging/index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/website/docs/user-guide/messaging/index.md b/website/docs/user-guide/messaging/index.md index 289d2eaec..0e91be6e1 100644 --- a/website/docs/user-guide/messaging/index.md +++ b/website/docs/user-guide/messaging/index.md @@ -435,6 +435,10 @@ journalctl -u hermes-gateway -f Use the user service on laptops and dev boxes. Use the system service on VPS or headless hosts that should come back at boot without relying on systemd linger. +:::danger Don't add a custom `ExecStopPost` kill drop-in +The unit Hermes installs already shuts the gateway down cleanly with `KillMode=mixed` + `KillSignal=SIGTERM`, and uses `Restart=always` with `RestartForceExitStatus` so updates and `/restart` respawn correctly. Do **not** add a systemd drop-in such as `ExecStopPost=/bin/kill -9 $MAINPID` — `ExecStopPost` fires on *every* stop, including clean restarts, so it `SIGKILL`s the freshly spawned instance before it stabilizes and `Restart=always` immediately respawns it. The result is an infinite restart loop (and, on Telegram, a flood of restart messages). If you've added such a drop-in, remove it: `systemctl --user edit hermes-gateway` (or `sudo systemctl edit hermes-gateway` for a system service) and delete the `ExecStopPost` line, then `systemctl --user daemon-reload`. +::: + :::tip Headless VMs: user service + linger avoids root prompts A system service needs root for every restart — including the automatic gateway restart at the end of `hermes update`. When `hermes update` runs as a non-root user, it tries passwordless `sudo systemctl`; if that's unavailable, it skips the restart and prints the manual `sudo systemctl restart hermes-gateway` command (it never blocks on an interactive password prompt).