From e5048aa378a21a3650768551636a8ab2c8f4ce81 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 11 May 2026 05:16:13 +0000 Subject: [PATCH] Fix aarch64 startup loop: use s6-notifyoncheck only when notification-fd exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit s6-rc opens fd 3 for a longrun service only when a notification-fd file is present in the service directory. The LSIO aarch64 image ships svc-qbittorrent without that file, so fd 3 is never opened. s6-notifyoncheck exits with EBADF after its readiness check passes, s6 treats the supervised process as dead and immediately restarts it — producing the infinite "Starting qBittorrent..." loop. Check for the notification-fd file at runtime: use the full s6-notifyoncheck path when it is present (amd64, preserving existing behaviour), and fall back to exec'ing qbittorrent-nox directly when it is absent (aarch64). https://claude.ai/code/session_01F16ThtZyfXj6ZKFPkrSAAq --- .../s6-overlay/s6-rc.d/svc-qbittorrent/run | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/qbittorrent/rootfs/etc/s6-overlay/s6-rc.d/svc-qbittorrent/run b/qbittorrent/rootfs/etc/s6-overlay/s6-rc.d/svc-qbittorrent/run index 5c9be4b5c8..b987d01c1b 100644 --- a/qbittorrent/rootfs/etc/s6-overlay/s6-rc.d/svc-qbittorrent/run +++ b/qbittorrent/rootfs/etc/s6-overlay/s6-rc.d/svc-qbittorrent/run @@ -36,14 +36,22 @@ fi # --- Launch qBittorrent --- -bashio::log.info "Starting qBittorrent..." - -# On aarch64 LSIO images svc-qbittorrent has no notification-fd, so fd 3 is never -# opened by s6-rc. s6-notifyoncheck then exits with EBADF after its check passes, -# s6 sees the supervised process die and restarts it — causing the startup loop. -# Run qbittorrent-nox directly so s6 supervises the actual process. +# Determine log output based on silent mode +QB_OUTPUT="/dev/stdout" if bashio::config.true 'silent'; then - exec > /dev/null 2>&1 + QB_OUTPUT="/dev/null" fi -exec s6-setuidgid abc /app/qbittorrent-nox --webui-port="${WEBUI_PORT}" +bashio::log.info "Starting qBittorrent..." + +# s6-notifyoncheck writes to fd 3 when its readiness check passes. s6-rc only +# opens fd 3 when the service directory contains a notification-fd file. Without +# it (LSIO arm64 images), s6-notifyoncheck exits with EBADF and s6 restarts the +# service in a loop. Fall back to running qbittorrent-nox directly in that case. +if [ -f /etc/s6-overlay/s6-rc.d/svc-qbittorrent/notification-fd ]; then + exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${WEBUI_PORT}" \ + s6-setuidgid abc /app/qbittorrent-nox --webui-port="${WEBUI_PORT}" > "${QB_OUTPUT}" +else + exec s6-setuidgid abc /app/qbittorrent-nox --webui-port="${WEBUI_PORT}" > "${QB_OUTPUT}" +fi