Skip to content

fix: allow running gateway service as root for LXC/container environments - #4732

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3b5d0490
Apr 3, 2026
Merged

fix: allow running gateway service as root for LXC/container environments#4732
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3b5d0490

Conversation

@teknium1

@teknium1 teknium1 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Community users running Hermes in LXC containers (where root is the only user) were forced to comment out source code to install the gateway as a systemd service. The root check in _system_service_identity() hard-refused username == "root" regardless of whether it was explicitly requested.

What changed:

  • Auto-detected root (env vars resolve to root, no --run-as-user flag) → still refused, but error message now explains how to override
  • Explicit --run-as-user root → allowed with a warning about security implications
  • Interactive setup wizard prompt → accepts "root" as a valid username (warning comes downstream)

Behavior:

# In LXC as root — this now works:
sudo hermes gateway install --system --run-as-user root

# Without explicit flag — still refused with helpful message:
sudo hermes gateway install --system
# → 'Refusing to install ... pass --run-as-user root to override (e.g. in LXC containers)'

Files changed

  • hermes_cli/gateway.py — 3 touch points: _system_service_identity(), install_linux_gateway_from_setup()
  • tests/hermes_cli/test_gateway_service.py — 3 new tests covering auto-detected rejection, explicit allowance, non-root passthrough

Test plan

  • pytest tests/hermes_cli/test_gateway_service.py — 39 passed
  • Full suite: 7774 passed (13 pre-existing failures unrelated to this change)

Addresses community feedback from NathanOP and marioo9277 on Discord.

…ents

Previously, `hermes gateway install --system` hard-refused to create a
service running as root, even when explicitly requested via
`--run-as-user root`. This forced LXC/container users (where root is
the only user) to either create throwaway users or comment out the check
in source.

Changes:
- Auto-detected root (no explicit --run-as-user) still raises, but with
  a message explaining how to override
- Explicit `--run-as-user root` now allowed with a warning about
  security implications
- Interactive setup wizard prompt accepts 'root' as a valid username
  (warning comes from _system_service_identity downstream)
- Added tests for all three paths: auto-detected root rejection,
  explicit root allowance, and normal non-root passthrough
@teknium1
teknium1 merged commit 23addf4 into main Apr 3, 2026
5 of 6 checks passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…ents (NousResearch#4732)

Previously, `hermes gateway install --system` hard-refused to create a
service running as root, even when explicitly requested via
`--run-as-user root`. This forced LXC/container users (where root is
the only user) to either create throwaway users or comment out the check
in source.

Changes:
- Auto-detected root (no explicit --run-as-user) still raises, but with
  a message explaining how to override
- Explicit `--run-as-user root` now allowed with a warning about
  security implications
- Interactive setup wizard prompt accepts 'root' as a valid username
  (warning comes from _system_service_identity downstream)
- Added tests for all three paths: auto-detected root rejection,
  explicit root allowance, and normal non-root passthrough
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ents (NousResearch#4732)

Previously, `hermes gateway install --system` hard-refused to create a
service running as root, even when explicitly requested via
`--run-as-user root`. This forced LXC/container users (where root is
the only user) to either create throwaway users or comment out the check
in source.

Changes:
- Auto-detected root (no explicit --run-as-user) still raises, but with
  a message explaining how to override
- Explicit `--run-as-user root` now allowed with a warning about
  security implications
- Interactive setup wizard prompt accepts 'root' as a valid username
  (warning comes from _system_service_identity downstream)
- Added tests for all three paths: auto-detected root rejection,
  explicit root allowance, and normal non-root passthrough
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…ents (NousResearch#4732)

Previously, `hermes gateway install --system` hard-refused to create a
service running as root, even when explicitly requested via
`--run-as-user root`. This forced LXC/container users (where root is
the only user) to either create throwaway users or comment out the check
in source.

Changes:
- Auto-detected root (no explicit --run-as-user) still raises, but with
  a message explaining how to override
- Explicit `--run-as-user root` now allowed with a warning about
  security implications
- Interactive setup wizard prompt accepts 'root' as a valid username
  (warning comes from _system_service_identity downstream)
- Added tests for all three paths: auto-detected root rejection,
  explicit root allowance, and normal non-root passthrough
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…ents (NousResearch#4732)

Previously, `hermes gateway install --system` hard-refused to create a
service running as root, even when explicitly requested via
`--run-as-user root`. This forced LXC/container users (where root is
the only user) to either create throwaway users or comment out the check
in source.

Changes:
- Auto-detected root (no explicit --run-as-user) still raises, but with
  a message explaining how to override
- Explicit `--run-as-user root` now allowed with a warning about
  security implications
- Interactive setup wizard prompt accepts 'root' as a valid username
  (warning comes from _system_service_identity downstream)
- Added tests for all three paths: auto-detected root rejection,
  explicit root allowance, and normal non-root passthrough
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
…ents (NousResearch#4732)

Previously, `hermes gateway install --system` hard-refused to create a
service running as root, even when explicitly requested via
`--run-as-user root`. This forced LXC/container users (where root is
the only user) to either create throwaway users or comment out the check
in source.

Changes:
- Auto-detected root (no explicit --run-as-user) still raises, but with
  a message explaining how to override
- Explicit `--run-as-user root` now allowed with a warning about
  security implications
- Interactive setup wizard prompt accepts 'root' as a valid username
  (warning comes from _system_service_identity downstream)
- Added tests for all three paths: auto-detected root rejection,
  explicit root allowance, and normal non-root passthrough
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.

1 participant