TLDR:
None of these answers worked. I switched to wireguard (https://www.wireguard.com/install/)
sudo apt install wireguard
And then followed the wireguard setup from my VPN provider.
Details:
This issue was happening for me on Ubuntu 20.04. I tried the top two answers under this question (MonkeyBrain: https://askubuntu.com/a/1103326/327631 and OttoEisen: https://askubuntu.com/a/779391/327631), separately and together and the issue still occurred.
After using sudo grep openvpn /var/log/syslog
I saw:
Mar 9 01:36:06 **** nm-openvpn[429236]: [vpn-ch5] Inactivity timeout (--ping-restart), restarting
Mar 9 01:36:06 **** nm-openvpn[429236]: SIGUSR1[soft,ping-restart] received, process restarting
Mar 9 01:36:11 **** nm-openvpn[429236]: WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
...
Mar 9 01:36:31 **** nm-openvpn[429236]: Server poll timeout, restarting
Mar 9 01:36:31 **** nm-openvpn[429236]: SIGUSR1[soft,server_poll] received, process restarting
...
Mar 9 01:36:46 **** nm-openvpn[429236]: WARNING: Failed running command (--up/--down): could not execute external program
Mar 9 01:36:46 **** nm-openvpn[429236]: Exiting due to fatal error
And some of those logs led to this answer which also did not fix the issue:
https://askubuntu.com/a/906055/327631
Finally found this from my VPN provider, which also did not solve the problem!
sudo mkdir -p /etc/openvpn/scripts
sudo wget https://raw.githubusercontent.com/jonathanio/update-systemd-resolved/master/update-systemd-resolved -P /etc/openvpn/scripts/
sudo chmod +x /etc/openvpn/scripts/update-systemd-resolved
Then edit your OpenVPN client file (e.g. *.ovpn) by adding the up/down scripts.
Add these 3 lines after the line where it shows your server name (e.g. remote servername.vpn.com 443 TCP):
script-security 2
up /etc/openvpn/scripts/update-systemd-resolved
down /etc/openvpn/scripts/update-systemd-resolved
So I gave up and switched to wireguard (https://www.wireguard.com/install/)
sudo apt install wireguard
And then followed the wireguard setup from my VPN provider.