From 1d70eca70a61fc5db4c82ebcd3295505101c3199 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 23 Aug 2026 13:59:33 +0200 Subject: [PATCH] fix(portainer_agent): make the healthcheck runnable again (needs version bump before merge) (#3005) * fix(portainer_agent): make the healthcheck runnable again rootfs/usr/sbin/healthcheck line 1 was `#!/usr/bin/with-contenv bash`. with-contenv runs `s6-envdir -Lf -- /run/s6/container_environment`, which fails when that directory does not exist. This addon overrides the base image's `ENTRYPOINT ["/init"]` with `/usr/bin/env /ha_entrypoint.sh` (Dockerfile:88-89), and ha_entrypoint.sh runs the cont-init and services.d scripts itself instead of handing over to s6-overlay, so s6 stage 1 never runs and that directory is never created. ha_entrypoint.sh rewrites the shebang of everything under /etc/cont-init.d and /etc/services.d, which is why the service `run` script works. Nothing rewrites /usr/sbin/healthcheck, so Docker's HEALTHCHECK died on the shebang before reaching the curl - exit 1, no output, forever unhealthy. The script only needs curl and hardcoded values, so plain bash is enough. Closes #3002 Co-Authored-By: Claude Opus 5 * fix(portainer_agent): bump version, remove unused wait-for-signal script Delete rootfs/usr/sbin/wait-for-signal (unused, broken expr, same bad shebang) and its chmod in the Dockerfile. Bump version to 2025.12.7 to match the CHANGELOG entry so Supervisor offers the healthcheck fix. Co-authored-by: Alexandre <44178713+alexbelgium@users.noreply.github.com> --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 --- portainer_agent/CHANGELOG.md | 5 +++++ portainer_agent/Dockerfile | 3 +-- portainer_agent/config.yaml | 2 +- portainer_agent/rootfs/usr/sbin/healthcheck | 6 +++++- .../rootfs/usr/sbin/wait-for-signal | 21 ------------------- 5 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 portainer_agent/rootfs/usr/sbin/wait-for-signal diff --git a/portainer_agent/CHANGELOG.md b/portainer_agent/CHANGELOG.md index 387e246f9a..bdfa4e309e 100644 --- a/portainer_agent/CHANGELOG.md +++ b/portainer_agent/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2025.12.7 (2026-08-23) + +- Fix: Docker reported the addon as `unhealthy` in Portainer. The healthcheck script could never run because its shebang required the s6-overlay environment, which this addon's entrypoint does not set up (https://github.com/alexbelgium/hassio-addons/issues/3002) +- Remove the unused and broken `wait-for-signal` script; nothing invoked it + ## 2025.12.6 (2026-08-01) - Version renamed from `2025.12-6`, which Home Assistant could not order and therefore could not reliably offer as an update: every number of the previous version is kept, as a section of its own. The addon itself and the upstream version it tracks are unchanged diff --git a/portainer_agent/Dockerfile b/portainer_agent/Dockerfile index cbdc4890c8..6cf096495a 100644 --- a/portainer_agent/Dockerfile +++ b/portainer_agent/Dockerfile @@ -81,8 +81,7 @@ RUN chmod 777 /ha_entrypoint.sh COPY bashio-standalone.sh /usr/local/lib/bashio-standalone.sh RUN chmod 0755 /usr/local/lib/bashio-standalone.sh -RUN chmod a+x /usr/sbin/healthcheck && \ - chmod a+x /usr/sbin/wait-for-signal +RUN chmod a+x /usr/sbin/healthcheck WORKDIR "/app" ENTRYPOINT [ "/usr/bin/env" ] diff --git a/portainer_agent/config.yaml b/portainer_agent/config.yaml index af1b851e1a..80248c9b13 100644 --- a/portainer_agent/config.yaml +++ b/portainer_agent/config.yaml @@ -41,4 +41,4 @@ schema: slug: portainer_agent udev: true url: https://github.com/alexbelgium/hassio-addons -version: "2025.12.6" +version: "2025.12.7" diff --git a/portainer_agent/rootfs/usr/sbin/healthcheck b/portainer_agent/rootfs/usr/sbin/healthcheck index 7fb607a382..0fbd41134e 100644 --- a/portainer_agent/rootfs/usr/sbin/healthcheck +++ b/portainer_agent/rootfs/usr/sbin/healthcheck @@ -1,4 +1,8 @@ -#!/usr/bin/with-contenv bash +#!/usr/bin/env bash +# shellcheck shell=bash +# Plain bash on purpose : ha_entrypoint.sh replaces s6-overlay's /init, so +# /run/s6/container_environment is never created and a with-contenv shebang +# would fail before this script runs. Nothing here needs the s6 environment. if [ -f "/tmp/healthcheck-signal" ]; then curl -k --fail https://127.0.0.1:9001/ping || exit 1 diff --git a/portainer_agent/rootfs/usr/sbin/wait-for-signal b/portainer_agent/rootfs/usr/sbin/wait-for-signal deleted file mode 100644 index a50cfb6984..0000000000 --- a/portainer_agent/rootfs/usr/sbin/wait-for-signal +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/with-contenv bashio - -START_TIME="$(date +%s)" - -echo "Waiting for first healthcheck execution (max $FIRST_HEALTHCHECK_TIMEOUT seconds)..." - -while [ ! -f "/tmp/healthcheck-signal" ]; -do - sleep 1 - - ELAPSED_TIME="$(expr \date +%s\ - $START_TIME)" - - if [ $ELAPSED_TIME -gt $FIRST_HEALTHCHECK_TIMEOUT ] - then - echo "Signal from healthcheck not received in time, failing the execution..." - exit 20 - fi -done - -echo "Signal from healthcheck received" -exit 0 \ No newline at end of file