RobertR
Posts: 6
Joined: Mon Mar 16, 2015 10:53 pm

OpenVPN / Jessie / Systemd

Thu Jul 16, 2015 9:38 pm

Hi, I've OpenVPN installed on my Raspberry with Jessie.

The serverfile is located /etc/openvpn/server.conf

When I boot the systemd fails to start [email protected]

Code: Select all

[email protected] ~ $ systemctl status [email protected][email protected] - OpenVPN connection to server
   Loaded: loaded (/lib/systemd/system/[email protected]; enabled)
   Active: failed (Result: exit-code) since do 2015-07-16 23:18:13 CEST; 1min 36s ago
  Process: 608 ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --config /etc/openvpn/%i.conf (code=exited, status=1/FAILURE)
However when I try

Code: Select all

systemctl start [email protected]
It starts without any problems

Does anyone know how I can fix that it will start at boot?

RobertR
Posts: 6
Joined: Mon Mar 16, 2015 10:53 pm

Re: OpenVPN / Jessie / Systemd

Fri Jul 17, 2015 8:41 pm

After digging google I found a solution

I edited /lib/systems/system/[email protected] and added

Code: Select all

After=multi-user.target

Code: Select all

[Unit]
Description=OpenVPN connection to %i
PartOf=openvpn.service
ReloadPropagatedFrom=openvpn.service
After=multi-user.target

[Service]
Type=forking
ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --config /etc/openvpn/%i.conf
ExecReload=/bin/kill -HUP $MAINPID
WorkingDirectory=/etc/openvpn

[Install]
WantedBy=multi-user.target

kadway
Posts: 1
Joined: Thu Dec 10, 2015 9:42 pm

Re: OpenVPN / Jessie / Systemd

Thu Dec 10, 2015 9:46 pm

Thank you!
I've been searching for a solution for the same problem for quite some time already. Is this a problem in Jessie only? In my older raspberry still running wheezy this did not happen :S
Anyway, thanks this did the trick!

alexanderfortin
Posts: 1
Joined: Tue Dec 15, 2015 9:06 pm

Re: OpenVPN / Jessie / Systemd

Tue Dec 15, 2015 9:15 pm

I've got another issue apparently related to Jessie / systemd regarding OpenVPN: the only way for me to make it run is to manually execute
# openvpn --config /etc/openvpn/client.conf --daemon

In this way I can see the expected logs in /var/log/syslog and openvpn is properly started and connected to the peer. Anyway, when I try to do the same thing via systemctl, it says it's started ok but no actual process is running:

Code: Select all

[email protected]:~# systemctl status openvpn
● openvpn.service - OpenVPN service
   Loaded: loaded (/lib/systemd/system/openvpn.service; enabled)
   Active: inactive (dead) since Tue 2015-12-15 21:10:03 UTC; 29s ago
  Process: 22659 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 22659 (code=exited, status=0/SUCCESS)

[email protected]:~# systemctl start openvpn
[email protected]:~# systemctl status openvpn
● openvpn.service - OpenVPN service
   Loaded: loaded (/lib/systemd/system/openvpn.service; enabled)
   Active: active (exited) since Tue 2015-12-15 21:11:06 UTC; 4s ago
  Process: 23356 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 23356 (code=exited, status=0/SUCCESS)

Dec 15 21:11:06 .devsum.it systemd[1]: Started OpenVPN service.
[email protected]:~# pgrep openvpn
[email protected]:~#
Also, syslog does log only those 2 entries:
Dec 15 21:11:06 systemd[1]: Starting OpenVPN service...
Dec 15 21:11:06 systemd[1]: Started OpenVPN service.

Ideas?

Return to “Raspbian”