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 <noreply@anthropic.com>

* 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 <noreply@anthropic.com>
This commit is contained in:
Alexandre
2026-08-23 13:59:33 +02:00
committed by GitHub
parent cc8ebcfe7e
commit 1d70eca70a
5 changed files with 12 additions and 25 deletions

View File

@@ -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

View File

@@ -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" ]

View File

@@ -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"

View File

@@ -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

View File

@@ -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