<div dir="ltr">goes back to 'can we have a configurable script to run when DHCP assigns the address?'<div>Surely it can't be that hard to read a config line, save it, and later execute a script</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 6, 2016 at 1:54 PM, Ernst Bammer <span dir="ltr"><<a href="mailto:herr.ernst@gmail.com" target="_blank">herr.ernst@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
sorry to bring this up again, but maybe somebody is back from vacation<br>
who can answer this? ;-)<br>
Best regards, Ernst<br>
<br>
On Sun, Jul 24, 2016 at 12:31 PM, Ernst Bammer <<a href="mailto:herr.ernst@gmail.com">herr.ernst@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I have a service that depends on a non-loopback IPv4 address to be<br>
> available at start-up. My network configuration is done with networkd,<br>
> it's very simple and basically just:<br>
><br>
> [Match]<br>
> Name=eth*<br>
> [Network]<br>
> DHCP=v4<br>
><br>
> I've added the following to my service:<br>
><br>
> [Unit]<br>
> Requires=network-online.target<br>
> After=network-online.target<br>
><br>
> Unfortunately, there is no IPv4 address when the service tries to<br>
> start (and then crashes).<br>
> For debugging purposes, I added this to [Service]:<br>
><br>
> ExecStartPre=/bin/sh -c "/bin/cat /run/systemd/netif/links/*"<br>
> ExecStartPre=/bin/sh -c "/bin/cat /run/systemd/netif/leases/*"<br>
><br>
> On reboot, I see this in the journal:<br>
><br>
> Jul 24 11:41:59 myhost sh[492]: # This is private data. Do not parse.<br>
> Jul 24 11:41:59 myhost sh[492]: ADMIN_STATE=configured<br>
> Jul 24 11:41:59 myhost sh[492]: OPER_STATE=degraded<br>
> Jul 24 11:41:59 myhost sh[492]: FLAGS=69699<br>
> Jul 24 11:42:00 myhost sh[529]: /bin/cat: /run/systemd/netif/leases/*:<br>
> No such file or directory<br>
> Jul 24 11:42:00 myhost systemd[1]: test.service: control process<br>
> exited, code=exited status=1<br>
> Jul 24 11:42:00 myhost systemd[1]: Failed to start Test.<br>
> Jul 24 11:42:00 myhost systemd[1]: Unit test.service entered failed state.<br>
><br>
> I suspect the problem might be that the network interface also gets a<br>
> link-local IPv6 address, and thus systemd-networkd-wait-online<br>
> immediately returns. If I disable IPv6 on my system (by blacklisting<br>
> the ipv6 module), it works as expected (s-n-w-o waiting for DHCPV4<br>
> address).<br>
><br>
> Is there a way to get s-n-w-o to wait for an address family (in my<br>
> case IPv4) to be available? Or is there any other workaround?<br>
><br>
> FWIW, I'm using Debian 8 Jessie (systemd version 215).<br>
><br>
> Thank you!<br>
> Ernst<br>
______________________________<wbr>_________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/systemd-devel</a><br>
</blockquote></div><br></div>