Ubuntu – How to start the OpenVPN client service on Ubuntu 15.04

15.04openvpn

I can launch OpenVPN and point it at the config file and everything works fine, such as:

sudo openvpn /etc/openvpn/myvpn.conf

but when I try start the service with

sudo /etc/init.d/openvpn start

All I get is the output in syslog:

Jun 23 21:02:30 pc systemd[1]: Starting OpenVPN service...
Jun 23 21:02:30 pc systemd[1]: Started OpenVPN service.

But it is lying to me, there is no openvpn service running:

gk@pc:/etc/openvpn$ ps -aux | grep openvpn
gk   15456  0.0  0.0  13688  2128 pts/0    S+   21:18   0:00 grep --color=auto openvpn

No other openvpn processes running. How can I start the service?

I note with some hilarity that inside /lib/systemd/system/openvpn.service there is:

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true
WorkingDirectory=/etc/openvpn

I'm pretty sure /bin/true ISNT my openvpn client application. Is this why openvpn client doesn't work from the command line on Ubuntu 15.04?

Best Answer

Is this why openvpn client doesn't work from the command line on Ubuntu 15.04?

No. The reason is that you haven't read the commentary at the top of that very unit file, and you are calling a System 5 rc script directly. Do not call System 5 rc scripts directly, especially on a system where System 5 rc isn't used, such as Ubuntu version 15.

Calling them indirectly via the service command is wrong in the case of OpenVPN, too.

OpenVPN is a templatized service under systemd. The services are named openvpn@config.service. So you should be starting your /etc/openvpn/myvpn.conf instance with

systemctl start openvpn@myvpn.service

Further reading

Related Question