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[492]: # This is private data. Do not parse.
Jul 24 11:41:59 myhost sh[492]: ADMIN_STATE=configured
Jul 24 11:41:59 myhost sh[492]: OPER_STATE=degraded
Jul 24 11:41:59 myhost sh[492]: FLAGS=69699
Jul 24 11:42:00 myhost sh[529]: /bin/cat: /run/systemd/netif/leases/*:
No such file or directory
Jul 24 11:42:00 myhost systemd[1]: test.service: control process
exited, code=exited status=1
Jul 24 11:42:00 myhost systemd[1]: Failed to start Test.
Jul 24 11:42:00 myhost systemd[1]: 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).

Thank you!
systemd-devel mailing list

Reply via email to