Re: [systemd-devel] systemd-networkd-wait-online should know if there is anything to wait for
Dimitri John Ledkov wrote on 26/03/18 11:34: > Hello, > > When systemd-networkd-wait-online was originally introduced, it was > the only tool that correctly waited and blocked the boot, until after > networking is configured. > > These days, however, all/most network configurations tools ship > appropriate wait-online integration. E.g. there is network-manager > wait online service and ifupdown wait online, on Debian/Ubuntu. > > These other helpers, seem to be slightly smarter than > systemd-networkd-wait-online. Specifically, all other helpers exit > straight away, if they have no devices configured / managed. Whilst > systemd-networkd-wait-online, doesn't appear to know if it expects any > devices / can manage any devices. Ideally, if no devices are > configured / no devices match .network files, maybe it should exit > straight away? Or for example, do so if no devices are found in > "configuring/pending/not yet processed by udev". > > (code wise, it is to change one_ready to true by default, and only > continue blocking the, if there is anything pending configuration). > > I'm considering doing this by default, or for-example, doing it if > there are no /run/systemd/network/*.network > /etc/systemd/network/*.network files. > > The use cases when it matters: > > - installer ISO booted without any NICs attached > (or NICs require special drivers / firmware loaded etc) > > - cloud-image booted and cloud-init failed to find network-config and > generate networkd stanzas But how do you differentiate a device which is not present vs. one which is slow to appear? If the system isn't online then surely any dependant units don't need to be started anyway. If the system requires being online to operate properly then all this behaviour is correct. If you don't use systemd-networkd then you possibly don't want systemd-networkd-wait-online either and thus it can be happily disabled. So I don't really appreciate why this is an issue. Unless, you're trying to use a kind of hybrid environment (e.g. using networkd for wired networks (perhaps USB dongles) and NetworkManager for wifi and you'd want networkd-wait-online to be a no-op when the USB dongle is not there?) I guess it's possible to know if networkd is configured to not manage any devices *at all*, but perhaps there isn't much point in enabling the networkd-wait-online service at all in that case anyway? Struggling to understand the "why" question here, but could easily be missing something! :-) Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] systemd-networkd-wait-online should know if there is anything to wait for
Hello, When systemd-networkd-wait-online was originally introduced, it was the only tool that correctly waited and blocked the boot, until after networking is configured. These days, however, all/most network configurations tools ship appropriate wait-online integration. E.g. there is network-manager wait online service and ifupdown wait online, on Debian/Ubuntu. These other helpers, seem to be slightly smarter than systemd-networkd-wait-online. Specifically, all other helpers exit straight away, if they have no devices configured / managed. Whilst systemd-networkd-wait-online, doesn't appear to know if it expects any devices / can manage any devices. Ideally, if no devices are configured / no devices match .network files, maybe it should exit straight away? Or for example, do so if no devices are found in "configuring/pending/not yet processed by udev". (code wise, it is to change one_ready to true by default, and only continue blocking the, if there is anything pending configuration). I'm considering doing this by default, or for-example, doing it if there are no /run/systemd/network/*.network /etc/systemd/network/*.network files. The use cases when it matters: - installer ISO booted without any NICs attached (or NICs require special drivers / firmware loaded etc) - cloud-image booted and cloud-init failed to find network-config and generate networkd stanzas -- Regards, Dimitri. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd-networkd-wait-online
On Fr, 08.12.17 20:54, Johannes Ernst (johannes.er...@gmail.com) wrote: > Thanks. I’m not surprised that work remains ... > > Related question: systemd-networkd-wait-online.target seems to > assume that once the network is online, it stays that way. I’d like > to also take action when it goes down, and again when it comes back > up. Any pointers how to best go about this? Is there an inverse of > the systemd-networkd-wait-online executable? No, targets are not supposed to fully track system state. If you want to track network up/down cycles use the rtnetlink API. Sorry. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd-networkd-wait-online
Thanks. I’m not surprised that work remains ... Related question: systemd-networkd-wait-online.target seems to assume that once the network is online, it stays that way. I’d like to also take action when it goes down, and again when it comes back up. Any pointers how to best go about this? Is there an inverse of the systemd-networkd-wait-online executable? Thanks, Johannes. > On Dec 6, 2017, at 3:30, Lennart Poetteringwrote: > > On Di, 05.12.17 12:21, Johannes Ernst (johannes.er...@gmail.com) wrote: > > See the discussion on > https://github.com/systemd/systemd/issues/7478#issuecomment-348508263 > regarding this kind of hardware. > > Lennart > > -- > Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd-networkd-wait-online
On Di, 05.12.17 12:21, Johannes Ernst (johannes.er...@gmail.com) wrote: See the discussion on https://github.com/systemd/systemd/issues/7478#issuecomment-348508263 regarding this kind of hardware. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] systemd-networkd-wait-online
I’m running systemd 235.38 on an ARM64 device called the EspressoBin [1]. The EspressoBin board has an on-board Ethernet switch, which I configure with systemd-networkd (configuration is below). The device is intended as a home router that runs IPv4 masquerading, local DNS server etc. I’m attempting to take action when the wan interface has a network connection to the upstream ISP. I discovered /usr/lib/systemd/systemd-networkd-wait-online, which behaves as follows: % systemd-networkd-wait-online -i wan Exactly what I would expect — once I connect upstream Ethernet, it prints "ignoring: lan0, lan1, eth0, lo” and returns true % systemd-networkd-wait-online —ignore lan0 —ignore lan1 Same as first % systemd-networkd-wait-online “Hangs” % systemd-networkd-wait-online -i lan0 “Hangs” The way I read the man page [2] systemd-networkd-wait-online is supposed to return with true, even if only the wan interface is connected and the other two ports are configured (but not connected). Is my understanding correct? Or do all three ports need to be connected? Thanks, Johannes. Configuration: :: 49-ubos-eth0.network :: [Match] Name=eth0 [Network] :: 50-ubos-lan0.network :: [Match] Name=lan0 [Network] Address=192.168.140.1 DNS=192.168.140.1 IPForward=yes BindCarrier=eth0 :: 50-ubos-lan1.network :: [Match] Name=lan1 [Network] Address=192.168.141.1 DNS=192.168.141.1 IPForward=yes BindCarrier=eth0 :: 50-ubos-wan.network :: [Match] Name=wan [Network] DHCP=yes IPForward=yes BindCarrier=eth0 [1] https://espressobin.net/ [2] https://www.freedesktop.org/software/systemd/man/systemd-networkd-wait-online.service.html ___ 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
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 Bammerwrote: > 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 Bammerwrote: > 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
Re: [systemd-devel] systemd-networkd-wait-online and network.target
2014-06-25 14:12 GMT+04:00 Michael Olbrich m.olbr...@pengutronix.de: Hi, Commit 58e027023b47b32e42cf93dd4a629b869ee1ef25 'units: order network-online.target after network.target' added Before=network.target dependency to systemd-networkd-wait-online.service. Is that correct? If I understand the documentation correctly, then network.target should not be delayed. Maybe this was supposed to be Afternetwork.target? Regards, Michael Can you some ask to NetworkManager upstream about NetworkManager-wait-online.service ? -- Alexey Shabalin ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd-networkd-wait-online and network.target
On Sun, 29.06.14 23:58, Tom Gundersen (t...@jklm.no) wrote: On Wed, Jun 25, 2014 at 12:12 PM, Michael Olbrich m.olbr...@pengutronix.de wrote: Commit 58e027023b47b32e42cf93dd4a629b869ee1ef25 'units: order network-online.target after network.target' added Before=network.target dependency to systemd-networkd-wait-online.service. Is that correct? If I understand the documentation correctly, then network.target should not be delayed. Maybe this was supposed to be Afternetwork.target? Looks like a bug to me. Reverted that hunk. You forgot to push? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd-networkd-wait-online and network.target
On Mon, Jun 30, 2014 at 1:04 PM, Lennart Poettering lenn...@poettering.net wrote: On Sun, 29.06.14 23:58, Tom Gundersen (t...@jklm.no) wrote: On Wed, Jun 25, 2014 at 12:12 PM, Michael Olbrich m.olbr...@pengutronix.de wrote: Commit 58e027023b47b32e42cf93dd4a629b869ee1ef25 'units: order network-online.target after network.target' added Before=network.target dependency to systemd-networkd-wait-online.service. Is that correct? If I understand the documentation correctly, then network.target should not be delayed. Maybe this was supposed to be Afternetwork.target? Looks like a bug to me. Reverted that hunk. You forgot to push? Indeed. Done. -t ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd-networkd-wait-online and network.target
On Wed, Jun 25, 2014 at 12:12 PM, Michael Olbrich m.olbr...@pengutronix.de wrote: Commit 58e027023b47b32e42cf93dd4a629b869ee1ef25 'units: order network-online.target after network.target' added Before=network.target dependency to systemd-networkd-wait-online.service. Is that correct? If I understand the documentation correctly, then network.target should not be delayed. Maybe this was supposed to be Afternetwork.target? Looks like a bug to me. Reverted that hunk. Cheers, Tom ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] systemd-networkd-wait-online and network.target
Hi, Commit 58e027023b47b32e42cf93dd4a629b869ee1ef25 'units: order network-online.target after network.target' added Before=network.target dependency to systemd-networkd-wait-online.service. Is that correct? If I understand the documentation correctly, then network.target should not be delayed. Maybe this was supposed to be Afternetwork.target? Regards, Michael -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel