Trigus42 / alpine-qbittorrentvpn

Multiarch docker image with the latest qBittorrent-nox client (WEB UI) and WireGuard/OpenVPN tunnel
GNU General Public License v3.0
69 stars 10 forks source link

TrueNAS Scale - qbittorrent crashes after some time #67

Open Grinchii opened 1 month ago

Grinchii commented 1 month ago

Hello,

I'm trying to get this great Container working with TrueNAS Scale but it always crashes after some time (sometimes after 2h, sometimes after 15h, etc.) and is failing restarting it.

It seems like in TrueNAS you can't see the "old" logs. Only the logs of what is happening in the actual season (so everything after the crash happened).

This is the log when it's trying to restart after crashing:

2024-05-14T21:53:19.968882868+02:00 [s6-init] making user provided files available at /var/run/s6/etc...exited 0. 2024-05-14T21:53:20.045318649+02:00 [s6-init] ensuring user provided files have correct perms...exited 0. 2024-05-14T21:53:20.047924940+02:00 [fix-attrs.d] applying ownership & permissions fixes... 2024-05-14T21:53:20.050506992+02:00 [fix-attrs.d] done. 2024-05-14T21:53:20.052255905+02:00 [cont-init.d] executing container initialization scripts... 2024-05-14T21:53:20.055167622+02:00 [cont-init.d] 10-environment.sh: executing... 2024-05-14T21:53:20.063918070+02:00 2024-05-14 21:53:20 [INFO] HEALTH_CHECK_HOST is not set. Using default host 1.1.1.1 2024-05-14T21:53:20.065333579+02:00 2024-05-14 21:53:20 [INFO] HEALTH_CHECK_INTERVAL is not set. Using default interval of 5s 2024-05-14T21:53:20.066776707+02:00 2024-05-14 21:53:20 [INFO] HEALTH_CHECK_TIMEOUT is not set. Using default interval of 5s 2024-05-14T21:53:20.092781296+02:00 2024-05-14 21:53:20 [INFO] PUID defined as 1005 2024-05-14T21:53:20.094425382+02:00 2024-05-14 21:53:20 [INFO] PGID defined as 1006 2024-05-14T21:53:20.100656798+02:00 2024-05-14 21:53:20 [INFO] An user with PUID 1005 does not exist, adding an user called 'qbittorrent' with PUID 1005 2024-05-14T21:53:20.113914549+02:00 2024-05-14 21:53:20 [INFO] VPN_ENABLED not defined (via -e VPN_ENABLED), defaulting to 'yes' 2024-05-14T21:53:20.115265759+02:00 2024-05-14 21:53:20 [WARNING] VPN_TYPE not set, defaulting to Wireguard. 2024-05-14T21:53:20.119465935+02:00 2024-05-14 21:53:20 [WARNING] NAME_SERVERS not defined (via -e NAME_SERVERS), defaulting to CloudFlare and Google name servers 2024-05-14T21:53:20.124454981+02:00 2024-05-14 21:53:20 [INFO] Adding 1.1.1.1 to resolv.conf 2024-05-14T21:53:20.130582848+02:00 2024-05-14 21:53:20 [INFO] Adding 8.8.8.8 to resolv.conf 2024-05-14T21:53:20.133486625+02:00 2024-05-14 21:53:20 [INFO] Adding 1.0.0.1 to resolv.conf 2024-05-14T21:53:20.137041021+02:00 2024-05-14 21:53:20 [INFO] Adding 8.8.4.4 to resolv.conf 2024-05-14T21:53:20.142554948+02:00 [cont-init.d] 10-environment.sh: exited 0. 2024-05-14T21:53:20.144902533+02:00 [cont-init.d] 20-vpn.sh: executing... 2024-05-14T21:53:20.153274217+02:00 2024-05-14 21:53:20 [INFO] Choosen VPN config: 'wg01.conf' 2024-05-14T21:53:20.163614512+02:00 dos2unix: converting file /config/wireguard/wg01.conf to Unix format... 2024-05-14T21:53:20.168523148+02:00 2024-05-14 21:53:20 [INFO] VPN remote line defined as 'XXX' 2024-05-14T21:53:20.172545498+02:00 2024-05-14 21:53:20 [INFO] VPN_REMOTE defined as 'XXX' 2024-05-14T21:53:20.177169548+02:00 2024-05-14 21:53:20 [INFO] VPN_PORT defined as '1443' 2024-05-14T21:53:20.179293416+02:00 2024-05-14 21:53:20 [INFO] VPN_PROTOCOL set as 'udp', since WireGuard is always udp. 2024-05-14T21:53:20.180976941+02:00 2024-05-14 21:53:20 [INFO] VPN_DEVICE_TYPE set as 'wg01' 2024-05-14T21:53:20.189739619+02:00 2024-05-14 21:53:20 [INFO] Starting WireGuard... 2024-05-14T21:53:20.189786129+02:00 -------------------- 2024-05-14T21:53:20.209051429+02:00 wg-quick: `wg01' already exists 2024-05-14T21:53:20.210770293+02:00 [cont-init.d] 20-vpn.sh: exited 1. 2024-05-14T21:53:20.227205716+02:00 [cont-finish.d] executing container finish scripts... 2024-05-14T21:53:20.228723374+02:00 [cont-finish.d] done. 2024-05-14T21:53:20.229450053+02:00 [s6-finish] waiting for services. 2024-05-14T21:53:20.438691739+02:00 [s6-finish] sending all processes the TERM signal. 2024-05-14T21:53:23.447524268+02:00 [s6-finish] sending all processes the KILL signal and exiting.

Is there anything I can do to fix this? Maybe someone else using this with TrueNAS Scale and got it working?

Thank you!

Trigus42 commented 1 month ago

I am not sure how TrueNAS Scale implements it's docker support. For your problem it seems like the network namespace gets recycled on restart without cleaning up the interfaces.

To check this, you could add a custom script like described here with a number prefix lower than 20 and with the following contents:

#!/usr/bin/with-contenv bash

if (ip link | grep -q "wg01"); then 
    echo still up
    wg-quick down /config/wireguard/wg01.conf
    sleep 1
else 
    echo already down
fi
davidfrickert commented 4 weeks ago

This is also an issue on kubernetes. If qbittorrent crashes, then it will be restarted and run into this issue. maybe apply suggested script as part of init process by default?

Trigus42 commented 3 weeks ago

@davidfrickert Did the script solve the issue for you?

davidfrickert commented 3 weeks ago

@davidfrickert Did the script solve the issue for you?

didn't get to test it since i did not run into crashes so far