Hi,
I'd like to report a reproducible boot failure of Qbittorrent-ng (App Center build, not Docker), together with a root cause and a small workaround.
Environment
Symptom
After every reboot, neither of the package's two web interfaces comes up:
The package shows as running in App Center. Stopping and starting it manually always fixes it, and it then works until the next reboot. logs/manager.log contains no entries at boot time at all — the manager is never even initialised.
Root cause: a race with Entware for /opt
Qbittorrent.sh (start) does the classic QNAP trick:
start.sh then uses ROOT=${QBT_ROOT:-/opt/Qbittorrent}.
But /opt in QTS is not a real directory — Entware recreates it at every boot:
qpkgd starts QPKGs in parallel, so the sequence on a real boot is:
After that, start.sh dies on its very first line:
This happens before anything is written to logs/manager.log, and Qbittorrent.sh swallows the exit status ("./start.sh ;" ... "exit 0"), so QTS logs "[App Center] Qbittorrent enabled" and the failure is completely silent.
Confirmation on my NAS:
So this is not related to storage guards, TLS, ACLs or the engine: the package simply dies because /opt is rebuilt under its feet.
Workaround
In Qbittorrent.sh, in the start) block, replace
with
And in the stop) block add the same two export lines before "cd $QPKG_ROOT" (so the package can still be stopped if the /opt link is missing).
The symlink itself must stay: data/profile/qBittorrent/config/qBittorrent.conf references HTTPS\CertificatePath=/opt/Qbittorrent/certs/webui.crt.
Verified with a real reboot: both 18686 and 18687 come up automatically, start.sh exits with code 0, manager.log shows a normal initialisation.
Suggestion for the author
Please make the startup independent of /opt — either
Also worth fixing: Qbittorrent.sh should propagate start.sh's exit code instead of always returning 0, so failures are visible in App Center instead of being reported as success.
The same race can bite any QPKG that writes "ln -sf ... /opt/<name>" at boot, so it may be worth cross-checking with other packages.
I'm happy to test a fixed build.
I'd like to report a reproducible boot failure of Qbittorrent-ng (App Center build, not Docker), together with a root cause and a small workaround.
Environment
- QNAP TS-262 (TS-X64), QTS, kernel 6.6.129-qnap
- Qbittorrent-ng 5.3.0.146 (build 20261108)
- Entware installed and enabled (/opt is a symlink owned by Entware)
Symptom
After every reboot, neither of the package's two web interfaces comes up:
- https://<nas>:18687 — qBittorrent WebUI
- https://<nas>:18686/dashboard — qbt-manager
The package shows as running in App Center. Stopping and starting it manually always fixes it, and it then works until the next reboot. logs/manager.log contains no entries at boot time at all — the manager is never even initialised.
Root cause: a race with Entware for /opt
Qbittorrent.sh (start) does the classic QNAP trick:
Code:
/bin/ln -sf $QPKG_ROOT /opt/$QPKG_NAME
cd $QPKG_ROOT
./start.sh
start.sh then uses ROOT=${QBT_ROOT:-/opt/Qbittorrent}.
But /opt in QTS is not a real directory — Entware recreates it at every boot:
Code:
/bin/rm -rf /opt
/bin/ln -sf $QPKG_DIR /opt
qpkgd starts QPKGs in parallel, so the sequence on a real boot is:
Code:
20:22:08 qpkgd starts Qbittorrent -> creates /opt/Qbittorrent inside the *real* /opt
20:22:09 qpkgd starts Entware -> rm -rf /opt (our symlink is deleted with the directory)
Entware -> ln -sf .../Entware /opt
20:22:10 Qbittorrent -> "Start Qbittorrent done, stcode = 0" (!!)
After that, start.sh dies on its very first line:
Code:
/opt/Qbittorrent/start.sh: line 5: /opt/Qbittorrent/runtime-process.sh: No such file or directory
This happens before anything is written to logs/manager.log, and Qbittorrent.sh swallows the exit status ("./start.sh ;" ... "exit 0"), so QTS logs "[App Center] Qbittorrent enabled" and the failure is completely silent.
Confirmation on my NAS:
- /opt inode/mtime is created by Entware exactly 1 s after Qbittorrent's start (20:22:09 vs 20:22:08);
- /opt/CloudFlared, /opt/kata, /opt/nvidia exist (those QPKGs start a bit later, so their links land inside the Entware directory) while /opt/Qbittorrent does not exist;
- the manager has never logged a start at any boot (13.11 23:40, 15.11 09:49, 17.11 20:20) — only on manual restarts.
So this is not related to storage guards, TLS, ACLs or the engine: the package simply dies because /opt is rebuilt under its feet.
Workaround
In Qbittorrent.sh, in the start) block, replace
Code:
/bin/ln -sf $QPKG_ROOT /opt/$QPKG_NAME
cd $QPKG_ROOT
./start.sh ;
Code:
# wait until Entware has finished rebuilding /opt
if [ "$(/sbin/getcfg Entware Enable -u -d FALSE -f $CONF)" = "TRUE" ]; then
n=0
while [ ! -L /opt ] && [ "$n" -lt 120 ]; do
sleep 1; n=$((n+1))
done
fi
# create the link and verify it survived the race (retry if needed)
n=0
while [ "$n" -lt 10 ]; do
[ -L "/opt/$QPKG_NAME" ] && /bin/rm -f "/opt/$QPKG_NAME"
/bin/ln -sfn "$QPKG_ROOT" "/opt/$QPKG_NAME"
sleep 1
[ -x "/opt/$QPKG_NAME/start.sh" ] && break
n=$((n+1))
done
# make the package scripts independent of /opt
export QBT_ROOT="$QPKG_ROOT"
export QBT_CONFIG="$QPKG_ROOT/data"
cd "$QPKG_ROOT"
./start.sh ;
And in the stop) block add the same two export lines before "cd $QPKG_ROOT" (so the package can still be stopped if the /opt link is missing).
The symlink itself must stay: data/profile/qBittorrent/config/qBittorrent.conf references HTTPS\CertificatePath=/opt/Qbittorrent/certs/webui.crt.
Verified with a real reboot: both 18686 and 18687 come up automatically, start.sh exits with code 0, manager.log shows a normal initialisation.
Suggestion for the author
Please make the startup independent of /opt — either
- resolve the installation path from qpkg.conf / $QPKG_ROOT and export QBT_ROOT / QBT_CONFIG (as above), or
- wait for /opt to become a symlink before creating /opt/<name> and starting the manager.
Also worth fixing: Qbittorrent.sh should propagate start.sh's exit code instead of always returning 0, so failures are visible in App Center instead of being reported as success.
The same race can bite any QPKG that writes "ln -sf ... /opt/<name>" at boot, so it may be worth cross-checking with other packages.
I'm happy to test a fixed build.