Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: openvpn connection problem (Read 1001 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

openvpn connection problem

I have .ovpn config files downloaded from my protonvpn account when I run the command
Code: [Select]
sudo openvpn --config path_to_my_config_file
I get this error message:
Code: [Select]
Options error: --up script fails with '/etc/openvpn/update-resolv-conf': No such file or directory (errno=2)
Options error: Please correct this error.
Use --help for more information.
and this is my protonvpn config file:
Code: [Select]
client
dev tun
proto udp

remote 185.159.157.6 5060
remote 185.159.157.6 80
remote 185.159.157.6 1194
remote 185.159.157.6 443
remote 185.159.157.6 4569

remote-random
resolv-retry infinite
nobind

# The following setting is only needed for old OpenVPN clients compatibility. New clients
# automatically negotiate the optimal cipher.
cipher AES-256-CBC

auth SHA512
verb 3


setenv CLIENT_CERT 0
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun

reneg-sec 0

remote-cert-tls server
auth-user-pass /home/mehdi/.config/openvpn/auth.txt
pull
fast-io

script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

<ca>
-----BEGIN CERTIFICATE-----
...
I have another system running on arch linux and this command works fine on that. But I dont remember if I also had this error initially on arch or not. I tried couple of solutions ( solution1 and solution2 ) but no luck.
Can somebody help me solve this problem?

Re: openvpn connection problem

Reply #1
>> Options error: --up script fails with '/etc/openvpn/update-resolv-conf': No such file or directory (errno=2)

Did you make sure that the file exists at that path?

Re: openvpn connection problem

Reply #2
the init script for your init should be creating that directory with write permissions for open vpn.  what init do you use again?

ie

sudo pacman -S openvpn-dinit

because i use dinit system
Cat Herders of Linux

Re: openvpn connection problem

Reply #3
Also I looked at solution 1 and from what I understood, this is a script for updating the DNS server at /etc/resolv.conf from the ones provided by your openvpn config.

So you can try this, set your favorite DNS provider in /etc/resolv.conf, and then comment the following lines:
Code: [Select]
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
and retry using your config.

Re: openvpn connection problem

Reply #4
>> Options error: --up script fails with '/etc/openvpn/update-resolv-conf': No such file or directory (errno=2)

Did you make sure that the file exists at that path?
the file doesn't exist and is not created either after running the command

Re: openvpn connection problem

Reply #5
the init script for your init should be creating that directory with write permissions for open vpn.  what init do you use again?

ie

sudo pacman -S openvpn-dinit

because i use dinit system
I use runit and I have installed openvpvn-runit. But honestly I don't know what to do with it.

Re: openvpn connection problem

Reply #6
Also I looked at solution 1 and from what I understood, this is a script for updating the DNS server at /etc/resolv.conf from the ones provided by your openvpn config.

So you can try this, set your favorite DNS provider in /etc/resolv.conf, and then comment the following lines:
Code: [Select]
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
and retry using your config.
Thank you!
I commented those two lines and now openvpn connects. So what is the reason for that? Is it related to artix and runit?

Re: openvpn connection problem

Reply #7
I use runit and I have installed openvpvn-runit. But honestly I don't know what to do with it.
Installing the openvpn-runit package is only half the solution.
You also need to add this service to the runit directory and start the service afterwards.

Add
Code: [Select]
sudo ln -s /etc/runit/sv/openvpn /etc/runit/service

Start
Code: [Select]
sudo sv start openvpn

After that this service is available.

Re: openvpn connection problem

Reply #8
Installing the openvpn-runit package is only half the solution.
You also need to add this service to the runit directory and start the service afterwards.

Add
Code: [Select]
sudo ln -s /etc/runit/sv/openvpn /etc/runit/service

Start
Code: [Select]
sudo sv start openvpn

After that this service is available.

I've tried it before (and the link directory should be /run/runit/service. I think you had a typo there) Although I don't want openvpn to connect automatically on startup.
Anyway when I link the service to runit folder, after rebooting and in the login screen I get repetitive errors of `Error opening configuration file: /etc/ openvpn/openvpn.conf`.
I created openvpn.conf file in that directory and  copied the contents of my .ovpn file in it. After rebooting, I got the same update-resolv-conf error again.

Re: openvpn connection problem

Reply #9
So what is the reason for that? Is it related to artix and runit?
I don't know but like I said, it's not absolutely necessary for you to have that script, it just sets your system-wide DNS nameserver to the one provided by your openvpn config, and personally I would much rather prefer to set my own nameserver instead of something else setting it for me.


Re: openvpn connection problem

Reply #11
I've tried it before (and the link directory should be /run/runit/service. I think you had a typo there) Although I don't want openvpn to connect automatically on startup.
Anyway when I link the service to runit folder, after rebooting and in the login screen I get repetitive errors of `Error opening configuration file: /etc/ openvpn/openvpn.conf`.
I created openvpn.conf file in that directory and  copied the contents of my .ovpn file in it. After rebooting, I got the same update-resolv-conf error again.

chmod 777 the directory so openvpn can write to the directory.  This is a permissions error.  the init service for the openvpn should make the directory and give it permissions but it isn't for whatever reason so just create the directory, give the write permissions and openvpn will create the file.
Cat Herders of Linux

 

Re: openvpn connection problem

Reply #12
chmod 777 the directory so openvpn can write to the directory.  This is a permissions error. 
It's rarely a good idea to chmod system files and directories 777. Yes it may work but it's like using a sledgehammer to crack a nut.
Better to find out what user / group openvpn runs as and allow just that user or group write access to the directory.

@OP the suggestion may work. But setting files and directories world writeable, when you run into permission issues, is a bad habit to get into.