Skip to content

[Bug]: docker container does not start from version 2026.5.28 #36208

Closed

Description

@karmeleon

Bug Description

When booting the official docker container, it fails to start:

[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=stopped action=registered
reconcile: profile=kanban-worker 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
→ gateway is now running under s6 supervision (auto-restart on crash,
  dashboard supervised alongside if HERMES_DASHBOARD is set).
  This is the recommended setup for the s6 container image — the
  gateway will keep running even if it crashes.
  Use `--no-supervise` (or HERMES_GATEWAY_NO_SUPERVISE=1) to opt out
  and get the pre-s6 foreground behavior instead.
Traceback (most recent call last):
  File "/opt/hermes/.venv/bin/hermes", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/opt/hermes/hermes_cli/main.py", line 14303, in main
    args.func(args)
    ~~~~~~~~~^^^^^^
  File "/opt/hermes/hermes_cli/main.py", line 1853, in cmd_gateway
    gateway_command(args)
    ~~~~~~~~~~~~~~~^^^^^^
  File "/opt/hermes/hermes_cli/gateway.py", line 5135, in gateway_command
    return _gateway_command_inner(args)
  File "/opt/hermes/hermes_cli/gateway.py", line 5228, in _gateway_command_inner
    if _maybe_redirect_run_to_s6_supervision(args):
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/opt/hermes/hermes_cli/gateway.py", line 5220, in _maybe_redirect_run_to_s6_supervision
    os.execvp("sleep", ["sleep", "infinity"])
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 612, in execvp
  File "<frozen os>", line 654, in _execvpe
  File "<frozen os>", line 645, in _execvpe
FileNotFoundError: [Errno 2] 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

Steps to Reproduce

  1. start docker container

I'm not doing anything unusual with it, though I did modify some system skills and install some python packages in the image.

Expected Behavior

hermes starts

Actual Behavior

hermes crashes

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp), Agent Core (conversation loop, context compression, memory)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

when I run it within the image I just get what appears to be a default output: https://paste.rs/HD3st

this is not my config

Operating System

Ubuntu 26.04

Python Version

whatever ships in the docker container

Hermes Version

2026.5.29 and up

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

courtesy of deepseek v4 flash:

The crash at os.execvp("sleep", ["sleep", "infinity"]) happens in _maybe_redirect_run_to_s6_supervision() after successfully dispatching the gateway to s6-supervise. It's supposed to keep the CMD process alive as a no-op heartbeat so /init doesn't start stage-3 shutdown.

Why does execvp("sleep", ...) fail?

The Python 3.13 _execvpe function calls get_exec_path(env) to build the search path list. get_exec_path reads the PATH environment variable from os.environ.

