MarkusMcNugen / docker-qBittorrentvpn

Docker container which runs a headless qBittorrent client with WebUI and optional OpenVPN
https://hub.docker.com/r/markusmcnugen/qbittorrentvpn/
GNU General Public License v3.0
168 stars 92 forks source link

Options error: In [CMD-LINE]:1: Error opening configuration file: /config/openvpn/country.ovpn (PIA) #102

Open Svenman2 opened 2 years ago

Svenman2 commented 2 years ago

Hi everybody,

I'm trying to get this Docker image to work via Portainer but I get the following message: Options error: In [CMD-LINE]:1: Error opening configuration file: /config/openvpn/Netherlands.ovpn

I use PIA as my openvpn provider and I see more people have problems with it?! has anyone had this already? or is diet a new issue also i had problem with /dev/net/tun i solved that thanks to this ticket

Here's the error code I get with multiple openvpn files

=2021-08-14 19:29:08.222280 [info] VPN_ENABLED defined as 'yes' 2021-08-14 19:29:08.501275 [info] OpenVPN config file (ovpn extension) is located at /config/openvpn/Netherlands.ovpn dos2unix: converting file /config/openvpn/Netherlands.ovpn to Unix format... 2021-08-14 19:29:08.697153 [info] VPN remote line defined as 'nl-amsterdam.privacy.network 1198' 2021-08-14 19:29:08.826418 [info] VPN_REMOTE defined as 'nl-amsterdam.privacy.network' 2021-08-14 19:29:08.952833 [info] VPN_PORT defined as '1198' 2021-08-14 19:29:09.100766 [info] VPN_PROTOCOL defined as 'udp' 2021-08-14 19:29:09.227332 [info] VPN_DEVICE_TYPE defined as 'tun0' 2021-08-14 19:29:09.350425 [info] LAN_NETWORK defined as '172.17.0.0/16' 2021-08-14 19:29:09.495947 [warn] NAME_SERVERS not defined (via -e NAME_SERVERS), defaulting to Google and FreeDNS name servers 2021-08-14 19:29:09.630068 [info] VPN_OPTIONS not defined (via -e VPN_OPTIONS) 2021-08-14 19:29:09.791765 [info] Adding 8.8.8.8 to resolv.conf 2021-08-14 19:29:09.945879 [info] Adding 37.235.1.174 to resolv.conf 2021-08-14 19:29:10.076503 [info] Adding 8.8.4.4 to resolv.conf 2021-08-14 19:29:10.221043 [info] Adding 37.235.1.177 to resolv.conf 2021-08-14 19:29:10.406460 [info] Starting OpenVPN... Options error: In [CMD-LINE]:1: Error opening configuration file: /config/openvpn/Netherlands.ovpn Use --help for more information. 2021-08-14 19:33:39.029990 [info] VPN_ENABLED defined as 'yes' 2021-08-14 19:33:39.162818 [info] OpenVPN config file (ovpn extension) is located at /config/openvpn/ca_toronto.ovpn dos2unix: converting file /config/openvpn/ca_toronto.ovpn to Unix format... 2021-08-14 19:33:39.308150 [info] VPN remote line defined as 'ca-toronto.privacy.network 1198' 2021-08-14 19:33:39.434621 [info] VPN_REMOTE defined as 'ca-toronto.privacy.network' 2021-08-14 19:33:39.584606 [info] VPN_PORT defined as '1198' 2021-08-14 19:33:39.737192 [info] VPN_PROTOCOL defined as 'udp' 2021-08-14 19:33:39.877878 [info] VPN_DEVICE_TYPE defined as 'tun0' 2021-08-14 19:33:40.002400 [info] LAN_NETWORK defined as '172.17.0.0/16' 2021-08-14 19:33:40.146247 [warn] NAME_SERVERS not defined (via -e NAME_SERVERS), defaulting to Google and FreeDNS name servers 2021-08-14 19:33:40.269537 [info] VPN_OPTIONS not defined (via -e VPN_OPTIONS) 2021-08-14 19:33:40.394626 [info] Adding 8.8.8.8 to resolv.conf 2021-08-14 19:33:40.516678 [info] Adding 37.235.1.174 to resolv.conf 2021-08-14 19:33:40.639255 [info] Adding 8.8.4.4 to resolv.conf 2021-08-14 19:33:40.793329 [info] Adding 37.235.1.177 to resolv.conf 2021-08-14 19:33:40.925514 [info] Starting OpenVPN... Options error: In [CMD-LINE]:1: Error opening configuration file: /config/openvpn/ca_toronto.ovpn Use --help for more information.

ghost commented 2 years ago

Copy and paste this into a new stack in Portainer:

version: '3.2'

services:
 qbittorrent:
  image: dyonr/qbittorrentvpn
  cap_add:
    - NET_ADMIN
  ports:
    - "8999:8999"
    - "8999:8999/udp"
    - "8090:8080"
    - "8118:8118"
  devices:
    - /dev/net/tun
  volumes:
    - /volume1/docker/qbittorrentvpn/config:/config
    - /volume1/docker/qbittorrentvpn/downloads:/downloads
  environment:
    - VPN_ENABLED=yes
    - VPN_TYPE=openvpn
    - LAN_NETWORK=192.168.1.0/24
    - VPN_USERNAME=
    - VPN_PASSWORD=
  restart: unless-stopped

Change ports, volumes & your credentials as needed.

The trick here that's getting it to work (at least for me and a few others) is the /dev/net/tun device & the NET_ADMIN bit. On most devices, these changes aren't needed, but on Synology NAS devices (like what I'm using), the 2 changes are needed.

Hope this helps.

ghost commented 2 years ago

I'm not sure what could be causing your issue. For me, the fix was to do the 2 things I added to the docker-compose file and the different container (since this one appears to no longer be maintained). Have you tried the dyonr one (the one listed in my other comment here)?

zeoninja commented 2 years ago

I'm not sure what could be causing your issue. For me, the fix was to do the 2 things I added to the docker-compose file and the different container (since this one appears to no longer be maintained). Have you tried the dyonr one (the one listed in my other comment here)?

Hey, i got this working, thanks so much. My container mounts "volume1\docker\qbittorrentvpn\downloads" as download for qBittorent. Is there any way to move files in that mount to shared folders outside the container?

MYeager1967 commented 2 years ago

I was running this up until an hour ago and it ran fine. After upgrading my NAS to DSM 7, I'm getting this error. It's obviously a permissions issue, I'm just unsure where to start to resolve it....

EDIT: Apparently having the container privileged flag set caused this. As soon as I realized this and removed the line, it works...

Is anyone using the healthcheck on this? I had it going previously, but there are now environment variables I didn't have before. The old check is apparently still viable, but if there's a built in script, I'd like to use it....

t3kg8m3r commented 2 years ago

@MYeager1967 ,

Yes it is definitely some type of permissions issue with DSM 7... the way I fixed it is to stop the container, uncheck "execute container using highest privilege", apply changes, start back up the container, wait a few minutes, stop the container again and re-check "execute container using highest privilege", apply changes, and start it back up and OpenVPN then worked!

MYeager1967 commented 2 years ago

I removed the privileged line from my docker-compose and it's running. Might try to put it back now that you say it's working for you. Thanks for the reply! Any idea about the health check variables?