Score:0

Can't start OpenVPN server on Linux

eh flag

I am creating my own OpenVPN server on DigitalOcean using this guideline.

I have problem starting from step 10. I just can't start start this server and get error all the time.

The guide says, that I need to execute 2 commands - sudo systemctl -f enable openvpn-server@server.service and sudo systemctl start openvpn-server@server.service.

After execution of the first one it seems like just nothing happens, but after execution of the second one I get this:

sammy@OpenVPN-Server:/etc/openvpn/server$ sudo systemctl start openvpn-server@server.service
Job for openvpn-server@server.service failed because the control process exited with error code.
See "systemctl status openvpn-server@server.service" and "journalctl -xe" for details.

And here is interesting thing, this is result, that I have got while trying to get all openvpn services. As you can see, there is no such - openvpn-server@server.service - service:

sammy@OpenVPN-Server:/etc/openvpn/server$ sudo systemctl list-unit-files | grep openvpn
openvpn-client@.service                    disabled        enabled
openvpn-server@.service                    indirect        enabled
openvpn.service                            enabled         enabled
openvpn@.service                           disabled        enabled

Also I tried to play with it and start other services, but seems hopeless. What should I do?

Here is some configurations from my server.conf file:

sammy@OpenVPN-Server:/etc/openvpn/server$ ls
ca.crt  server.conf  server.crt  server.key

...
# Also tried with just names, still doesn't work
ca /etc/openvpn/ca.crt
cert /etc/openvpn/easy-rsa/keys/server.crt
key /etc/openvpn/easy-rsa/keys/server.key
pzkpfw avatar
us flag
The guide you're reading is two years old, it's completely possible that `openvpn-server@server.service` is now called `openvpn-server@.service`. Also, there is never a need to to enable and then start, you can always do `systemctl enable [service] --now` to do both at once.
dummyuser avatar
uy flag
Do you get errors when starting the openvpn service manually? `/usr/sbin/openvpn --status /run/openvpn/server.status 10 --cd /etc/openvpn --config /etc/openvpn/server.conf --writepid /run/openvpn/server.pid` You will get a nice log. If yes, please fix configuration errors first.
dokichan avatar
eh flag
@dummyuser Thanks you so much, using this command I have found my error!
Score:1
eh flag

Thanks to dummyuser I was able to find the error. Using this command - /usr/sbin/openvpn --status /run/openvpn/server.status 10 --cd /etc/openvpn --config /etc/openvpn/server/server.conf --writepid /run/openvpn/server.pid - I was able to list nice log. There, I had error with this server.conf line:

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
client-config-dir ccd

This option was uncommented, and I had error, that there is no such folder. So, you can either create it or comment this line.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.