Ubuntu Server 16.04 - OpenVPN seems not to start, no logs get written
The problem is that service config /lib/systemd/system/openvpn.service
just calls /bin/true
(I have no idea on why it wasn't just removed).
Usable configuration might be found in /lib/systemd/system/[email protected]
, but it still needs to be somewhat hacked.
Solution that worked for me:
1. Create dependency on networking service
To protect it from overwriting, create it in a separate file in subdirectory:
mkdir -p /lib/systemd/system/openvpn\@.service.d
Create a file in this directory. Its name must end with .conf
, for example:
vi /lib/systemd/system/openvpn\@.service.d/local-after-ifup.conf
Put following content in this file:
[Unit]
Requires=networking.service
After=networking.service
2. Try to start the server
systemctl start openvpn@<CONF_NAME>.service
Where CONF_NAME is the name of your .conf
file in /etc/openvpn
directory. In your case:
systemctl start [email protected]
3. Enable service autostart if everything works
systemctl enable [email protected]
After searching all over I found this link:
https://a20.net/bert/2016/09/27/openvpn-client-connection-not-started-on-ubuntu-16-04/
edit /etc/default/openvpn, uncomment AUTOSTART=”all”
sudo systemctl daemon-reload
sudo service openvpn restart
I boiled it down a bit more into :
echo 'echo "AUTOSTART="\"all"\"" >> /etc/default/openvpn' | sudo -s
sudo systemctl daemon-reload
sudo service openvpn restart
Server conf file is myserver.conf
systemctl enable openvpn@myserver
service openvpn@myserver start
Server conf file is yourserver.conf
systemctl enable openvpn@yourserver
service openvpn@yourserver start