E
E
Evgeny2016-09-10 14:32:19
linux
Evgeny, 2016-09-10 14:32:19

Why does systemd start OpenVPN before the interfaces defined in /etc/network/interfaces are ready?

Greetings!
After upgrading to Ubuntu 16.04, OpenVPN does not start.
The problem is that systemd tries to start the service when the br0 interface defined in /etc/network/interfaces is not yet ready:

...
auto br0
iface br0 inet static
    bridge_ports p9p1
    bridge_fd 0
    address 192.168.1.1
    netmask 255.255.255.0
...

In turn, OpenVPN executes the script at startup:
#!/bin/bash
#
ifconfig $1 up
brctl addif br0 $1

which, if the br0 bridge is not ready, fails and prevents the service from starting.
Tell me how to force systemd to start OpenVPN only after the interfaces are fully ready, or how to wait in the script for this readiness (do not offer sleep because it's a crutch)?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
younghacker, 2016-09-10
@MaksimovEvgeny

Check the file (this is fedora on ubuntu may be elsewhere) /lib/systemd/system/[email protected]
[Unit]
Description=OpenVPN Robust And Highly Flexible Tunneling Application On %I
[Service]
PrivateTmp=true
Type=forking
PIDFile=/var/run/openvpn/%i.pid
ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ - -config %i.conf
[Install]
WantedBy=multi-user.target

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question