Page 1 of 1

Problem starting openvpn-client@service.service

Posted: Thu Dec 06, 2018 4:18 pm
by cliffhanger
Hello

I'm new to the forum and a newbie to VPN's - bear with me.

I've just installed the latest Openvpn on Ubuntu 16.04 using systemd. Two questions to start:

1) Do I need to start the server service to setup a simple VPN through a provider or whatever?

2) I assume the client service has to be running, at startup, to setup a VPN using a connection manager like Connman or Networkmanger?

I assumed that 2) is true and enabled the service, but get the following errors(journalctl -xe):

openvpn-client@service.service - OpenVPN tunnel for service
Loaded: loaded (/lib/systemd/system/openvpn-client@.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-12-06 15:58:28 GMT; 8s ago
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/w ... n24ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Process: 9018 ExecStart=/usr/sbin/openvpn --suppress-timestamps --nobind --config %i.conf (code=exited, status=210/CHROOT)
Main PID: 9018 (code=exited, status=210/CHROOT)

Dec 06 15:58:28 cliffhangers systemd[1]: Starting OpenVPN tunnel for service...
Dec 06 15:58:28 cliffhangers systemd[9018]: openvpn-client@service.service: Failed at step CHROOT spawning /usr/sbin/openvpn: No such file or directory
Dec 06 15:58:28 cliffhangers systemd[1]: openvpn-client@service.service: Main process exited, code=exited, status=210/CHROOT
Dec 06 15:58:28 cliffhangers systemd[1]: Failed to start OpenVPN tunnel for service.
Dec 06 15:58:28 cliffhangers systemd[1]: openvpn-client@service.service: Unit entered failed state.
Dec 06 15:58:28 cliffhangers systemd[1]: openvpn-client@service.service: Failed with result 'exit-code'

Any ideas here?

I thought this might have been connected to the 'spawn' package. But it seems not. If I run '/usr/sbin/openvpn' from the command line it's functional.

Thanks

Cliff

Re: Problem starting openvpn-client@service.service

Posted: Fri Dec 07, 2018 2:08 pm
by TinCanTech
cliffhanger wrote:
Thu Dec 06, 2018 4:18 pm
(code=exited, status=210/CHROOT)
I expect you have not chroot'ed correctly, it's tricky to get right and I have never even tried while using systemd.

Re: Problem starting openvpn-client@service.service

Posted: Fri Dec 07, 2018 8:59 pm
by cliffhanger
Thanks for getting back. This is the .conf file under/etc/openvpn:


remote vpn-se8.privatevpn.com 1194 udp
nobind
dev tun

# Options
tun-ipv6
remote-cert-tls server
client
comp-lzo
persist-key
persist-tun
verb 3

# Crypto
cipher AES-128-CBC
auth SHA256
auth-user-pass /etc/openvpn/privatvpn.login
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

# Cert

I assume Chroot is not connected to this? Is this an openvpn problem or systemd?

thanks

Cliff

Re: Problem starting openvpn-client@service.service

Posted: Sat Dec 08, 2018 2:44 pm
by cliffhanger
The other thing is why chroot, which I use quite often in a year, would be involved in trying to get a vpn up?

Cliff

Re: Problem starting openvpn-client@service.service

Posted: Sat Dec 08, 2018 3:04 pm
by TinCanTech
Perhaps your openvpn client log will have some information.

I am using openvpn on ubuntu 16.04 in exactly the same way as you and it is working for me.

Re: Problem starting

Posted: Sat Dec 22, 2018 10:06 pm
by cliffhanger
Hi

Well stupid me. The problem was the dir placing. Should have been /etc/openvpn/client NOT /etc/openvpn.

I now get

openvpn-client@service.service - OpenVPN tunnel for service
Loaded: loaded (/lib/systemd/system/openvpn-client@.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-12-22 21:54:55 GMT; 2s ago
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/w ... n24ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Process: 8821 ExecStart=/usr/sbin/openvpn --suppress-timestamps --nobind --config %i.conf (code=exited, status=1/FAILURE)
Main PID: 8821 (code=exited, status=1/FAILURE)

Dec 22 21:54:55 cliffhangers systemd[1]: Starting OpenVPN tunnel for service...
Dec 22 21:54:55 cliffhangers openvpn[8821]: Options error: In [CMD-LINE]:1: Error opening configuration file: service.conf
Dec 22 21:54:55 cliffhangers openvpn[8821]: Use --help for more information.
Dec 22 21:54:55 cliffhangers systemd[1]: openvpn-client@service.service: Main process exited, code=exited, status=1/FAILURE
Dec 22 21:54:55 cliffhangers systemd[1]: Failed to start OpenVPN tunnel for service.
Dec 22 21:54:55 cliffhangers systemd[1]: openvpn-client@service.service: Unit entered failed state.
Dec 22 21:54:55 cliffhangers systemd[1]: openvpn-client@service.service: Failed with result 'exit-code'

I have a 'conf' file from my provider which works if started manually. How do i get the client service to see this? The 'openvpn-client@service' file is now pointing to the right directory.

thanks

Cliff

Re: Problem starting openvpn-client@service.service

Posted: Sun Dec 23, 2018 1:19 am
by TinCanTech
Can you run your openvpn config file without using systemd ?

Something like:

Code: Select all

me@home: /root # cd /etc/openvpn/client
me@home: /etc/openvpn/client # openvpn service.conf

Re: Problem starting openvpn-client@service.service

Posted: Sun Dec 30, 2018 8:32 pm
by cliffhanger
Yes and get a connection. It's the 'openvpn-client@service' file that is the problem.

Thanks

Re: Problem starting openvpn-client@service.service

Posted: Mon Dec 31, 2018 5:23 pm
by TinCanTech
TinCanTech wrote:
Sun Dec 23, 2018 1:19 am
Can you run your openvpn config file without using systemd ?
cliffhanger wrote:
Sun Dec 30, 2018 8:32 pm
Yes and get a connection
OK.
cliffhanger wrote:
Sat Dec 22, 2018 10:06 pm
Options error: In [CMD-LINE]:1: Error opening configuration file: service.conf
The file name is incorrect ..

Re: Problem starting openvpn-client@service.service

Posted: Wed Jan 02, 2019 7:43 am
by cliffhanger
Thanks but I don't have a file called service.conf and when I rename the current configuration file to 'service' it makes no difference. Cliff

Re: Problem starting openvpn-client@service.service

Posted: Mon Aug 24, 2020 12:17 pm
by csadam
Hi cliffhanger!

I've wasted some time today with the same problem on Ubuntu 20. Finally I've found the solution.
There are a lot of systemd magic happening in the background and I've not found any documentation of these OpenVPN related services.
So I can't explain how it works....
But the solution is to start the service like this:

Code: Select all

sudo systemctl start openvpn@client
where the "client" is the .conf file name in /etc/openvpn.
You can use any name for the .conf file, just use the same name after the @ in the command.

Alternatively, you can use the

Code: Select all

sudo systemctl start openvpn-client@client
The difference is that it tries to find the config file in '/etc/openvpn/client'. Also this service is disabled by default on Ubuntu 20.

Re: Problem starting openvpn-client@service.service

Posted: Mon Aug 24, 2020 12:48 pm
by Pippin