VPN fails to connect after sleep/suspend

I set up a couple connections to ProtonVPN servers by importing their ovpn files into networkmanager, and everything works just fine until my machine suspends. Once I wake it up my vpn is disabled and it refuses to reconnect. Are there any tweaks I can enable to continue using the vpn without a reboot?

I experience the same issue - VPN works fine until a sleep/suspend and then it shuts off. Sometimes it keeps working for a short while after the laptop sleeps, but anything more than an hour and it’s definitely disconnected. To re-connect, I use “sudo service openvpn restart” and this always does the trick for me.

However, since I lock/suspend my Librem 13 more than a dozen times/day I really would love to find a fix to this so OpenVPN will automatically re-connect when the laptop is woken up!

Thanks for the reply. I think I found one potential problem on my end. It doesn’t seem like my password is being stored through the suspend/resume cycle. I’m able to reconnect if I reenter it and hit ‘apply’. Thanks for the tip about openvpn restart. I’m coming from an Arch setup that used a different network manager.

So, I was able to find a permanent fix for this, at least for me. I use Mullvad VPN because of their great track record on security & privacy, and Mullvad supports Wireguard for Linux installations. So I turned off OpenVPN and installed Wireguard, and have been extremely impressed with its performance.

Not only is it a significant upgrade from OpenVPN in terms of security (more modern/high quality ciphers), but it’s also much faster. And it completely eliminates the issue of the VPN failing to reconnect after my Librem sleeps/suspends. Highly recommend!

Looks like ProtonVPN doesn’t have wireguard servers yet; but that’s an exciting project to keep an eye on!

For OpenVPN users, the ArchWiki has a couple of recommendations you might find useful: https://wiki.archlinux.org/index.php/OpenVPN#Client_daemon_not_reconnecting_after_suspend. I believe they can easily be adapted to PureOS or most Linux distributions.

I would exercise caution using WireGuard, as the project is still a WIP. From their website:

You should not rely on this code. It has not undergone proper degrees of security auditing and the protocol is still subject to change.

Agreed, that standard disclaimer should not be ignored, but WireGuard has been under development for years and heavily tested, and a stable 1.0 release is coming this year.

WireGuard has been designed from the ground up to be more secure (state of the art cryptography) and high performance, and WOW…I was very impressed with the speed and connectivity boost I experienced when I switched over from OpenVPN. I’d encourage anyone to give it a try and compare to their OpenVPN experience.

Nice find; I’ll set up that service and see if it resolves things.

Yeah, I remember this from Arch bug tracker as well, network-manager openVPN module had a bug. I believe it is fixed in the latest release (as I can’t reproduce it on my Arch or on my PureOS machine anymore).

Yup, passwords are saved after a recent update.

The Arch wiki fix for the vpn not reconnecting after suspend works partially. I don’t have to manually restart the openvpn service, but I do have to reconnect to the vpn once again via the sliders in the system dropdown menu. Ideally I’d like to have a connection persist across suspend and resume until I manually disable it. I’ll keep poking around for solutions.

I am using an openvpn compatible VPN service and having the same issue. I am not running PureOS so asking here may be annoying at best but I assume if anyone has a fix it should work across platform. It would not be hardware related would it? Wifi comes back automagically but I have to hit the slider in teh Gnome drop down to turn VPN on after going to sleep.
Is anyone seeing openVpn reconnect automatically after being asleep? At the very least I can confirm what @rjrjr is seeing.