Skip to content

Fix container restart loop caused by missing source files in entrypoint seed block#22

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-restart-loop-issue
Draft

Fix container restart loop caused by missing source files in entrypoint seed block#22
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-restart-loop-issue

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

The upstream nousresearch/hermes-agent .dockerignore excludes .env.example and all *.md files from the build context, so /opt/hermes/.env.example and /opt/hermes/docker/SOUL.md don't exist in the image. With set -e active, the unconditional cp against these missing sources aborts the entrypoint, triggering a restart loop.

Changes

  • entrypoint.sh: Add [ -f "$INSTALL_DIR/<src>" ] guards to all three seed cp commands, mirroring the upstream stage2-hook.sh seed_one pattern — skip silently if the source is absent rather than hard-failing:
# Before
if [ ! -f "$HERMES_HOME/.env" ]; then
    cp "$INSTALL_DIR/.env.example" "$HERMES_HOME/.env"
fi

# After
if [ ! -f "$HERMES_HOME/.env" ] && [ -f "$INSTALL_DIR/.env.example" ]; then
    cp "$INSTALL_DIR/.env.example" "$HERMES_HOME/.env"
fi

Applied to all three: .env.example, cli-config.yaml.example, and docker/SOUL.md. The upstream's stage2-hook.sh cont-init already handles seeding these files when they exist; our copies are a defensive fallback.

The upstream nousresearch/hermes-agent:v2026.6.5 replaced tini with
s6-overlay for PID 1 supervision, and added a backward-compat shim:
  ln -sf /init /usr/bin/tini

Our entrypoint was calling `exec tini -g -- "$0" "$@"` which became
`exec /init -g -- /usr/local/bin/entrypoint.sh gateway run`. s6-overlay
treated `-g` as the CMD to run, so rc.init at line 91 tried to execute
`-g` as a command -> not found -> container crashed -> restart loop.

Fix:
- Dockerfile: use `/init` as PID 1 via ENTRYPOINT ["/init", "/usr/local/bin/entrypoint.sh"]
- entrypoint.sh: change shebang to #!/command/with-contenv bash so
  s6-overlay properly repopulates environment variables before our
  script runs; remove the tini-wrapping block that caused the crash
Copilot AI changed the title [WIP] Fix version restart loop issue Fix restart loop caused by tini→s6-overlay shim in upstream v2026.6.5 Jun 11, 2026
Copilot AI requested a review from Pol-Lanski June 11, 2026 17:05
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

Dappnode bot has built and pinned the built packages to an IPFS node, for commit: 39d8385

This is a development version and should only be installed for testing purposes.

  1. Package hermes-agent.dnp.dappnode.eth

Install link

Hash: /ipfs/QmPWPD1hQRphrmRgKWKGRJAMF2i75uoBgjKKQy5buZfmAh

(by dappnodebot/build-action)

@Pol-Lanski

Pol-Lanski commented Jun 12, 2026

Copy link
Copy Markdown
Member

@copilot Not working. This comes up:

/package/admin/s6-overlay/libexec/preinit: info: container permissions: uid=0 (root), euid=0, gid=0 (root), egid=0
/package/admin/s6-overlay/libexec/preinit: info: /run permissions: uid=0 (root), gid=0 (root), perms=oxorgxgruxuwur
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/01-hermes-setup
Syncing bundled skills into ~/.hermes/skills/ ...

Done: 0 new, 0 updated, 74 unchanged. 74 total bundled.
[stage2] Found agent-browser Chromium binary: /opt/hermes/.playwright/chromium_headless_shell-1223/chrome-headless-shell-linux64/chrome-headless-shell
[stage2] Setup complete; starting user services
cont-init: info: /etc/cont-init.d/01-hermes-setup exited 0
cont-init: info: running /etc/cont-init.d/015-supervise-perms
[supervise-perms] chowned supervise/ trees for static s6-rc services
cont-init: info: /etc/cont-init.d/015-supervise-perms exited 0
cont-init: info: running /etc/cont-init.d/02-reconcile-profiles
reconcile: profile=default prior_state=None action=registered
cont-init: info: /etc/cont-init.d/02-reconcile-profiles exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service main-hermes: starting
s6-rc: info: service dashboard: starting
s6-rc: info: service main-hermes successfully started
s6-rc: info: service dashboard successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Dropping root privileges
cp: cannot stat '/opt/hermes/.env.example': No such file or directory
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service main-hermes: stopping
s6-rc: info: service dashboard: stopping
s6-rc: info: service dashboard successfully stopped
s6-rc: info: service main-hermes successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: warning: service s6rc-oneshot-runner is marked as essential, not stopping it

The upstream .dockerignore excludes .env.example and *.md files from
the image, so /opt/hermes/.env.example and /opt/hermes/docker/SOUL.md
do not exist inside the container. With set -e in the entrypoint, the
unconditional `cp` on a missing source causes the script to exit with
an error, triggering a container restart loop.

Mirror the upstream stage2-hook.sh `seed_one` pattern: add a
`[ -f "$INSTALL_DIR/<src>" ]` guard to all three cp seed commands so
they are silently skipped when the source file is absent.
Copilot AI changed the title Fix restart loop caused by tini→s6-overlay shim in upstream v2026.6.5 Fix container restart loop caused by missing source files in entrypoint seed block Jun 12, 2026
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.

2 participants