Skip to content

wait-online: don't ignore configured interfaces with RequiredForOnline=no#32016

Closed
enr0n wants to merge 1 commit intosystemd:mainfrom
enr0n:wait-online-dont-ignore-non-required-interfaces
Closed

wait-online: don't ignore configured interfaces with RequiredForOnline=no#32016
enr0n wants to merge 1 commit intosystemd:mainfrom
enr0n:wait-online-dont-ignore-non-required-interfaces

Conversation

@enr0n
Copy link
Contributor

@enr0n enr0n commented Mar 29, 2024

The current behavior of systemd-networkd-wait-online with regards to interfaces with RequiredForOnline=no is counter intuitive. For example, suppose a system has only lo, eth0, and wlan0 interfaces, and that each eth0 and wlan0 are configured with RequiredForOnline=no. Then,

$ systemd-networkd-wait-online --any

will timeout even if either eth0 or wlan0 are configured, because systemd-networkd-wait-online does not even check the state of interfaces with RequiredForOnline=no.

Even if an interface is not required for online, it should be able to satisfy online. So, when iterating interfaces by index, do not ignore those that have RequiredForOnline=no.

…e=no

The current behavior of systemd-networkd-wait-online with regards to
interfaces with RequiredForOnline=no is counter intuitive. For example,
suppose a system has only lo, eth0, and wlan0 interfaces, and that each
eth0 and wlan0 are configured with RequiredForOnline=no. Then,

 $ systemd-networkd-wait-online --any

will timeout even if either eth0 or wlan0 are configured, because
systemd-networkd-wait-online does not even check the state of interfaces
with RequiredForOnline=no.

Even if an interface is not _required_ for online, it should be able to
satisfy online. So, when iterating interfaces by index, do not ignore
those that have RequiredForOnline=no.
@github-actions github-actions bot added network please-review PR is ready for (re-)review by a maintainer labels Mar 29, 2024
Copy link
Member

@yuwata yuwata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently RequiredForOnline= controls if the interface is handled by systemd-networkd-wait-online. So, this breaks existing setup.
E.g. eth0 has RequiredForOnline=no and it is online, and eth1 has RequiredForOnline=yes but it is not online, then without this PR s-n-wait-online --any ignores eth0 and waits for eth1 being online, but with this PR the command immediately exits with success and does not wait for eth1.

I do not think we can change the current behavior without breaking possibly existing setups.

@yuwata yuwata added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed please-review PR is ready for (re-)review by a maintainer labels Apr 3, 2024
@yuwata
Copy link
Member

yuwata commented Apr 3, 2024

As I recently replied to another PR and issue, if all interfaces have RequiredForOnline=no, then why not to disable systemd-netowrkd-wait-online.service? If you really want to set RequiredForOnline=no, then you can still use wait-online with --interface/-i option.

@enr0n
Copy link
Contributor Author

enr0n commented Apr 3, 2024

Okay, that's fair enough I think. I still think the behavior of RequiredForOnline= is counter intuitive for the reasons I described above.

The motivation here is that netplan has an optional: field that it maps to RequiredForOnline= and when netplan configs have optional: true it leads to unexpected (misunderstood) behavior with wait-online.

Anyways, I understand we don't want to break existing setups so I will suggest a change in netplan to use the templated units or something.

@enr0n enr0n closed this Apr 3, 2024
@github-actions github-actions bot removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants