fix: s6-overlay entrypoint crash — replace broken bash→tini→entrypoint.sh chain #56

Merged
gortium merged 2 commits from fix/hermes-s6-overlay-entrypoint-crash into master 2026-07-08 02:04:47 +00:00
Collaborator

Problem

The Hermes container crashes repeatedly with SIGTERM (signal 15) in a restart loop. The root cause is in compose.yml: the custom ENTRYPOINT chains bash → tini -g → deprecated entrypoint.sh, which bypasses s6-overlay's /init entirely.

This leaves S6_CMD_ARG0 unset, and the orphan -g flag from tini leaks into the positional args of rc.init, triggering:

/run/s6/basedir/scripts/rc.init: 91: -g: not found

The container exits → Docker restart: always → loop.

Fix

Three changes:

  1. compose.yml: Remove the custom entrypoint: override. The image's default ENTRYPOINT ["/init", "/opt/hermes/docker/main-wrapper.sh"] is now used. Change command: gateway run to command: ["/usr/local/bin/start-hermes.sh"].

  2. Dockerfile: Bake the new start-hermes.sh into the image at /usr/local/bin/ (same pattern as the existing run-multi-gateways.sh).

  3. start-hermes.sh (new): A multi-profile gateway launcher designed for s6-overlay's main-program model. It:

    • Starts per-profile background gateways from HERMES_PROFILES
    • Runs the default gateway in foreground (keeps container alive)
    • No gosu/tini needed — s6-overlay's main-wrapper.sh handles privilege dropping via s6-setuidgid

Before vs After

Before After
bash → tini -g → entrypoint.sh → stage2-hook.sh (exits) s6-overlay /init → main-wrapper.sh → start-hermes.sh
S6_CMD_ARG0 never set, -g orphan flag crashes rc.init /init sets env vars properly, clean arg passing
Container exits → Docker restart → loop Container stays alive with gateway running

The old /usr/local/bin/run-multi-gateways.sh is preserved but no longer called by the CMD.

## Problem The Hermes container crashes repeatedly with SIGTERM (signal 15) in a restart loop. The root cause is in `compose.yml`: the custom ENTRYPOINT chains `bash → tini -g → deprecated entrypoint.sh`, which **bypasses s6-overlay's `/init` entirely**. This leaves `S6_CMD_ARG0` unset, and the orphan `-g` flag from tini leaks into the positional args of `rc.init`, triggering: ``` /run/s6/basedir/scripts/rc.init: 91: -g: not found ``` The container exits → Docker `restart: always` → loop. ## Fix Three changes: 1. **`compose.yml`**: Remove the custom `entrypoint:` override. The image's default `ENTRYPOINT ["/init", "/opt/hermes/docker/main-wrapper.sh"]` is now used. Change `command: gateway run` to `command: ["/usr/local/bin/start-hermes.sh"]`. 2. **`Dockerfile`**: Bake the new `start-hermes.sh` into the image at `/usr/local/bin/` (same pattern as the existing `run-multi-gateways.sh`). 3. **`start-hermes.sh`** (new): A multi-profile gateway launcher designed for s6-overlay's main-program model. It: - Starts per-profile background gateways from `HERMES_PROFILES` - Runs the default gateway in foreground (keeps container alive) - No `gosu`/`tini` needed — s6-overlay's `main-wrapper.sh` handles privilege dropping via `s6-setuidgid` ## Before vs After | Before | After | |--------|-------| | `bash → tini -g → entrypoint.sh → stage2-hook.sh (exits)` | `s6-overlay /init → main-wrapper.sh → start-hermes.sh` | | `S6_CMD_ARG0` never set, `-g` orphan flag crashes rc.init | `/init` sets env vars properly, clean arg passing | | Container exits → Docker restart → loop | Container stays alive with gateway running | The old `/usr/local/bin/run-multi-gateways.sh` is preserved but no longer called by the CMD.
Hermes added 2 commits 2026-07-08 01:59:06 +00:00
The custom ENTRYPOINT chained bash -> tini -g -> deprecated entrypoint.sh,
bypassing s6-overlay's /init entirely. This left S6_CMD_ARG0 unset and the
orphan -g flag crashed rc.init with '-g: not found' -> SIGTERM -> restart loop.

Fix:
- Remove the ENTRYPOINT override so the image default is used:
  ENTRYPOINT ['/init', '/opt/hermes/docker/main-wrapper.sh']
- Change CMD to point at /opt/data/start-hermes.sh, a new launcher
  that starts per-profile gateways in background then the default
  gateway in foreground (via s6-overlay's main-program model).

The old /usr/local/bin/run-multi-gateways.sh is no longer called.
fix: add start-hermes.sh baked into image, replace broken ENTRYPOINT
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
f4dd57fa60
- New start-hermes.sh: multi-profile launcher that works with s6-overlay's
  main-program model (replaces bash->tini->entrypoint.sh chain)
- Dockerfile: COPY start-hermes.sh into /usr/local/bin/ alongside
  run-multi-gateways.sh (which is now unused but kept for reference)
- compose.yml: remove entrypoint override, CMD now points at
  /usr/local/bin/start-hermes.sh via the image default ENTRYPOINT

Fixes the SIGTERM crash loop caused by S6_CMD_ARG0 being unset when the
deprecated entrypoint.sh shim bypassed s6-overlay's /init.
gortium merged commit a7e463dcd6 into master 2026-07-08 02:04:47 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gortium/compose#56
No description provided.