This all started one chilly January morning when I upgraded my CentOS 7 virtual machine.
My OpenVPN connection would fail to start because the /run/openvpn/ovpn-client.status
file was not there nor the /run/openvpn
directory.
It took a lot of investigative work but what we found was the /usr/lib/tmpfiles.d/openvpn.conf
file had this in it:
d /run/openvpn-client 0710 root root -
d /run/openvpn-server 0710 root root -
This temp file was making the directories in the /run
folder that were needed on start for OpenVPN to work.
As you can see the first line is creating the /run/openvpn-client
folder. This would be all well and good but the openvpn.service on startup is looking for /run/openvpn
without the “-client” and that is no good.
To fix this situation we ran:
nano /usr/lib/systemd/system/openvpn.service
Then changed this line:
ExecStart=/usr/sbin/openvpn --daemon ovpn-client --status /run/openvpn/ovpn-client.status 10 --cd /etc/openvpn --config /etc/openvpn/client.conf
To this:
ExecStart=/usr/sbin/openvpn --daemon ovpn-client --status /run/openvpn-client/ovpn-client.status 10 --cd /etc/openvpn --config /etc/openvpn/client.conf
So on startup the OpenVPN client would be looking for the correct directory.
You then reboot the virtual machine and you should be good to go. All services should have started properly and your vpn should be working as expected.
- OpenVPN Fails to Start on Boot – CentOS 7 - February 26, 2018
- Updating Git Remotes in Tower for Mac - December 9, 2016
- Thankful - February 2, 2016