Home Assistant addon : qbittorrent (supports openvpn & smb mounts)

:warning: BREAKING CHANGE : I’ve decided to revert to the initial upstream image, apologies for this whole incovenience. After receiving mostly constructive (but also negative) feedbacks I have decided it was just not worth it to implement a new upstream image supposed to prevent ip leak for openvpn, plus wireguard support, and decided to just restore my own code. I’ve still kept qbit_manage, and will perhaps implement wireguard in the future but with my own code. As the databases were migrated for users to the new config locations, I’ve decided to keep it like that. It is more sustainable as HA is pushing in this direction and allows to backup the config with the addon (which was not the case previously).

  • :warning: ACTION (preferred) : Please restore a backup prior to the versions containing wireguard_openvpn in the name, then update (as was mentioned in the 4.6.2-5wireguard_openvpn changelog asking a full backup prior to update). This will make sure all your options are kept and you don’t need to reconfigure

  • :warning: IF NO BACKUP : You’ll need to update directly, but you’ll need to reconfigure the addon (in theory the database should be kept)

I’ve been having problems recently. But have reinstalled the addon since then and added my PIA ovpn file and credentials to the configuration. However, the addon is not working and I’m not making any progress reading the logs… I’ve added my log below.
I guess the most important errors are

s6-rc: fatal: unable to take locks: Resource busy
if: fatal: unable to spawn s6-test: No such file or directory
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)

Is this a problem with the OpenVPN configuration?

Setting permissions for the config.yaml directory

Load environment variables from /config/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f-qbittorrent/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables

... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /config/*-qbittorrent/qbittorrent.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/30-nginx.sh: executing
/etc/cont-init.d/90-dns_set.sh: executing
[15:15:34] INFO: DNS SERVERS set to 1.1.1.1 8.8.8.8 
/etc/cont-init.d/91-qbittorrent_configuration.sh: executing
[15:15:34] INFO: Downloads can be found in /share/qBittorrent
[15:15:34] INFO: Whitelisted subsets will not require a password : localhost, 127.0.0.1, 172.30.0.0/16, 192.168.0.0/16
[15:15:34] INFO: WEBUI username set to admin
[15:15:34] INFO: Alternate UI enabled : vuetorrent. If webui don't work, disable this option
[15:15:35] INFO: Default username/password : admin/homeassistant
[15:15:35] INFO: Configuration can be found in /config/qBittorrent
/etc/cont-init.d/92-qbit_manage.sh: executing
/etc/cont-init.d/93-openvpn.sh: executing
[15:15:35] INFO: ----------------------------
[15:15:35] INFO: Openvpn enabled, configuring
[15:15:35] INFO: ----------------------------
... configured ovpn file : using /addon_configs/db21ed7f-qbittorrent/openvpn/config.ovpn
... openvpn correctly set, qbittorrent will run tunnelled through openvpn
Using container binding
... deleting previous interface settings
 
Starting the upstream container
 
[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    0
User GID:    0
───────────────────────────────────────

[custom-init] No custom files found, skipping...
crond: crond (busybox 1.36.1) started, log level 8
2024-01-10 15:15:36 DEPRECATED OPTION: --cipher set to 'aes-128-cbc' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305). OpenVPN ignores --cipher for cipher negotiations. 
2024-01-10 15:15:36 OpenVPN 2.6.8 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
2024-01-10 15:15:36 library versions: OpenSSL 3.1.4 24 Oct 2023, LZO 2.10
2024-01-10 15:15:36 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2024-01-10 15:15:36 CRL: loaded 1 CRLs from file -----BEGIN X509 CRL-----
MIICWDCCAUAwDQYJKoZIhvcNAQENBQAwgegxCzAJBgNVBAYTAlVTMQswCQYDVQQI
EwJDQTETMBEGA1UEBxMKTG9zQW5nZWxlczEgMB4GA1UEChMXUHJpdmF0ZSBJbnRl
cm5ldCBBY2Nlc3MxIDAeBgNVBAsTF1ByaXZhdGUgSW50ZXJuZXQgQWNjZXNzMSAw
HgYDVQQDExdQcml2YXRlIEludGVybmV0IEFjY2VzczEgMB4GA1UEKRMXUHJpdmF0
ZSBJbnRlcm5ldCBBY2Nlc3MxLzAtBgkqhkiG9w0BCQEWIHNlY3VyZUBwcml2YXRl
aW50ZXJuZXRhY2Nlc3MuY29tFw0xNjA3MDgxOTAwNDZaFw0zNjA3MDMxOTAwNDZa
MCYwEQIBARcMMTYwNzA4MTkwMDQ2MBECAQYXDDE2MDcwODE5MDA0NjANBgkqhkiG
9w0BAQ0FAAOCAQEAQZo9X97ci8EcPYu/uK2HB152OZbeZCINmYyluLDOdcSvg6B5
jI+ffKN3laDvczsG6CxmY3jNyc79XVpEYUnq4rT3FfveW1+Ralf+Vf38HdpwB8EW
B4hZlQ205+21CALLvZvR8HcPxC9KEnev1mU46wkTiov0EKc+EdRxkj5yMgv0V2Re
ze7AP+NQ9ykvDScH4eYCsmufNpIjBLhpLE2cuZZXBLcPhuRzVoU3l7A9lvzG9mjA
5YijHJGHNjlWFqyrn1CfYS6koa4TGEPngBoAziWRbDGdhEgJABHrpoaFYaL61zqy
MR6jC0K2ps9qyZAN74LEBedEfK7tBOzWMwr58A==
-----END X509 CRL-----

2024-01-10 15:15:36 TCP/UDP: Preserving recently used remote address: [AF_INET]89.149.24.207:1198
2024-01-10 15:15:36 UDPv4 link local: (not bound)
2024-01-10 15:15:36 UDPv4 link remote: [AF_INET]89.149.24.207:1198
2024-01-10 15:15:36 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
2024-01-10 15:15:36 [amsterdam434] Peer Connection Initiated with [AF_INET]89.149.24.207:1198
2024-01-10 15:15:36 TUN/TAP device tun0 opened
2024-01-10 15:15:36 /sbin/ip link set dev tun0 up mtu 1500
2024-01-10 15:15:36 /sbin/ip link set dev tun0 up
2024-01-10 15:15:36 /sbin/ip addr add dev tun0 10.79.112.145/24
2024-01-10 15:15:36 /etc/openvpn/up.sh tun0 1500 0 10.79.112.145 255.255.255.0 init
s6-rc: fatal: unable to take locks: Resource busy
2024-01-10 15:15:36 Initialization Sequence Completed
WebUI will be started shortly after internal preparations. Please wait...

******** Information ********
To control qBittorrent, access the WebUI at: http://localhost:8080

Connection to localhost (127.0.0.1) 8080 port [tcp/http-alt] succeeded!
[15:15:37] INFO: Starting NGinx...
[ls.io-init] done.

******** Information ********
To control qBittorrent, access the WebUI at: http://localhost:8080

Connection to localhost (127.0.0.1) 8080 port [tcp/http-alt] succeeded!
[15:15:37] INFO: Starting NGinx...
[ls.io-init] done.
if: fatal: unable to spawn s6-test: No such file or directory
[15:15:51] INFO: Starting NGinx...
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:15:51 [emerg] 976#976: bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:15:51 [emerg] 976#976: bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:15:51 [emerg] 976#976: bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:15:51 [emerg] 976#976: bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:15:51 [emerg] 976#976: bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:15:51 [emerg] 976#976: still could not bind()
nginx: [emerg] still could not bind()
if: fatal: unable to spawn s6-test: No such file or directory
[15:16:03] INFO: Starting NGinx...
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:16:03 [emerg] 1014#1014: bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:16:03 [emerg] 1014#1014: bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:16:03 [emerg] 1014#1014: bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:16:03 [emerg] 1014#1014: bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] bind() to 172.30.33.5:8099 failed (98: Address in use)
2024/01/10 15:16:03 [emerg] 1014#1014: bind() to 172.30.33.5:8099 failed (98: Address in use)
nginx: [emerg] still could not bind()
2024/01/10 15:16:03 [emerg] 1014#1014: still could not bind()

today my wife updated… today i will spend time figuring out why openvpn cant find the credentials file…

any help so i can get actual work done today :slight_smile:

the log:
Options error: --auth-user-pass fails with ‘etc/openvpn/credentials.conf’: No such file or directory (errno=2)

1 Like

got it the path in openvpn config file should be /config/openvpn/credentials

i changed the name to credentials on my setup

thanks for your effort with this add-on .

talk next time my wife updates :slight_smile:

1 Like

Thanks ; the script auto corrects /etc to /config normally i’ll check if something bugs there

Dears,
Im trying to configure OpenVPN client in this addon and I have 2 questions:

  1. Im receiving this error and all my files are in the proper folder /addon_configs/db21ed7f_qbittorrent\openvpn

2024-01-16 15:20:49 us=193435 WARNING: cannot stat file ‘client.key’: No such file or directory (errno=2)
Options error: --key fails with ‘client.key’: No such file or directory (errno=2)
Options error: Please correct these errors.
Use --help for more information.

  1. is it possible to upgrade the Openvpn client to 2.5?

Regards,

Hi, you need to provide absolute path and correct your ovpn to /config/openvpn/client.key

The script autocorrects other files, it will correct for key files in the future also

For the second point i’m just adding with apk add openvpn so perhaps it isn’t available in alpine? It should automatically install the latest version

Thank you Alex for your answer!!! I need one clarification, which is the work directory of this addon? /config/openvpn/ or /addon_configs/db21ed7f_qbittorrent/openvpn?
I think you have a script to copy the content from one folder to another (I think) have all my files in the both folders just in case…hehehe

This is my my ovpn config for paths:

ca /config/openvpn/ca.crt
cert /config/openvpn/client.crt

2024-01-16 18:10:51 us=196386 WARNING: cannot stat file ‘client.key’: No such file or directory (errno=2)
Options error: --key fails with ‘client.key’: No such file or directory (errno=2)
Options error: Please correct these errors.
Use --help for more information.

DNS_server: 8.8.8.8,1.1.1.1
PGID: “0”
PUID: “0”
SavePath: /share/qBittorrent
Username: admin
certfile: fullchain.pem
customUI: vuetorrent
keyfile: privkey.pem
qbit_manage: false
ssl: false
whitelist: localhost,127.0.0.1,172.30.0.0/16,192.168.0.0/16
openvpn_config: openvpn.ovpn
openvpn_password: #############
openvpn_username: #############
openvpn_enabled: true
openvpn_alt_mode: true

Hi, actually both are the same : it’s how homeassistant works. In the add-on itself, the config folder is mapped to /config, but when accessing it from Filebrowser it is mapped to /addon_configs/xxx-qbittorrent

Are you sure there is no reference to a key file in your ovpn? As I don’t have a --key reference in the code and it works for other vpns so i’m wondering if this is something specific to your vpn?

Everything is working!!! Dankuuuuuu

1 Like

Glad it works!!! One day I’ll look at wireguard also but it seems very challenging to implement as it requires to make a change to sysctl system that is not exposed in HAos

I have a question on this addon. I see that there is an option to use OpenVPN at a container level, and requires an openvpn connection to start. Does it also act as a killswitch? I.e., if the connection were to drop, would Qbittorrent disconnect and stop, or attempt to reconnect through the regular network interfaces?

Hi, in theory it should stop indeed, but I’m not a super openvpn expert. I’ve added a second layer of security that checks external ip regularly and stops the connection if it detects that the vpn is not working. However, there is no foolproof systems!

Hi,

I’m unable to add torrents from the provided search engine. I’ve tried to add several torrents but they don’t appear in the download page. Is it a known bug?
I started noting this several months ago, but once every x attempts the torrent would appear and start downloading. Now it doesn’t work at all.

Running latest version of qbittorrent and Home Assistant Core.

Thanks

Greetings to all.
MB, I’m a bad finder, but every day when I add a new torrent to download, every time the default download path goes back to the default path that I save in download options, it resets there too. MB this happened after updates, can I hardcode these settings or something like that???
P.S. yep im added to HA sharefolder where i whant to store my downloads.

Hey all,
I’m having a problem mounting my smb drive with the following error:

It looks like all the required config is correct, but I am still getting this error.

After digging into the terminal and running dmesg I see the following:
image

Could this have anything to do with the colon being reported in the version number (2:0 instead of 2.0)? Any help would be amazing.

1 Like

Hi, looks like a typo from my part! I’ll correct this in a couple hours

Edit : actually it’s not a typo just a weird bug i’ll add a converter to convert : to . when that happens

That’s strange are you saying that the addon option resets itself to this? The addon aligns with the addon options savepath by default to ensure adequate permissions

So in the end it was a nmap bug. I’ve pushed an update to avoid it

Amazing work, that is now mounting successfully! However I seem to be having a new issue now:

2024-04-20 10:47:04 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2024-04-20 10:47:04 TCP/UDP: Preserving recently used remote address: [AF_INET]154.X.X.105:502
2024-04-20 10:47:04 Attempting to establish TCP connection with [AF_INET]154.X.X.105:502
2024-04-20 10:47:04 TCP connection established with [AF_INET]154.X.X.105:502
2024-04-20 10:47:04 TCPv4_CLIENT link local: (not bound)
2024-04-20 10:47:04 TCPv4_CLIENT link remote: [AF_INET]154.X.X.105:502
2024-04-20 10:47:04 VERIFY ERROR: CRL not loaded
2024-04-20 10:47:04 OpenSSL: error:0A000086:SSL routines::certificate verify failed:
2024-04-20 10:47:04 TLS_ERROR: BIO read tls_read_plaintext error
2024-04-20 10:47:04 TLS Error: TLS object -> incoming plaintext read error
2024-04-20 10:47:04 TLS Error: TLS handshake failed
2024-04-20 10:47:04 Fatal TLS error (check_tls_errors_co), restarting
2024-04-20 10:47:04 SIGUSR1[soft,tls-error] received, process restarting

This is just being repeated over and over in the logs with the UI never being available. Any ideas?

2 Likes