Ok, so I've been searching the web for solutions to this problem with no answers seeming to work for me. Hopefully someone can help me. I'm only trying to configure the OpenVPN Client.

I'm running CrunchBang Linux 3.2.0-4-amd64 Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux and I just switched over to using systemd. The changeover went smooth enough but now I can't get my OpenVPN client to come up using systemd I've tried following these configuration tutorials, but nothing works.

I can bring up the tunnel from the command line with openvpn /etc/openvpn/vpn.conf. So I know the config file is good, it was working with sysvinit just fine so I'm not surprised. I then attempt to just do a status with systemctl status [email protected] resulting in:

$ sudo systemctl status [email protected]
  [email protected]
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)

I realized that I need to do some setup for services. I want to be prompted for a password so I followed this guide to create an [email protected] in /etc/systemd/system/. But restarting the OpenVPN service still doesn't prompt for a password.

$ sudo service openvpn restart
[ ok ] Restarting openvpn (via systemctl): openvpn.service.

The Fedora tutorials go through the steps of creating symbolic links, but don't create any of the .service files in the walk-throughs.

What piece am I missing? Do I need to create an [email protected]? If so, where exactly do I place it? I feel like it shouldn't be this difficult, but I can't seem to find any solution that works for me. I'm happy to provide any more information that's needed.


-rw-r--r--  1 root root   319 Aug  7 10:42 [email protected]

Description=OpenVPN connection to %i

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

[email protected] (END)


lrwxrwxrwx  1 root root   36 Aug  7 10:47 [email protected] -> /lib/systemd/system/[email protected]

Prompt For Password

Everything is working now, except for being prompted for a password to connect. I've attempted this solution. I tweaked the file from above just a bit, and added an Expect script like in the example. Working like a charm! My files are below.

Modified lines from the above /lib/systemd/system/[email protected]

ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --management localhost 5559 --management-query-passwords --management-forget-disconnect --config /etc/openvpn/%i.conf
ExecStartPost=/usr/bin/expect /lib/systemd/system/openvpn_pw.exp

Expect script /lib/systemd/system/openvpn_pw.exp. Make sure to do the following:

  • chmod +x on the script.
  • Have telnet installed

Code of the expect script:

set pass [exec /bin/systemd-ask-password "Please insert Private Key password: "]

spawn telnet 5559
expect "Enter Private Key Password:"
send "password 'Private Key' $pass\r"
expect "SUCCESS: 'Private Key' password entered, but not yet verified"
send "exit\r"
expect eof

It should be noted that the above solution does log your password entered in plaintext in the following logs in /var/log/syslog and /var/log/daemon.log

  • How does the [email protected] file looks like? Aug 7, 2014 at 14:11
  • Updated the post with the current error
    – RoraΖ
    Aug 7, 2014 at 15:10
  • Look in /var/log/{syslog,daemon.log} and journalctl -b -m to find why OpenVPN exited. One of those places should contain the real error messages. (Or even journalctl -b -m _EXE=/usr/sbin/openvpn should give just OpenVPN messages).
    – derobert
    Aug 7, 2014 at 15:10
  • Yep, I was getting there. We're hitting the password problem. I'll try this solution for it: bbs.archlinux.org/viewtopic.php?id=150440 Thanks for all your help!
    – RoraΖ
    Aug 7, 2014 at 15:14
  • just for the record: copying the systemd script under /etc/systemd/system makes the changes permanent. If you change the script directly under /lib/systemd/system, this is going to be overwritten at some point by a package update.
    – Lethargos
    Apr 19, 2021 at 11:14

8 Answers 8


