I have .ovpn config files downloaded from my protonvpn account when I run the command
sudo openvpn --config path_to_my_config_file
I get this error message:
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:
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 (https://github.com/alfredopalhares/openvpn-update-resolv-conf) and solution2 (https://rtfm.co.ua/en/arch-linux-openvpn-resolv-conf-not-updated/)) but no luck.
Can somebody help me solve this problem?
>> 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 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
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:
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
and retry using your config.
the file doesn't exist and is not created either after running the command
I use runit and I have installed openvpvn-runit. But honestly I don't know what to do with it.
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?
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
sudo ln -s /etc/runit/sv/openvpn /etc/runit/service
Start
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.
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.
This is correct, it was too early in the morning :D
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.
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.