From 43e44deb957e2c8886d86fbbab66dfd094af7bb9 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:57:14 +0200 Subject: [PATCH 1/9] Fix BirdNET-Pi standalone PHP startup --- birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh b/birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh index db5117b0a4..3d36e0b8e1 100755 --- a/birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh +++ b/birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh @@ -4,12 +4,13 @@ # Correct /config permissions after startup chown pi:pi /config -# Waiting for dbus -until [[ -e /var/run/dbus/system_bus_socket ]]; do - sleep 1s -done +# D-Bus is not guaranteed to be available in standalone Docker mode. Use the +# configured TZ directly and only query timedatectl when its bus is ready. +TZ_VALUE="${TZ:-}" +if [[ -S /var/run/dbus/system_bus_socket ]] && command -v timedatectl > /dev/null 2>&1; then + TZ_VALUE="$(timedatectl show -p Timezone --value 2> /dev/null || true)" +fi +export TZ="${TZ_VALUE:-Etc/UTC}" -TZ_VALUE="$(timedatectl show -p Timezone --value)" -export TZ="$TZ_VALUE" -echo "Starting service: php pfm" +echo "Starting service: php fpm" exec /usr/sbin/php-fpm* -F From d3322da5a58234fce19e4029a422bb138427c4bd Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:57:21 +0200 Subject: [PATCH 2/9] Fix BirdNET-Pi standalone Caddy startup --- .../rootfs/custom-services.d/02-caddy.sh | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/birdnet-pi/rootfs/custom-services.d/02-caddy.sh b/birdnet-pi/rootfs/custom-services.d/02-caddy.sh index a5d18e8678..e009a13efd 100755 --- a/birdnet-pi/rootfs/custom-services.d/02-caddy.sh +++ b/birdnet-pi/rootfs/custom-services.d/02-caddy.sh @@ -1,25 +1,29 @@ #!/usr/bin/with-contenv bashio # shellcheck shell=bash -# Dependencies -sockfile="empty" -until [[ -e /var/run/dbus/system_bus_socket ]] && [[ -e "$sockfile" ]]; do +# Wait for PHP-FPM only. D-Bus is optional in standalone Docker mode and must +# not prevent the web service from starting. +sockfile="" +until [[ -n "$sockfile" ]] && [[ -e "$sockfile" ]]; do sleep 1s - sockfile="$(find /run/php -name "*.sock")" + sockfile="$(find /run/php -name "*.sock" -print -quit 2> /dev/null || true)" done # Correct fpm.sock -chown caddy:caddy /run/php/php*-fpm.sock +chown caddy:caddy "$sockfile" sed -i "s|/run/php/php-fpm.sock|$sockfile|g" /helpers/caddy_ingress.sh sed -i "s|/run/php/php-fpm.sock|$sockfile|g" /etc/caddy/Caddyfile sed -i "s|/run/php/php-fpm.sock|$sockfile|g" "$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh -# Set timezone -TZ_VALUE="$(timedatectl show -p Timezone --value)" -export TZ="$TZ_VALUE" +# Set timezone without requiring D-Bus. +TZ_VALUE="${TZ:-}" +if [[ -S /var/run/dbus/system_bus_socket ]] && command -v timedatectl > /dev/null 2>&1; then + TZ_VALUE="$(timedatectl show -p Timezone --value 2> /dev/null || true)" +fi +export TZ="${TZ_VALUE:-Etc/UTC}" # Update caddyfile with password -/."$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh &> /dev/null || true +"$HOME"/BirdNET-Pi/scripts/update_caddyfile.sh &> /dev/null || true echo "Starting service: caddy" -/usr/bin/caddy run --config /etc/caddy/Caddyfile +exec /usr/bin/caddy run --config /etc/caddy/Caddyfile From 4a0fede0abaa8e4a3889b8699f8fb816efb34803 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 10 Jul 2026 12:21:13 +0200 Subject: [PATCH 3/9] Avoid Supervisor bashio in BirdNET-Pi services --- birdnet-pi/rootfs/custom-services.d/01-avahi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/birdnet-pi/rootfs/custom-services.d/01-avahi.sh b/birdnet-pi/rootfs/custom-services.d/01-avahi.sh index 2f78268082..c1cba7f6f9 100755 --- a/birdnet-pi/rootfs/custom-services.d/01-avahi.sh +++ b/birdnet-pi/rootfs/custom-services.d/01-avahi.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bashio +#!/usr/bin/with-contenv bash # shellcheck shell=bash # Waiting for dbus until [[ -e /var/run/dbus/system_bus_socket ]]; do From 639d95d4a0e1001fccab44aba9806cdb0ba9643f Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 10 Jul 2026 12:21:21 +0200 Subject: [PATCH 4/9] Avoid Supervisor bashio in BirdNET-Pi services --- birdnet-pi/rootfs/custom-services.d/02-caddy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/birdnet-pi/rootfs/custom-services.d/02-caddy.sh b/birdnet-pi/rootfs/custom-services.d/02-caddy.sh index e009a13efd..6162c5f49e 100755 --- a/birdnet-pi/rootfs/custom-services.d/02-caddy.sh +++ b/birdnet-pi/rootfs/custom-services.d/02-caddy.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bashio +#!/usr/bin/with-contenv bash # shellcheck shell=bash # Wait for PHP-FPM only. D-Bus is optional in standalone Docker mode and must From 9112134b88bd0f889208c6565672d71bcdbecef7 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 10 Jul 2026 12:21:27 +0200 Subject: [PATCH 5/9] Avoid Supervisor bashio in BirdNET-Pi services --- birdnet-pi/rootfs/custom-services.d/02-nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/birdnet-pi/rootfs/custom-services.d/02-nginx.sh b/birdnet-pi/rootfs/custom-services.d/02-nginx.sh index 76f1773f84..50dae0f302 100755 --- a/birdnet-pi/rootfs/custom-services.d/02-nginx.sh +++ b/birdnet-pi/rootfs/custom-services.d/02-nginx.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bashio +#!/usr/bin/with-contenv bash # shellcheck shell=bash set -e From 8552b0f2646a9abe970f896b0ffd5aa1d79f34a4 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 10 Jul 2026 12:21:43 +0200 Subject: [PATCH 6/9] Use plain bash for BirdNET-Pi custom services --- birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh b/birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh index 3d36e0b8e1..0519e60bf6 100755 --- a/birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh +++ b/birdnet-pi/rootfs/custom-services.d/00-php_pfm.sh @@ -4,13 +4,12 @@ # Correct /config permissions after startup chown pi:pi /config -# D-Bus is not guaranteed to be available in standalone Docker mode. Use the -# configured TZ directly and only query timedatectl when its bus is ready. +# Set timezone without requiring Home Assistant Supervisor or D-Bus. TZ_VALUE="${TZ:-}" if [[ -S /var/run/dbus/system_bus_socket ]] && command -v timedatectl > /dev/null 2>&1; then TZ_VALUE="$(timedatectl show -p Timezone --value 2> /dev/null || true)" fi export TZ="${TZ_VALUE:-Etc/UTC}" -echo "Starting service: php fpm" +echo "Starting service: php pfm" exec /usr/sbin/php-fpm* -F