You are not logged in.
How to start OpenVPN after my machine wake up (or reboots) without entering login / pass each time to run it using `sudo`? I've followed steps at https://wiki.archlinux.org/index.php/Op … figuration. But I do `sudo systemctl start MYSERVCIE` each time when I log in / log out.
As far as I see it openvpn deamon does not restart openvpn process when connection is lost. Here are some errors from the unit logs (sudo journalctl -u openvpn-client@***********-direct.service):
...
июн 01 19:40:58 artpc openvpn[5641]: ERROR: Linux route add command failed: external program exited with error status: 2
...
июн 01 19:42:46 artpc openvpn[5641]: ERROR: Linux route delete command failed: external program exited with error status: 2
...
июн 01 19:42:49 artpc openvpn[6526]: Options error: Unrecognized option or missing or extra parameter(s) in [PUSH-OPTIONS]:3: block-outside-dns (2.4.9)
...
июн 01 19:42:49 artpc openvpn[6526]: ERROR: Linux route add command failed: external program exited with error status: 2
...
Have Network Manager set up.
pa -Qs network openvpn
local/networkmanager-openvpn 1.8.12-1
NetworkManager VPN plugin for OpenVPN
local/openvpn 2.4.9-2
An easy-to-use, robust and highly configurable VPN (Virtual Private Network)
Last edited by art (2020-06-05 15:50:10)
Offline
You can enable the systemd unit with the command systemctl enable openvpn@<configutation>.service.
See https://wiki.archlinux.org/index.php/Sy … sing_units for more information.
Offline
That does not help. Already done that
Here are logs from OpenVPN when I wake up my notebook from sleep:
> sudo journalctl -u openvpn-client@***.***.***.***-direct.service
...
июн 02 08:18:01 artpc openvpn[6526]: TCP: connect to [AF_INET]***.***.***.***:636 failed: Connection timed out
июн 02 08:18:01 artpc openvpn[6526]: SIGUSR1[connection failed(soft),init_instance] received, process restarting
июн 02 08:18:01 artpc openvpn[6526]: Restart pause, 5 second(s)
июн 02 08:18:06 artpc openvpn[6526]: TCP/UDP: Preserving recently used remote address: [AF_INET]***.***.***.***:636
июн 02 08:18:06 artpc openvpn[6526]: Socket Buffers: R=[131072->131072] S=[16384->16384]
июн 02 08:18:06 artpc openvpn[6526]: Attempting to establish TCP connection with [AF_INET]***.***.***.***:636 [nonblock]
июн 02 08:20:06 artpc openvpn[6526]: TCP: connect to [AF_INET]***.***.***.***:636 failed: Connection timed out
июн 02 08:20:06 artpc openvpn[6526]: SIGUSR1[connection failed(soft),init_instance] received, process restarting
июн 02 08:20:06 artpc openvpn[6526]: Restart pause, 10 second(s)
июн 02 08:20:16 artpc openvpn[6526]: TCP/UDP: Preserving recently used remote address: [AF_INET]***.***.***.***:636
июн 02 08:20:16 artpc openvpn[6526]: Socket Buffers: R=[131072->131072] S=[16384->16384]
июн 02 08:20:16 artpc openvpn[6526]: Attempting to establish TCP connection with [AF_INET]***.***.***.***:636 [nonblock]
... and so on
And after doing only `sudo systemctl restart openvpn-client@***.***.***.***-direct.service` it works. Connection is up.
Last edited by art (2020-06-02 15:26:52)
Offline
I reposted this at https://bbs.archlinux.org/viewtopic.php?pid=1908081
Offline
I reposted this at https://bbs.archlinux.org/viewtopic.php?pid=1908081
Do not do that. If you want it moved, please ask using the report link.
Last edited by ewaller (2020-06-02 17:10:20)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Mod note: Moving to Networking.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Looks like you found a way to restore openvpn connection after waking up system.
How to start OpenVPN after my machine wake up (or reboots) without entering login / pass each time to run it using `sudo`?
Does the system ask for your user password when you execute sudo systemctl restart openvpn-client@***.***.***.***-direct.service and is that what you want to avoid ?
If not, which login / pass do you want to skip ?
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Does the system ask for your user password when you execute sudo systemctl restart openvpn-client@***.***.***.***-direct.service and is that what you want to avoid ?
Yes, I'd like to automate it so that I don't need to enter login / pass each time I wake up my laptop. Now each time I open console and type `vpnstart` (alias for sudo systemctl restart ..) and then login / pass pair.
Offline
There are multiple ways to achieve that with sudo .
My personal favorite is Enable explicitly defined commands only for user USER_NAME on host HOST_NAME without password: in https://wiki.archlinux.org/index.php/Su … le_entries .
You would have to convert vpnstart from an alias to a script and remove sudo / su from it as the script is INTENDED to be run with root rights.
Your user would then run it like sudo vpnstart .
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Thanks for the hit! Did it. A few key presses less It works. Though I thought about how to make it without any presses.
Last edited by art (2020-06-04 16:02:10)
Offline
Maybe this helps https://wiki.archlinux.org/index.php/Op … er_suspend
Offline
Maybe this helps https://wiki.archlinux.org/index.php/Op … er_suspend
Thanks! That is solution. Overlooked that :-/
Offline