hermes - ✅(Solved) Fix Allow `hermes gateway install --force` to work inside containers with systemd [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#11598Fetched 2026-04-18 06:00:01
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1

Error Message

Some users run Hermes in systemd-enabled containers (e.g. systemd as PID 1 inside Docker). In these environments, systemd user services work perfectly well — systemctl --user is functional, loginctl enable-linger works, and services persist across restarts. The current behavior forces these users to manually create the systemd unit file, which is error-prone.

Fix Action

Fix / Workaround

Current Workaround

PR fix notes

PR #11599: fix: allow --force to override container detection in gateway install

Description (problem / solution / changelog)

Summary

Fixes #11598

When running inside a Docker/Podman container that has systemd available, hermes gateway install is unconditionally blocked — even with --force. This PR makes --force bypass the container detection and proceed with systemd service installation when systemctl is present.

Changes

  • hermes_cli/gateway.py: In the install subcommand handler, when is_container() is True and --force is passed, check for systemctl availability and call systemd_install() instead of exiting with the Docker restart policy message.
  • Without --force, behavior is completely unchanged.
  • When --force is used but systemctl is not available, a helpful hint is shown.

Testing

Manually tested in a systemd-enabled Docker container (Ubuntu 24.04):

# Without --force: still shows the container message (unchanged behavior)
$ hermes gateway install
Service installation is not needed inside a Docker container.
...

# With --force and systemd available: installs successfully
$ hermes gateway install --force
⚠ Container environment detected — installing service anyway (--force).
  Ensure systemd is running inside the container for this to work.
Installing user systemd service to: ~/.config/systemd/user/hermes-gateway.service

Before / After

ScenarioBeforeAfter
Container, no --forceShows Docker message, exitsShows Docker message, exits (unchanged)
Container, --force, systemd presentShows Docker message, exitsInstalls systemd service
Container, --force, no systemdShows Docker message, exitsShows Docker message + hint about systemctl

Changed files

  • hermes_cli/gateway.py (modified, +16/-8)

Code Example

$ hermes gateway install
Service installation is not needed inside a Docker container.
The container runtime is your service manager — use Docker restart policies instead:
  ...

---

$ hermes gateway install --force
Service installation is not needed inside a Docker container.
The container runtime is your service manager — use Docker restart policies instead:
  ...

---

mkdir -p ~/.config/systemd/user/
# Write the service file manually...
systemctl --user daemon-reload
systemctl --user enable --now hermes-gateway.service
RAW_BUFFERClick to expand / collapse

Problem

When running Hermes inside a Docker/Podman container that has systemd available (e.g. systemd-enabled containers), hermes gateway install is unconditionally blocked:

$ hermes gateway install
Service installation is not needed inside a Docker container.
The container runtime is your service manager — use Docker restart policies instead:
  ...

This is reasonable as a default, but there is no way to override it — even with --force:

$ hermes gateway install --force
Service installation is not needed inside a Docker container.
The container runtime is your service manager — use Docker restart policies instead:
  ...

Use Case

Some users run Hermes in systemd-enabled containers (e.g. systemd as PID 1 inside Docker). In these environments, systemd user services work perfectly well — systemctl --user is functional, loginctl enable-linger works, and services persist across restarts. The current behavior forces these users to manually create the systemd unit file, which is error-prone.

Expected Behavior

hermes gateway install --force should bypass the container detection and proceed with systemd service installation when systemctl is available inside the container.

Current Workaround

Manually create the systemd user unit file based on the template in generate_systemd_unit():

mkdir -p ~/.config/systemd/user/
# Write the service file manually...
systemctl --user daemon-reload
systemctl --user enable --now hermes-gateway.service

Suggested Fix

In hermes_cli/gateway.py, when the install subcommand encounters is_container() == True and --force is passed, check if systemctl is available and proceed with systemd_install() instead of exiting.

Happy to submit a PR for this.

extent analysis

TL;DR

The issue can be resolved by modifying the hermes_cli/gateway.py to check for systemctl availability and proceed with systemd_install() when --force is passed in a container environment.

Guidance

  • Check if systemctl is available inside the container by verifying the output of which systemctl or command -v systemctl.
  • Modify the is_container() check in hermes_cli/gateway.py to also consider the availability of systemctl when --force is passed.
  • Proceed with systemd_install() when systemctl is available and --force is passed, instead of exiting.
  • Test the modified code to ensure it works as expected in both container and non-container environments.

Example

if is_container() and '--force' in sys.argv:
    if shutil.which('systemctl'):
        systemd_install()
    else:
        print("Service installation is not needed inside a Docker container.")

Notes

The suggested fix assumes that the presence of systemctl inside the container indicates that systemd is available and functional. However, this may not always be the case, and additional checks may be necessary to ensure compatibility.

Recommendation

Apply the suggested workaround by modifying the hermes_cli/gateway.py file to check for systemctl availability and proceed with systemd_install() when --force is passed. This will allow users to override the default behavior and install the systemd service inside a container environment.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING