Skip to content

fix(docker): chown install dirs on HERMES_UID remap (#27221)#27243

Closed
Linux2010 wants to merge 1 commit into
NousResearch:mainfrom
Linux2010:fix/entrypoint-install-dir-chown-27221
Closed

fix(docker): chown install dirs on HERMES_UID remap (#27221)#27243
Linux2010 wants to merge 1 commit into
NousResearch:mainfrom
Linux2010:fix/entrypoint-install-dir-chown-27221

Conversation

@Linux2010

Copy link
Copy Markdown
Contributor

What broke

When HERMES_UID is remapped (e.g. to 99 for Unraid/Synology), usermod -u only auto-updates ownership inside the user's home directory ($HERMES_HOME). Files under $INSTALL_DIR/ui-tui/ and $INSTALL_DIR/gateway/ retain build-time UID 10000, causing:

  • TUI dashboard esbuild fails to write to dist/ → EACCES
  • Python fails to create __pycache__ under gateway/ → permission errors

Root cause

In docker/entrypoint.sh, the usermod -u chown block only covers $HERMES_HOME and $INSTALL_DIR/.venv. The install directories ui-tui/ and gateway/ are not included, so they keep their build-time owner after UID remap.

Why this fix is minimal

Adds a loop to chown ui-tui/ and gateway/ to the remapped hermes user, following the exact same pattern as the existing .venv chown. Each directory is guarded by -d (existence check) and stat -c %u (UID comparison) so it only runs when needed. Non-rootless Podman users and unremapped installs are unaffected.

What I tested

Added tests/docker/test_entrypoint_uid_remap.py:

  • test_ui_tui_chown_present — ui-tui/ referenced in needs_chown block
  • test_gateway_chown_present — gateway/ referenced in needs_chown block
  • test_chown_uses_hermes_user — loop uses hermes:hermes
  • test_chown_guarded_by_directory_check-d guard present
  • test_chown_guarded_by_uid_checkstat -c %u guard present

What I intentionally did not change

  • $HERMES_HOME chown behavior
  • .venv chown behavior
  • Any non-Docker deployment paths
  • Config file permission handling

When HERMES_UID is remapped (e.g. to 99 for Unraid/Synology), usermod -u
only auto-updates ownership inside the user's home directory. Files under
$INSTALL_DIR/ui-tui/ and $INSTALL_DIR/gateway/ retain build-time UID
10000, causing EACCES on:
- TUI dashboard esbuild writes to dist/
- Python __pycache__ creation under gateway/

Fix: add a loop to chown ui-tui/ and gateway/ to the remapped hermes
user, following the same pattern as the existing .venv chown.

Test: add tests/docker/test_entrypoint_uid_remap.py to verify the chown
logic for both directories is present and guarded.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists area/docker Docker image, Compose, packaging labels May 17, 2026
@cardtest15-coder

This comment was marked as spam.

@cardtest15-coder

This comment was marked as spam.

@cardtest15-coder

This comment was marked as spam.

@Linux2010

Copy link
Copy Markdown
Contributor Author

Closing due to multiple CI failures (attribution + test + ruff). PR is stale (created May 17). Will re-create if still needed after attribution fix.

@Linux2010 Linux2010 closed this May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docker Docker image, Compose, packaging P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants