VPN Instability getting old

VPN stability issues is getting very annoying. I am a subscriber to Private Internet Access. I own a MT300A-EXT, MT300Nv2 and AR300 Lite. All of them I have been running on version 2.26 in order to receive the best stability for OpenVPN which is the main reason I bought the routers, to connect my devices to a VPN connected device. I recently updated my MT300Nv2 to 2.271 the latest version. I did this after seeing the Slate anouncement thinking the software update was going to be what was described. (its not, no big deal). But my issue is my VPN wont stay connected. I always get errors which is why I always end up reverting to 2.26 (because it is the most stable with OpenVPN).

Here is the most recent error:
ERROR: Linux route delete command failed: external program exited with error status: 2 ERROR: Linux route delete command failed: external program exited with error status: 2 ERROR: Linux route delete command failed: external program exited with error status: 2 /sbin/ip addr del dev tun0 local 10.50.10.6 peer 10.50.10.5 SIGTERM[soft,auth-failure] received, process exiting

Can someone explain what is going on? will these issues ever be fixed or is it something I have to live with resetting my VPN switch periodically…

Any version past 2.26 my VPN will error out within an hour usually closer to a few minutes.

2.26 I’ve had it running for 24 hours without issue before getting an error.

The 2.271 firmware has been the most unstable for almost everyone not only you. The new slate will come with v3 of the firmware which is not out yet, but that one will be much more stable and faster than the v2’s.

v3 will start rolling out in the next few weeks so hold on for that and use the 2.26 until then.

Many, if not most of these disconnect problems are PIA related- switch to a another provider (like I did) and you will be much happier!

For me on 2.27 with the Switch Button Configuration set to OpenVpn Toggle my router will start two processes of openvpn which conflict with each other. If the router tries to restart openvpn I will get this ERROR: Linux route delete command failed because of the conflict.

To see if this is your issue, you can ssh into the router and see if two openvpn’s are running. Execute:
ps | grep openvpn

If you have two,you are having the same problem as I did.

Disable the Switch Button Configuration and reboot - then just use the toggle Enable OpenVPN button on the VPN page.

The startvpn init script doesn’t do sanity checks before starting the daemon and there is a race condition with startvpn being called twice on bootup in the initswitch and startvpn scripts.

In 2.27 /etc/init.d/startvpn

This line was changed:

stop(){
kill -9 $(cat /var/run/ovpn_client.pid) >/dev/null 2>&1

The problem is startvpn is being called twice so there are two processes. This kill command doesn’t kill the conflicting one - only the one that wrote its pid file.

The old script prior to 2.27 ran

stop(){
killall openvpn

Which would clean up the conflicting openvpn process on vpn restart (and not fully exposing the race condition that was still present then). Dirty - but it sort of worked.

@alzhao Ideally it would be best to add some logic at the top of the startvpn start function like

start(){
if [ “$(pgrep /usr/sbin/openvpn)” ]; then
echo OpenVPN already started… Exiting.
exit 1
fi

This fixes it so I can use the switch to toggle VPN and if startvpn is called twice, the second time it will exit properly.

I posted a modified file here that should fix what you’re discussing.

That’s cool you found the problem as well. Your modification will actually just exit the script once it gets to the exit 0 you added on line 63 - not starting openvpn from the script. The same effect would be just deleting the openvpn start command in the original script. The reason why it works for you is its being started by startvpn later in the boot process.

It’s best to fix it at the source of the problem. If startvpn start or restart is called multiple times, it should refuse to spawn more processes, exit with an error message and error code.