Re: [systemd-devel] systemd-networkd-wait-online: Wait for specific address family to be online
goes back to 'can we have a configurable script to run when DHCP assigns the address?' Surely it can't be that hard to read a config line, save it, and later execute a script On Tue, Sep 6, 2016 at 1:54 PM, Ernst Bammer wrote: > Hi, > sorry to bring this up again, but maybe somebody is back from vacation > who can answer this? ;-) > Best regards, Ernst > > On Sun, Jul 24, 2016 at 12:31 PM, Ernst Bammer > wrote: > > Hi, > > > > 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: > > > > [Match] > > Name=eth* > > [Network] > > DHCP=v4 > > > > I've added the following to my service: > > > > [Unit] > > Requires=network-online.target > > After=network-online.target > > > > 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 > > address). > > > > 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! > > Ernst > ___ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/systemd-devel > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd-networkd-wait-online: Wait for specific address family to be online
Hi, sorry to bring this up again, but maybe somebody is back from vacation who can answer this? ;-) Best regards, Ernst On Sun, Jul 24, 2016 at 12:31 PM, Ernst Bammer wrote: > Hi, > > 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: > > [Match] > Name=eth* > [Network] > DHCP=v4 > > I've added the following to my service: > > [Unit] > Requires=network-online.target > After=network-online.target > > 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 > address). > > 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! > Ernst ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] systemd-networkd-wait-online: Wait for specific address family to be online
Hi, 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: [Match] Name=eth* [Network] DHCP=v4 I've added the following to my service: [Unit] Requires=network-online.target After=network-online.target 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 address). 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! Ernst ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel