3

When I start openvpn on the server with:

sudo openvpn /etc/openvpn/server.conf 

It works and I can connect my client to it.

When I start it with:

sudo /etc/init.d/openvpn start

It appears to work as I see:

* Starting virtual private network daemon(s)...
*   Autostarting VPN 'openvpn': missing /etc/openvpn/openvpn.conf file !

But I cannot connect the client to it.

Checking the port shows it as "closed" (in the sense that nothing is listening there... it is not closed by the firewall) in the latter case while "open" in the former.

So where is the disconnect? Is init.d not starting what I thought it would? Is it not loading the correct conf file (but then why do I not need to load openvpn.conf when I start the server directly)? Am I missing a parameter somewhere?


EDIT: Reason behind the solution

Examining the init.d script as suggested by JeffG showed it was getting the $NAME of the conf file from:

NAME=${NAME%%.pid}

Which then looks for:

$CONFIG_DIR/$NAME.conf

This made: NAME=openvpn so then the script went looking for openvpn.conf which does not exist as I named the file server.conf (which is how the instructions on the openvpn site say to name the file). Simply copying that file over to be named as the init.d script wanted (Hyppy's solution) fixed the problem.

2

Try this:

sudo cp /etc/openvpn/server.conf /etc/openvpn/openvpn.conf
1

Check you init.d script. Ensure that it is using /etc/openvpn/server.conf for configuration

  • I wish I could vote two answers up as, while Hyppy's answer satisfied my immediate problem, your answer helped me see why. Turns out the init.d script was getting the name of the conf file from the PID of openvpn. That being 'openvpn' and there was no openvpn.conf so it was not working properly. Thanks for the input though, I appreciate the assistance. – Lothar_Grimpsenbacher Mar 21 '11 at 21:42
1

Im quite new to Raspberi Pi and i ran into the same problem after i installed OpenVPN. It works when I start it via the CLI using:

openvpn --config /etc/openvpn/openvpn.conf

But whenever I start it via "/etct/init.d/openvpn start" or "service openvpn start" it doesn't seem to be reading my config file. This section on the startup script gave me a hint...

  # autostart VPNs
  if test -z "$2" ; then
    # check if automatic startup is disabled by AUTOSTART=none
    if test "x$AUTOSTART" = "xnone" -o -z "$AUTOSTART" ; then
      log_warning_msg " Autostart disabled."
      exit 0

So i googled around how to autostart deamon on Raspbian. After enabling the openvpn to auto-start it worked for me.

update-rc.d openvpn enable

service openvpn start

i hope this helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.