I think the Debian OpenVPN setup with systemd is currently a tad bit broken. To get it to work on my machines I had to:

  1. Create /etc/systemd/system/[email protected] (the directory), and place in it a new file with this:

    I called my file local-after-ifup.conf. It needs to end with .conf. (This is the bit that's currently a tad bit broken.)

  2. Create a file in /etc/tmpfiles.d (I called mine local-openvpn.conf) with the contents:

    # Type Path         Mode UID  GID  Age Argument
    d      /run/openvpn 0755 root root  -  -
    This is Debian bug 741938 (fixed in 2.3.3-1).

  3. Create a symlink into multi-user.target.wants (easiest way is systemctl enable openvpn@CONF_NAME.service) E.g., if you have /etc/openvpn/foo.conf, you'd use [email protected].

  4. If you also have the SysV init script showing up in systemd, disable it. This is Debian bug 700888 (fixed in 2.3.3-1).

NOTE: 2.3.3-1 or later is not yet in testing, though it is in unstable.

  • systemctl enable still fails saying no such file or directory. I don't see any sysv init scripts in /lib/systemd, unless its systemd-initctl?
    – RoraΖ
    Aug 7, 2014 at 14:28
  • @raz The SysV script would be /etc/init.d/openvpn; systemd by default runs those just like sysv init would. That's the openvpn.service you have; you need to disable it (systemctl disable). Does the file /lib/systemd/system/[email protected] exist on your system?
    – derobert
    Aug 7, 2014 at 14:31
  • @raz If you have that file, you can try a manual ln -s /lib/systemd/system/[email protected] /etc/systemd/system/multi-user.target.wants/[email protected]
    – derobert
    Aug 7, 2014 at 14:32
  • I don't have that file but I'm sure I could create it. I disabled the /etc/init.d/openvpn script.
    – RoraΖ
    Aug 7, 2014 at 14:36
  • @raz I'm not sure if Crunchbang has a backport of a newer OpenVPN package with it, but if not, you can grab that script from sources.debian.net/src/openvpn/2.3.3-1/debian/…
    – derobert
    Aug 7, 2014 at 14:40

This type of unit file is an Instantiated Service - more details are available here

The following is the unit file for openvpn on CentOS 7:

Description=OpenVPN Robust And Highly Flexible Tunneling Application On %I
After=syslog.target network.target

ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf


and it resides as /usr/lib/systemd/system/openvpn@service. The %i in the file is replaced with the string after the @ in the unit name.

As the config file is at /etc/openvpn/myopenvpn.conf then the service is started with:

systemctl start [email protected]
  • I only have /usr/lib/systemd/user/ Nothing else at the /usr/lib/systemd level.
    – RoraΖ
    Aug 7, 2014 at 14:38
  • What about /lib/systemd/system/ ? I seem to have both on my system, with identical contents (and they're not symlinks!). Aug 7, 2014 at 14:46
  • I just added that file, updated my post with everything.
    – RoraΖ
    Aug 7, 2014 at 15:09

You need to create the service file by enabling openvpn@<configuration>.service.

For example, if the configuration file is /etc/openvpn/client.conf, the service name is [email protected].

From the Arch Wiki

  • $ sudo systemctl enable [email protected] [sudo] password for user: Failed to issue method call: No such file or directory
    – RoraΖ
    Aug 7, 2014 at 14:06
  • Your configuration file is called 'vpn'?
    – Karel
    Aug 7, 2014 at 14:07
  • Yes, /etc/openvpn/vpn.conf
    – RoraΖ
    Aug 7, 2014 at 14:08
  • Does systemctl start [email protected] not work either? That should work...
    – Karel
    Aug 7, 2014 at 14:16
  • 1
    This works for me on Raspbian GNU/Linux 8 (Debian Jessie). Thanks!
    – neuhaus
    Aug 5, 2017 at 10:30
  1. Place all openvpn *.conf files into /etc/openvpn/.
  2. Edit /etc/default/openvpn. Uncomment this:

  3. Run systemctl daemon-reload.

  4. Run service openvpn start.
  • I think they used this as a solution, because now is even worse in debian 9, the openvpn does not restart if a error ocurrs that is very stupid... Someone know some solution or workaround, i am writing a script to verify if openvpn is still running! Nov 23, 2017 at 18:10
  • This was perfect. it would start and stop even though I called it the obvious client.conf, now with this my single config just runs. Thanks! Feb 6, 2019 at 4:14
  • /etc/default/openvpn is still there but Debian 10 and its derivatives do not appear to use it - /usr/lib/systemd/system/openvpn.service is now a oneshot service that just runs /bin/true (for backwards compatibility?). The answers stating systemctl enable [email protected] work.
    – bain
    Jan 3, 2021 at 21:02

The proper solution would be, to make use of systemd's systemd-ask-password/"Password Agents", which provides a systemd builtin way to funnel passwords/passphrases to services.

You'll need OpenVPN 2.3.0 or newer to do this.

  • This is what the Expect script in my edited post uses.
    – RoraΖ
    Sep 15, 2014 at 18:43
  • Sorry, missed that edit. Sep 15, 2014 at 18:59

The [email protected] has evolved greatly between Debians 8 and 9. The original package for Jessie for example fails to systemctl reload openvpn@. To fix these the Stretch version introduces 10 new directives in the systemd-file including PIDFile= to make reload work again.

For Stretch users, I'd suggest going for the backport, and if not possible to do that, at least get the systemd-file from https://packages.debian.org/jessie-backports/openvpn and extract debian/[email protected] into /etc/systemd/system/[email protected] and enjoy better functionality and security.


On a fresh Jessie_8.0.0 installation I did:

  1. copy the old /etc/openvpn/cluster.conf (plus *.key and *.crt) files from wheezy
  2. uncommented AUTOSTART="all" in /etc/default/openvpn - I think this had no effect
  3. /lib/systemd/system-generators/openvpn-generator cluster
  4. systemctl restart [email protected]

Now the tunnel is up - I will see what will happen after a reboot, but I can't reboot in this moment


I had better luck using openvpn's --auth-user-pass option to reference a config file instead of using the expect script, i.e.:

ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --config /etc/openvpn/%i.conf --auth-user-pass /etc/openvpn/credentials.txt

where /etc/openvpn/credentials.txt is a text file that has my username on line 1 and my password is on line 2.

Obviously if you can't store your credentials in plain text this is not a good solution, but it works for my purposes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .