fix: support HERMES_UID=0 by skipping usermod and privilege drop#35078
Closed
x1am1 wants to merge 1 commit into
Closed
fix: support HERMES_UID=0 by skipping usermod and privilege drop#35078x1am1 wants to merge 1 commit into
x1am1 wants to merge 1 commit into
Conversation
When HERMES_UID=0, usermod fails with 'UID 0 already exists' because root already owns that UID. The gateway silently falls back to uid 10000, defeating the purpose of the setting. Fix: detect HERMES_UID=0 in stage2-hook.sh, skip usermod, and set HERMES_RUN_AS_ROOT=1 in s6 container environment. main-wrapper.sh checks this flag and skips s6-setuidgid so the gateway runs as root. This makes HERMES_UID=0 work as documented — the gateway runs as root with no file permission issues.
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
HERMES_UID=0is documented as a way to run the gateway as root, but it does not work.stage2-hook.shrunsusermod -u 0 hermeswhich fails silently with:because UID 0 is already assigned to root. The gateway continues running as uid 10000 (hermes), and files created by
docker exec -u rootoperations remain root-owned, causingPermissionErrorongateway.lockanderrors.log→ gateway restart loop.Fix
Two files modified:
docker/stage2-hook.shHERMES_UID=0, skipusermod(would fail anyway)HERMES_RUN_AS_ROOT=1in s6 container environment as a signaldocker/main-wrapper.shHERMES_RUN_AS_ROOTflags6-setuidgid hermesprivilege dropTesting
Set
HERMES_UID=0andHERMES_GID=0in docker-compose.yml:After
docker compose up -d:docker exec hermes-agent whoamishould returnrootPermissionErrorin gateway logsRelated
Known issue documented in community skills: