[systemd-devel] systemd-networkd-wait-online: Wait for specific address family to be online
herr.ernst at gmail.com
Sun Jul 24 10:38:02 UTC 2016
I have a service that depends on a non-loopback IPv4 address to be
available at start-up. My network configuration is done with networkd,
it's very simple and basically just:
I've added the following to my service:
Unfortunately, there is no IPv4 address when the service tries to
start (and then crashes).
For debugging purposes, I added this to [Service]:
ExecStartPre=/bin/sh -c "/bin/cat /run/systemd/netif/links/*"
ExecStartPre=/bin/sh -c "/bin/cat /run/systemd/netif/leases/*"
On reboot, I see this in the journal:
Jul 24 11:41:59 myhost sh: # This is private data. Do not parse.
Jul 24 11:41:59 myhost sh: ADMIN_STATE=configured
Jul 24 11:41:59 myhost sh: OPER_STATE=degraded
Jul 24 11:41:59 myhost sh: FLAGS=69699
Jul 24 11:42:00 myhost sh: /bin/cat: /run/systemd/netif/leases/*:
No such file or directory
Jul 24 11:42:00 myhost systemd: test.service: control process
exited, code=exited status=1
Jul 24 11:42:00 myhost systemd: Failed to start Test.
Jul 24 11:42:00 myhost systemd: Unit test.service entered failed state.
I suspect the problem might be that the network interface also gets a
link-local IPv6 address, and thus systemd-networkd-wait-online
immediately returns. If I disable IPv6 on my system (by blacklisting
the ipv6 module), it works as expected (s-n-w-o waiting for DHCPv4
Is there a way to get s-n-w-o to wait for an address family (in my
case IPv4) to be available? Or is there any other workaround?
FWIW, I'm using Debian 8 Jessie (systemd version 215).
More information about the systemd-devel