[systemd-devel] Updating network file during boot
Silvio Knizek
killermoehre at gmx.net
Thu Aug 15 13:46:35 UTC 2024
Am Donnerstag, dem 15.08.2024 um 14:07 +0100 schrieb Henti Smith:
> Hello again.
>
> I've tried multiple ways of matching and none seem to be working.
>
> I removed all the configuration in /etc/systemd/network, run update-initramfs and rebooted.
>
> The resulting network configuration for the marvell devices was:
> root at av20-mvc-01:~# udevadm info /sys/class/net/eno2
> P: /devices/pci0000:00/0000:00:10.0/0000:05:00.0/net/eno2
> L: 0
> E: DEVPATH=/devices/pci0000:00/0000:00:10.0/0000:05:00.0/net/eno2
> E: INTERFACE=eno2
> E: IFINDEX=4
> E: SUBSYSTEM=net
> E: USEC_INITIALIZED=9048059
> E: ID_NET_NAMING_SCHEME=v245
> E: ID_NET_NAME_MAC=enx02000000000b
> E: ID_NET_NAME_ONBOARD=eno2
> E: ID_NET_LABEL_ONBOARD=Onboard ETHERNET Controller
> E: ID_NET_NAME_PATH=enp5s0
> E: ID_BUS=pci
> E: ID_VENDOR_ID=0x11ab
> E: ID_MODEL_ID=0x0f13
> E: ID_PCI_CLASS_FROM_DATABASE=Network controller
> E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
> E: ID_VENDOR_FROM_DATABASE=Marvell Technology Group Ltd.
> E: ID_PATH=pci-0000:05:00.0
> E: ID_PATH_TAG=pci-0000_05_00_0
> E: ID_NET_DRIVER=oak
> E: ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
> E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/eno2
> E: TAGS=:systemd:
>
> and:
> root at av20-mvc-01:~# udevadm info /sys/class/net/enp6s0
> P: /devices/pci0000:00/0000:00:11.0/0000:06:00.0/net/enp6s0
> L: 0
> E: DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:06:00.0/net/enp6s0
> E: INTERFACE=enp6s0
> E: IFINDEX=5
> E: SUBSYSTEM=net
> E: USEC_INITIALIZED=9004147
> E: ID_NET_NAMING_SCHEME=v245
> E: ID_NET_NAME_MAC=enx02000000000c
> E: ID_NET_NAME_PATH=enp6s0
> E: ID_BUS=pci
> E: ID_VENDOR_ID=0x11ab
> E: ID_MODEL_ID=0x0f13
> E: ID_PCI_CLASS_FROM_DATABASE=Network controller
> E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
> E: ID_VENDOR_FROM_DATABASE=Marvell Technology Group Ltd.
> E: ID_PATH=pci-0000:06:00.0
> E: ID_PATH_TAG=pci-0000_06_00_0
> E: ID_NET_DRIVER=oak
> E: ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
> E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/enp6s0
> E: TAGS=:systemd:
>
> As you can see it's generated by /usr/lib/systemd/network/99-default.link which uses OriginalName=*.
>
> Reading the man page the only options that can take glob matching are Path (ID_PATH), Driver (ID_NET_DRIVER), Type (DEVTYPE) and OriginalName (INTERFACE).
>
> ID_PATH changes when the board is connected and not, it's not usable.
> ID_NET_DRIVER is the same for both.
> DEVTYPE is not presented on these devices
>
> This only leaves INTERFACE, however the man page again states:
> This cannot be used to match on names that have already been changed from userspace. Caution is advised when matching on kernel-assigned names, as they are known to be unstable between reboots.
>
> Which seems to mean I'm back to square one.
>
> I was really hoping that I could use DEVPATH to glob match on, but this seems to not be possible. the only way to match on DEVPATH is using Property. however there is no glob matching with that option.
>
> Having said that, I'm thinking that since you can have multiple options using Property thata ll need to match, I can possbly create four link files with the two sets of PCI and Drives matching to ensure that with or without the board two interface will match.
>
> I will attempt this and feed back.
>
> Kind regards
> Henti
Hi Henti,
why can't you [Match] onto `Property="ID_NET_LABEL_ONBOARD=Onboard ETHERNET Controller"`? Is your systemd older than 243? Than you should really update.
BR
Silvio
More information about the systemd-devel
mailing list