You are not logged in.

#1 2023-06-30 07:53:39

lz3060
Member
Registered: 2006-09-15
Posts: 35

[SOLVED] systemd-networkd-wait-online doesn't wait for enp2s0?

Hi,

This one is probably trivial, but here goes: I'm using systemd-networkd on a headless UDOO x86 board, with a single `/etc/systemd/network/20-wired.network`:

[Match]
Name=enp2s0

[Network]
DHCP=yes
Address=192.168.42.19/24
Gateway=192.168.42.1
DNS=192.168.42.1

I try to mount an nfs share with a line in `/etc/fstab`, and I want the mount to happen as soon as the network is available, not "automount" where it gets mounted when accessed, so I try:

192.168.42.13:/frigate	/mnt/frigate	nfs		defaults,auto,noatime,vers=4,retrans=5,_netdev	0 0

With this setup, the mount is attempted before the wired network is actually up, visible in the system journal -- `systemd-networkd-wait-online.service` completes before the adapter gets a carrier!

Using `x-systemd.automount` works, but I wish I knew why systemd-networkd claims `network-online.target` has been reached, while in reality it has not? Do I need a `.link` file explicitly?

Last edited by lz3060 (2023-07-03 21:09:40)

Offline

#2 2023-06-30 13:51:41

seth
Member
Registered: 2012-09-03
Posts: 51,329

Re: [SOLVED] systemd-networkd-wait-online doesn't wait for enp2s0?

https://man.archlinux.org/man/core/syst … nline.8.en

Here, online means that the link's operational state is equal or higher than "degraded". The threshold can be configured by --operational-state= option.

https://man.archlinux.org/man/networkctl.1.en

degraded
the link has carrier and addresses valid on the local link configured

routable
the link has carrier and routable address configured

Edit:
https://bbs.archlinux.org/viewtopic.php?id=284361

Last edited by seth (2023-06-30 13:54:49)

Offline

#3 2023-06-30 15:28:41

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 596

Re: [SOLVED] systemd-networkd-wait-online doesn't wait for enp2s0?

It would be great if someone documented this in https://wiki.archlinux.org/title/system … ait-online.

Offline

#4 2023-07-03 21:09:16

lz3060
Member
Registered: 2006-09-15
Posts: 35

Re: [SOLVED] systemd-networkd-wait-online doesn't wait for enp2s0?

Ugh. I went through the wiki and most of the man pages, but I still fail to figure out why a link without a carrier would be considered anything but "offline". My journal clearly shows that the link gets carrier *after* network-online.target is reached. I would put some text in the wiki, if only I could grasp it.

Considered an overlay on the `systemd-networkd-wait-online.service` which sets a higher min `--operational-state=`, but then again ... x-systemd-automount appears to work for me, and plays nicely with docker compose, contrary to what @GuantoApril says in the linked thread.

Thanks, @seth! Marking as solved, but with a bitter aftertaste.

Offline

#5 2023-07-03 21:56:09

seth
Member
Registered: 2012-09-03
Posts: 51,329

Re: [SOLVED] systemd-networkd-wait-online doesn't wait for enp2s0?

My journal clearly shows that the link gets carrier *after* network-online.target is reached.

* Messages might be async/out of order
* Multiple NICs? (only one need to be "online" for this to fire)

I still fail to figure out why a link without a carrier would be considered anything but "offline"

It's not supposed to, but it will before you get a lease (which is not the same and the usual dhcp timeout is like 45s or so)
The NM wait-online thing used to (does?) the same by poassing -s to nm-online, https://man.archlinux.org/man/nm-online.1.en#OPTIONS
There's a lot of concern about timeouts and delaying the boot process and I guess those defaults are a testament to the network-online.target being used too broadly (eg. a non-global wifi connection would not become "online" before the graphical target - what's a problem if the displaymanager service depends on that…) but therefore also render it meaningless.

Either way, we should probably have this confirmed before advertising it in the wiki.

Offline

Board footer

Powered by FluxBB