Repository navigation
Description
Bug Description
(There seem to be recent fixes related to this issue, but I believe this issue is distinct.)
Installed Hermes as a user (not root) on Ubuntu 24.04 Server (default OS install options).
I always ssh into the machine as a different user, and then to run commands as the hermes user I do this:
$ sudo su - hermes
The hermes-gateway service was installed to start as a user (not root). It seemed to work well, but after a reboot, the service would not start. Checking the status as the user hermes:
$ systemctl --user status hermes-gateway
Failed to connect to bus: No medium found
Steps to Reproduce
Install Hermes on Ubuntu 24.04 Server, as a user. Configure hermes-gateway to start via systemd as a user.
Expected Behavior
hermes-gateway should start automatically after a reboot.
Actual Behavior
hermes-gateway does not start
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp)
Messaging Platform (if gateway-related)
Slack
Debug Report
Report https://paste.rs/OE8zc
agent.log https://paste.rs/xsAc1
gateway.log https://paste.rs/lS44zOperating System
Ubuntu 24.04
Python Version
3.11.15
Hermes Version
Hermes Agent v0.16.0 (2026.6.5) · upstream 6110aed
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
No response
Proposed Fix (optional)
This is what fixed it.
As root:
# loginctl enable-linger hermes
As the hermes user:
$ systemctl --user enable --now hermes-gateway
(the --now part seems important)
And then to allow systemctl to work normally from the hermes user, I put this in ~/.profile:
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
And now hermes-gateway starts automatically after reboot, and systemctl works well as a user.
Are you willing to submit a PR for this?
- I'd like to fix this myself and submit a PR
Activity
FlorinAndrei commentedon Jun 23, 2026
Instead of exporting variables (
export XDG_RUNTIME_DIR="/run/user/$(id -u)") you could use machinectl to switch to the agent user account instead ofsudo su - USER:After that, running systemctl as the agent user seems fine.
I still did this as root, beforehand:
And I still did this as the agent user, after the Hermes installer ran:
This is on Ubuntu 26.04 with Hermes 0.17.0
teknium1 commentedon Jul 14, 2026
Thanks for documenting the reproduction and the
loginctl/user-service workaround. This is now covered on current main. Automated hermes-sweeper review found:hermes_cli/gateway.py:3206invokes_ensure_linger_enabled()after installing a user systemd unit; it attemptsloginctl enable-lingerand prints the required sudo command if authorization is unavailable.hermes_cli/gateway.py:1853restoresXDG_RUNTIME_DIRandDBUS_SESSION_BUS_ADDRESSfrom/run/user/<uid>before user-scopesystemctlcalls, specifically addressingFailed to connect to bus: No medium found.tests/hermes_cli/test_gateway_linger.py:40and:101cover both linger enablement and its installation-path invocation.website/docs/user-guide/messaging/index.md:462.Implemented by
f10e26f731ece83e750ccfec86f46753e918e827and subsequent headless user-D-Bus handling in60e38e82eca9c68e831506eeecf1b348699302cc.docs: four small accuracy fixes
fix(desktop): don't persist zoom fallback on a transient read failure (…
docs: four small accuracy fixes
docs: four small accuracy fixes
docs: four small accuracy fixes
docs: four small accuracy fixes