The most likely culprit: Under s6-overlay's environment model, the PATH that reaches Python might be affected. Here's the chain:

  1. /init invokes [main-wrapper.sh](http://main-wrapper.sh/) via #!/command/with-contenv sh — this loads env from /run/s6/container_environment/
  2. with-contenv runs as root, populates PATH from Dockerfile's ENV PATH=...
  3. Script sources .venv/bin/activate which prepends .venv/bin to PATH
  4. s6-setuidgid hermes drops privileges and exec's hermes gateway run
  5. Inside Python, os.execvp("sleep", ...) calls get_exec_path(os.environ) — but if PATH is somehow empty or truncated at this point, get_exec_path returns [""] or a list without /usr/bin, and the exec fails with ENOENT

I verified: get_exec_path with empty PATH "" returns [""], which makes os.path.join("", "sleep") = "sleep" — a relative path that fails. With a normal PATH, it works fine.

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. added
    type/bugSomething isn't working
    P1High — major feature broken, no workaround
    comp/gatewayGateway runner, session dispatch, delivery
    on Jun 1, 2026
  2. robotoole commented on Jun 1, 2026

    @robotoole

    Hitting the same 2026.5.28 s6 regression, but a different symptom on Fly.io Machines (and any runtime that doesn't exec the image entrypoint as PID 1). Filing here since it shares the root cause; happy to split into a separate issue if you'd prefer.

    Symptom

    On Fly Machines the container crash-loops immediately. The s6-overlay init aborts because it isn't PID 1:

    INFO Preparing to run: `/init /opt/hermes/docker/main-wrapper.sh gateway run` as root
    s6-overlay-suexec: fatal: can only run as pid 1
    INFO Main child exited normally with code: 100
    INFO Starting clean up.
    INFO Umounting /dev/vdc from /opt/data
    reboot: Restarting system
    

    …then it reboots and repeats forever. This is upstream of the execvp("sleep", …) traceback in the original report — here s6-overlay never gets far enough to start any service, it fatals at s6-overlay-suexec itself.

    Root cause / regression window (confirmed from image metadata)

    The entrypoint switched from tini to s6-overlay between the date-based tags, and s6-overlay's hard PID-1 requirement is what breaks on Fly:

    Tag Built Entrypoint Fly result
    v2026.5.16 2026-05-16 ["/usr/bin/tini","-g","--","/opt/hermes/docker/entrypoint.sh"] ✅ boots fine
    v2026.5.28 → latest (rebuilt 2026-06-01) … ["/init","/opt/hermes/docker/main-wrapper.sh"] ❌ can only run as pid 1, crash-loop

    The contrast is the key point: on the tini image, not being PID 1 is just a warning and it keeps running —

    Preparing to run: `/usr/bin/tini -g -- /opt/hermes/docker/entrypoint.sh gateway run` as root
    [WARN  tini (655)] Tini is not running as PID 1 and isn't registered as a child subreaper.
    

    — whereas s6-overlay treats it as fatal. On Fly Machines the platform's own init is PID 1 and execs the image entrypoint as a child, so /init is never PID 1.

    HERMES_GATEWAY_NO_SUPERVISE=1 / --no-supervise does not help here

    That opt-out is evaluated inside the Python gateway command (_maybe_redirect_run_to_s6_supervision in hermes_cli/gateway.py). Our crash is one layer earlier — at /init (s6-overlay-suexec) — which aborts before any hermes Python runs. So there's no env-var escape hatch for non-PID-1 runtimes; the only workaround today is pinning to a pre-2026.5.28 (tini) image.

    Suggested fixes

    1. Have main-wrapper.sh detect when it is not PID 1 and fall back to the pre-s6 foreground path (tini -- entrypoint.sh …) instead of exec /init. A simple [ "$$" -eq 1 ] check would cover Fly/Nomad/and similar.
    2. Or publish a non-s6 image variant/tag (tini-based) for PaaS runtimes that wrap the entrypoint.
    3. Or document the constraint so non-PID-1 platforms know to pin to a tini build.

    Environment

    • Fly.io Machines (Firecracker microVM), single machine, 4GB/2cpu, [processes] app = "gateway run", no [http_service].
    • Image: nousresearch/hermes-agent (Docker Hub). Broken: latest/main (rev 70e1571d, built 2026-06-01) and every tag from v2026.5.28. Last good: v2026.5.16 (rev a91a57fa).
    • Currently pinned to the v2026.5.16 digest to stay up.

    Happy to test a patched image on Fly if that's useful.

  3. Snurppa commented on Jun 7, 2026

    @Snurppa

    Hitting the same 2026.5.28 s6 regression, but a different symptom on Fly.io Machines (and any runtime that doesn't exec the image entrypoint as PID 1). Filing here since it shares the root cause; happy to split into a separate issue if you'd prefer.

    @robotoole I think you should file a separate issue. The PR touched only the other issue.

    Fly.io deployments still going down, from both v2026.6.5 and latest main tag (as of writing, this sha...

    Error s6-overlay-suexec: fatal: can only run as pid 1, same error as reported in #38349

    2026-06-07T20:28:00.074929959 [01KTHW7TYZBP648NSGM3HWWMA9:main] Running Firecracker v1.14.4
    2026-06-07T20:28:00.075187242 [01KTHW7TYZBP648NSGM3HWWMA9:main] Listening on API socket ("/fc.sock").
     INFO Starting init (commit: ea887ee)...
     INFO Checking filesystem on /opt/data
    /dev/vdc: clean, 22539/327040 files, 391445/1306624 blocks
     INFO Mounting /dev/vdc at /opt/data w/ uid: 0, gid: 0 and chmod 0755
     INFO Resized /opt/data to 5351931904 bytes
     INFO Preparing to run: `/init /opt/hermes/docker/main-wrapper.sh gateway run` as root
     INFO [fly api proxy] listening at /.fly/api
    s6-overlay-suexec: fatal: can only run as pid 1
     INFO Main child exited normally with code: 100
     INFO Starting clean up.
     INFO Umounting /dev/vdc from /opt/data
    [    1.878749] reboot: Restarting system
    machine has reached its max restart count of 5
    

    🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundarea/install-updateInstaller, updater, packaging, wheels, doctorbackend/dockerDocker container executioncomp/gatewayGateway runner, session dispatch, deliverytype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions