Currently OpenMediaVault matches the network configuration for every ethernet adapter by mac address in its netplan network configuration files.
Lines 6-7
match:
macaddress: {{ mac_address }}
That also happens for ethernet adapters without a permanent or completely random mac address.
It relies on systemd-networkd default settings in "99-default.link" (https://github.com/systemd/sys…n/network/99-default.link).
MACAddressPolicy=persistent
This setting makes systemd-networkd create a stable mac address from the machine-id, interface name and additional interface parameters for adapters without a stable mac address during system startup in userspace.
The problem with OMVs reliance on this is that (at least with the systemd 247.3-7 in current debian bullseye) this creates a race condition during system startup.
If systemd-networkd is able to create the stable mac address for the adapter before it tries to match the network configuration file by that mac address everything is fine. But on fast systems this leads to a broken network configuration because the matching by mac address fails since the stable mac address has not been created yet.
I have multiple RK3588 ARM systems where this is 100% reproducible.
Random mac address for an adapter:
kernel: r8125 0003:31:00.0 (unnamed net_device) (uninitialized): Invalid ether addr 00:00:00:00:00:00
kernel: r8125 0003:31:00.0 (unnamed net_device) (uninitialized): Random ether addr 4e:54:94:b5:ad:c7
Systemd-networkd creates a stable mac address during system startup:
HW Address: de:d1:aa:55:c9:bf
HW Permanent Address: 4e:54:94:b5:ad:c7
(HW Permanent Address is random at every start, but newly created HW Address is stable)
OpenMediaVault creates a netplan configuration for this mac address and netplan auto creates a systemd-networkd .network file:
root@nanopi:~# cat /etc/netplan/20-openmediavault-enP3p49s0.yaml
network:
ethernets:
enP3p49s0:
match:
macaddress: de:d1:aa:55:c9:bf
accept-ra: true
dhcp4: yes
dhcp4-overrides:
use-dns: true
use-domains: true
dhcp6: yes
dhcp6-overrides:
use-dns: true
use-domains: true
root@nanopi:~# cat /run/systemd/network/10-netplan-enP3p49s0.network
[Match]
MACAddress=de:d1:aa:55:c9:bf
[Network]
DHCP=yes
LinkLocalAddressing=ipv6
IPv6AcceptRA=yes
[DHCP]
RouteMetric=100
UseMTU=true
UseDomains=true
Display More
Slow boot from microSD with ~60Mb/s speed:
root@nanopi:~# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 eth0 ether routable configured
3 enP3p49s0 ether no-carrier configuring
3 links listed.
root@nanopi:~# networkctl status enP3p49s0
● 3: enP3p49s0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /run/systemd/network/10-netplan-enP3p49s0.network
Type: ether
State: no-carrier (configuring)
Path: platform-fe180000.pcie-pci-0003:31:00.0
Driver: r8125
Vendor: Realtek Semiconductor Co., Ltd.
Model: RTL8125 2.5GbE Controller
HW Address: de:d1:aa:55:c9:bf
HW Permanent Address: 4e:54:94:b5:ad:c7
MTU: 1500 (min: 68, max: 9194)
QDisc: mq
IPv6 Address Generation Mode: eui64
Queue Length (Tx/Rx): 4/4
Auto negotiation: yes
Speed: n/a
Port: tp
DHCP6 Client DUID: DUID-EN/Vendor:0000ab1166a0671791d79f890000
Display More
Fast boot from eMMC with ~300Mb/s:
root@nanopi:~# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 eth0 ether routable configured
3 enP3p49s0 ether off unmanaged
3 links listed.
root@nanopi:~# networkctl status enP3p49s0
● 3: enP3p49s0
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: off (unmanaged)
Path: platform-fe180000.pcie-pci-0003:31:00.0
Driver: r8125
Vendor: Realtek Semiconductor Co., Ltd.
Model: RTL8125 2.5GbE Controller
HW Address: de:d1:aa:55:c9:bf
HW Permanent Address: 92:f6:18:f3:59:af
MTU: 1500 (min: 68, max: 9194)
QDisc: noop
IPv6 Address Generation Mode: eui64
Queue Length (Tx/Rx): 4/4
Auto negotiation: yes
Speed: n/a
Port: tp
Display More
Network configuration is broken and the machine is offline when connected via that adapter.
Currently im forced to delete lines 6-7 in "/srv/salt/omv/deploy/systemd-networkd/netplan/files/ethernet.j2" to remove matching by mac address and match by name only to have a working system.
I think OpenMediaVault should not match by mac address for ethernet adapters without a permanent mac address.
There is a kernel parameter "/sys/class/net/<iface>/addr_assign_type" (https://www.kernel.org/doc/Doc…I/testing/sysfs-class-net).
By reading this parameter its possible to detect these adapters. For normal ethernet adapters with a fixed hw mac address or ethernet adapters of virtual machines this parameter is always 0 (permanent address). If systemd-networkd detects that the mac address of an adapter is not stable and creates a stable mac address it sets this parameter to 3.
If OpenMediaVault would only match by mac address when this setting for the adapter is 0 and by interface name for >0 this bug would no longer happen.