hermes - ✅(Solved) Fix hermes update resets gateway systemd unit paths to CLI user home, breaking service account setups [1 pull requests, 1 comments, 2 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#25282Fetched 2026-05-14 03:47:32
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Error Message

  • Warn before overwriting a unit whose User= doesn't match the CLI user

Root Cause

Root Cause

Fix Action

Fixed

PR fix notes

PR #25298: fix(cli): preserve systemd unit paths when service user differs from CLI user

Description (problem / solution / changelog)

Summary

When a gateway systemd unit defines User= pointing to a dedicated system account (e.g. hermes, home /var/lib/hermes/), running hermes update would regenerate the unit with paths derived from the CLI user's home directory via _remap_path_for_user(). The remapped paths don't exist on disk, so the gateway fails to start after the update.

Fix: detect the service-user / CLI-user mismatch in refresh_systemd_unit_if_needed() and skip unit regeneration. The unit was hand-configured during the service-account migration and any path changes must be done deliberately by the admin.

Bugs Fixed

  • #25282hermes update resets gateway systemd unit paths to CLI user home, breaking service account deployments

Root Cause

_remap_path_for_user() swaps the CLI user's home prefix to the target user's home. When the gateway runs under a dedicated system account (not a regular user whose home mirrors the CLI user's directory structure), the remapped paths point to non-existent directories.

Testing

tests/hermes_cli/test_gateway_service.py: 132 passed

Files Changed

FileChange
hermes_cli/gateway.py+31 lines in refresh_systemd_unit_if_needed() — service-user mismatch guard

Closes #25282

Changed files

  • hermes_cli/gateway.py (modified, +31/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

After migrating the gateway to run under a dedicated unprivileged system account (hermes, home at /var/lib/hermes/), running hermes update regenerates the systemd unit and writes paths pointing to the CLI user's home (/home/user/.hermes/...) instead of the service account's home (/var/lib/hermes/.hermes/...).

Steps to Reproduce

1. Migrate gateway to service account:

   This creates hermes user, copies data to /var/lib/hermes/, updates the systemd unit.

2. Verify gateway runs correctly as hermes:

   systemctl status hermes-gateway  # active, User=hermes

3. Run hermes update as the CLI user

4. Gateway fails to start:

   hermes-gateway.service: Changing to the requested working directory failed: Permission denied
   hermes-gateway.service: Failed at step CHDIR spawning /home/user/.hermes/...: Permission denied


Root Cause

hermes update regenerates the systemd unit using $HOME expansion of the CLI user running the update, not the service account. Four directives get reverted to /home/user/...:

- ExecStart
- WorkingDirectory
- Environment="PATH=..."
- Environment="VIRTUAL_ENV=..."

While User=hermes, HOME=, and HERMES_HOME= stay correct — so the unit says "run as hermes" but points to paths hermes can't traverse.

Expected Behavior

hermes update should detect a service account mismatch and either:
- Preserve the existing unit paths, or
- Derive paths from the HERMES_HOME env var (already set correctly), or
- Warn before overwriting a unit whose User= doesn't match the CLI user

Environment

- Hermes v0.13.0 (2026.5.7), git install
- Ubuntu 25.10 amd64
- CLI user: user (sudo-capable)
- Gateway user: hermes (system account, nologin, no sudo)
- Gateway home: /var/lib/hermes

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

hermes - ✅(Solved) Fix hermes update resets gateway systemd unit paths to CLI user home, breaking service account setups [1 pull requests, 1 comments, 2 participants]