You are not logged in.

#1 2016-07-17 12:37:55

extrapalantine
Member
Registered: 2016-07-15
Posts: 62

OpenVPN connection works when started manually, but not via systemd

Hello,

I've been working on getting my OpenVPN connection set up. The strange thing is, it works great when I start it manually via

openvpn /etc/openvpn/vpnunlimited.conf

...but when I try to start it with

systemctl start openvpn@vpnunlimited.service

it always fails.

Here's the result of journalctl -xe

-- Subject: Unit openvpn@vpnht-128.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit openvpn@vpnunlimited.service has begun starting up.
Jul 17 14:29:14 ben openvpn@vpnunlimited[28108]: OpenVPN 2.3.11 x86_64-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [MH] [IPv6] built on May 12 2016
Jul 17 14:29:14 ben openvpn@vpnunlimited[28108]: library versions: OpenSSL 1.0.2h  3 May 2016, LZO 2.09
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:5559
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Jul 17 14:29:14 ben systemd[28110]: openvpn@vpnunlimited.service: Failed at step EXEC spawning /usr/bin/expect: No such file or directory
-- Subject: Process /usr/bin/expect could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /usr/bin/expect could not be executed and failed.
-- 
-- The error number returned by this process is 2.
Jul 17 14:29:14 ben systemd[1]: openvpn@vpnunlimited.service: Control process exited, code=exited status=203
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: Control Channel Authentication: tls-auth using INLINE static key file
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: Socket Buffers: R=[212992->212992] S=[212992->212992]
Jul 17 14:29:18 ben openvpn@vpnunlimited[28109]: UDPv4 link local: [undef]
Jul 17 14:29:18 ben openvpn@vpnunlimited[28109]: UDPv4 link remote: [AF_INET]185.94.31.5:1197
Jul 17 14:29:18 ben openvpn@vpnunlimited[28109]: SIGTERM[hard,init_instance] received, process exiting
Jul 17 14:29:18 ben systemd[1]: Failed to start OpenVPN connection to vpnunlimited.

Here's the result of systemctl status openvpn@vpnunlimited.service:

● openvpn@vpnunlimited.service - OpenVPN connection to vpnunlimited
   Loaded: loaded (/etc/systemd/system/openvpn@.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2016-07-17 14:29:18 EEST; 7min ago
  Process: 28110 ExecStartPost=/usr/bin/expect /etc/systemd/system/telnet_pw.exp (code=exited, status=203/EXEC)
  Process: 28108 ExecStart=/usr/sbin/openvpn --management localhost 5559 --management-query-passwords --management-forget-disconnect --config /etc/openvpn/%i.conf --daemon openvpn@%i --cd /etc/openvpn (code=exited, status=0/SUCCESS)
 Main PID: 28109 (code=exited, status=0/SUCCESS)

Jul 17 14:29:14 ben systemd[1]: openvpn@vpnunlimited.service: Control process exited, code=exited status=203
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: Control Channel Authentication: tls-auth using INLINE static key file
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Jul 17 14:29:14 ben openvpn@vpnunlimited[28109]: Socket Buffers: R=[212992->212992] S=[212992->212992]
Jul 17 14:29:18 ben openvpn@vpnunlimited[28109]: UDPv4 link local: [undef]
Jul 17 14:29:18 ben openvpn@vpnunlimited[28109]: UDPv4 link remote: [AF_INET]185.94.31.5:1197
Jul 17 14:29:18 ben systemd[1]: Failed to start OpenVPN connection to vpnunlimited.
Jul 17 14:29:18 ben systemd[1]: openvpn@vpnunlimited.service: Unit entered failed state.
Jul 17 14:29:18 ben systemd[1]: openvpn@vpnunlimited.service: Failed with result 'exit-code'.

Last edited by extrapalantine (2016-07-17 12:40:26)

Offline

#2 2016-07-20 22:25:01

drgn
Member
From: tmplt @ freenode
Registered: 2015-08-13
Posts: 13

Re: OpenVPN connection works when started manually, but not via systemd

/usr/bin/expect is not used on my machine when running OpenVPN via systemd. What does `systemctl cat openvpn@` print?

Offline

Board footer

Powered by FluxBB