Package: openvpn
Version: 2.4.0-6+deb9u2

when booting the system, systemctl shows openvpn as failed. in the
openvpn logs I find:

TCP/UDP: Socket bind failed on local address
[AF_INET]192.168.90.1:1194: Cannot assign requested address

but in /etc/network/interfaces I have:

auto jacktrunk.13
iface jacktrunk.13 inet static
  address 192.168.90.1
  netmask 255.255.255.0

when restarting openvpn via sysctl restart, everything works fine. So
the network interface is not yet up when openvpn tries to bind to it.
As a workaround I patched:

/lib/systemd/system# diff -u openvpn\@.service~ openvpn\@.service
--- openvpn@.service~   2017-07-18 22:15:17.000000000 +0200
+++ openvpn@.service    2018-04-11 17:39:37.759664731 +0200
@@ -20,6 +20,9 @@
 LimitNPROC=10
 DeviceAllow=/dev/null rw
 DeviceAllow=/dev/net/tun rw
+Restart=on-failure
+RestartSec=10
 
 [Install]
 WantedBy=multi-user.target

Now when rebooting everything works. Checking the logs I find, that the
first try fails as above, and then 10 seconds later the startup is
retried and everything works fine.

I know this is a hack. But maybe it is not possible to arrange systemd
to to the correct ordering in all use cases and a retry every 10 seconds
could be a more robust solution. Dunno.


Best Regards
Erik

Reply via email to