fix(docker): don't chown config.yaml after gosu drop (#15865)#16096
Merged
Conversation
The chown/chmod block on config.yaml was added in b24d239 to keep the file readable by the hermes runtime user, but it sat in the post-gosu 'running as hermes' section of the entrypoint. That meant: 1. Default `docker run <image>` — container starts as root, entrypoint drops to hermes via gosu, then non-root hermes tries to chown the file to hermes. Works by coincidence because the file was just created by root during volume setup and gosu target == target owner. 2. `docker run -u $(id -u):$(id -g) <image>` (#15865) — container starts as the caller's UID. The root block is skipped entirely, we land in the hermes section as some arbitrary non-root user, and chown to 'hermes' fails with 'Operation not permitted'. Script aborts under `set -e`. Move the chown/chmod into the root block (before the gosu exec) where it actually has privilege, and guard with `2>/dev/null || true` so rootless Podman (where even in-container root lacks host-side chown rights) doesn't abort either. Closes #15865
1 task
mayssamj
pushed a commit
to mayssamj/hermes-agent
that referenced
this pull request
Apr 26, 2026
) (NousResearch#16096) The chown/chmod block on config.yaml was added in b24d239 to keep the file readable by the hermes runtime user, but it sat in the post-gosu 'running as hermes' section of the entrypoint. That meant: 1. Default `docker run <image>` — container starts as root, entrypoint drops to hermes via gosu, then non-root hermes tries to chown the file to hermes. Works by coincidence because the file was just created by root during volume setup and gosu target == target owner. 2. `docker run -u $(id -u):$(id -g) <image>` (NousResearch#15865) — container starts as the caller's UID. The root block is skipped entirely, we land in the hermes section as some arbitrary non-root user, and chown to 'hermes' fails with 'Operation not permitted'. Script aborts under `set -e`. Move the chown/chmod into the root block (before the gosu exec) where it actually has privilege, and guard with `2>/dev/null || true` so rootless Podman (where even in-container root lacks host-side chown rights) doesn't abort either. Closes NousResearch#15865
1 task
19 tasks
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
) (NousResearch#16096) The chown/chmod block on config.yaml was added in 647518a to keep the file readable by the hermes runtime user, but it sat in the post-gosu 'running as hermes' section of the entrypoint. That meant: 1. Default `docker run <image>` — container starts as root, entrypoint drops to hermes via gosu, then non-root hermes tries to chown the file to hermes. Works by coincidence because the file was just created by root during volume setup and gosu target == target owner. 2. `docker run -u $(id -u):$(id -g) <image>` (NousResearch#15865) — container starts as the caller's UID. The root block is skipped entirely, we land in the hermes section as some arbitrary non-root user, and chown to 'hermes' fails with 'Operation not permitted'. Script aborts under `set -e`. Move the chown/chmod into the root block (before the gosu exec) where it actually has privilege, and guard with `2>/dev/null || true` so rootless Podman (where even in-container root lacks host-side chown rights) doesn't abort either. Closes NousResearch#15865
donald131
pushed a commit
to donald131/hermes-agent
that referenced
this pull request
May 2, 2026
) (NousResearch#16096) The chown/chmod block on config.yaml was added in b24d239 to keep the file readable by the hermes runtime user, but it sat in the post-gosu 'running as hermes' section of the entrypoint. That meant: 1. Default `docker run <image>` — container starts as root, entrypoint drops to hermes via gosu, then non-root hermes tries to chown the file to hermes. Works by coincidence because the file was just created by root during volume setup and gosu target == target owner. 2. `docker run -u $(id -u):$(id -g) <image>` (NousResearch#15865) — container starts as the caller's UID. The root block is skipped entirely, we land in the hermes section as some arbitrary non-root user, and chown to 'hermes' fails with 'Operation not permitted'. Script aborts under `set -e`. Move the chown/chmod into the root block (before the gosu exec) where it actually has privilege, and guard with `2>/dev/null || true` so rootless Podman (where even in-container root lacks host-side chown rights) doesn't abort either. Closes NousResearch#15865
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
) (NousResearch#16096) The chown/chmod block on config.yaml was added in b24d239 to keep the file readable by the hermes runtime user, but it sat in the post-gosu 'running as hermes' section of the entrypoint. That meant: 1. Default `docker run <image>` — container starts as root, entrypoint drops to hermes via gosu, then non-root hermes tries to chown the file to hermes. Works by coincidence because the file was just created by root during volume setup and gosu target == target owner. 2. `docker run -u $(id -u):$(id -g) <image>` (NousResearch#15865) — container starts as the caller's UID. The root block is skipped entirely, we land in the hermes section as some arbitrary non-root user, and chown to 'hermes' fails with 'Operation not permitted'. Script aborts under `set -e`. Move the chown/chmod into the root block (before the gosu exec) where it actually has privilege, and guard with `2>/dev/null || true` so rootless Podman (where even in-container root lacks host-side chown rights) doesn't abort either. Closes NousResearch#15865
dannyJ848
pushed a commit
to dannyJ848/hermes-agent
that referenced
this pull request
May 17, 2026
) (NousResearch#16096) The chown/chmod block on config.yaml was added in ae9d2c4 to keep the file readable by the hermes runtime user, but it sat in the post-gosu 'running as hermes' section of the entrypoint. That meant: 1. Default `docker run <image>` — container starts as root, entrypoint drops to hermes via gosu, then non-root hermes tries to chown the file to hermes. Works by coincidence because the file was just created by root during volume setup and gosu target == target owner. 2. `docker run -u $(id -u):$(id -g) <image>` (NousResearch#15865) — container starts as the caller's UID. The root block is skipped entirely, we land in the hermes section as some arbitrary non-root user, and chown to 'hermes' fails with 'Operation not permitted'. Script aborts under `set -e`. Move the chown/chmod into the root block (before the gosu exec) where it actually has privilege, and guard with `2>/dev/null || true` so rootless Podman (where even in-container root lacks host-side chown rights) doesn't abort either. Closes NousResearch#15865
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
) (NousResearch#16096) The chown/chmod block on config.yaml was added in b24d239 to keep the file readable by the hermes runtime user, but it sat in the post-gosu 'running as hermes' section of the entrypoint. That meant: 1. Default `docker run <image>` — container starts as root, entrypoint drops to hermes via gosu, then non-root hermes tries to chown the file to hermes. Works by coincidence because the file was just created by root during volume setup and gosu target == target owner. 2. `docker run -u $(id -u):$(id -g) <image>` (NousResearch#15865) — container starts as the caller's UID. The root block is skipped entirely, we land in the hermes section as some arbitrary non-root user, and chown to 'hermes' fails with 'Operation not permitted'. Script aborts under `set -e`. Move the chown/chmod into the root block (before the gosu exec) where it actually has privilege, and guard with `2>/dev/null || true` so rootless Podman (where even in-container root lacks host-side chown rights) doesn't abort either. Closes NousResearch#15865
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
) (NousResearch#16096) The chown/chmod block on config.yaml was added in 6436a59 to keep the file readable by the hermes runtime user, but it sat in the post-gosu 'running as hermes' section of the entrypoint. That meant: 1. Default `docker run <image>` — container starts as root, entrypoint drops to hermes via gosu, then non-root hermes tries to chown the file to hermes. Works by coincidence because the file was just created by root during volume setup and gosu target == target owner. 2. `docker run -u $(id -u):$(id -g) <image>` (NousResearch#15865) — container starts as the caller's UID. The root block is skipped entirely, we land in the hermes section as some arbitrary non-root user, and chown to 'hermes' fails with 'Operation not permitted'. Script aborts under `set -e`. Move the chown/chmod into the root block (before the gosu exec) where it actually has privilege, and guard with `2>/dev/null || true` so rootless Podman (where even in-container root lacks host-side chown rights) doesn't abort either. Closes NousResearch#15865
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.
Summary
Fixes
chown: changing ownership of '/opt/data/config.yaml': Operation not permittedwhen running the docker image with-u $(id -u):$(id -g). Regression from b24d239 (Apr 15, v2026.4.23).Root cause
The chown/chmod block for
config.yamllives in the entrypoint's post-gosu 'running as hermes' section, not the root section. When the container is started with an explicit-uflag, the root block (lines 12-46) is skipped entirely, execution falls through to line 72 as the caller's UID (non-root, nothermes), andchown hermes:hermesfails. Underset -ethis aborts the whole startup.Changes
docker/entrypoint.sh: move the config.yaml chown/chmod into the root block (before the gosu exec), add2>/dev/null || trueguards to match the-Rchown on HERMES_HOME for rootless Podman compatibility.Validation
docker run <image> setup(default, root start)docker run -u $(id -u):$(id -g) <image> setupLocal E2E harness confirms
chown <other-user>underset -ewith the|| trueguard does not abort the script.Closes #15865