[systemd-devel] Updating network file during boot

Henti Smith henti at gaydonsmith.co.uk
Thu Aug 22 13:56:52 UTC 2024


On Thu, 22 Aug 2024 at 12:45, Andrei Borzenkov <arvidjaar at gmail.com> wrote:

> On Wed, Aug 21, 2024 at 7:12 PM Lennart Poettering
> <lennart at poettering.net> wrote:
>
> > Honestly, I'd really avoid mixing rename via udev rules and rename via
> > .link files. I'd stick to .link files for this, really.
> >
>
> All .link files do is to suggest the "best" name which is ignored if
> NAME has already been set. They do not really rename anything
> themselves. Besides, OP cannot use .link files because there is no
> persistent device property that can be matched by them.
>

I've switched to using "Property=" as follows:
    # Fixed MAC and name for enp6s0 (Block Diagram) when debug board is not
plugged in
    # Renamed to mvc-sw2 by PCI Address.
    [Match]

Property=DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:05:00.0/net/enp5s0

    [Link]
    MACAddress=02:00:00:00:06:00
    Name=mvc-sw2

However this is also inconsistent:
    reboot   system boot  5.4.0-192-generi Tue Nov 21 23:16         :
success
    2023-11-21T23:16:44.233996+00:00 av20-mvc-01 systemd-networkd[1136]:
eth1: Interface name change detected, eth1 has been renamed to enp5s0.
    2023-11-21T23:16:44.234049+00:00 av20-mvc-01 systemd-networkd[1136]:
enp5s0: Interface name change detected, enp5s0 has been renamed to mvc-sw2.
    2023-11-21T23:16:44.235208+00:00 av20-mvc-01 kernel: [    7.430556] oak
0000:05:00.0 enp5s0: renamed from eth1
    2023-11-21T23:16:44.235216+00:00 av20-mvc-01 kernel: [    7.693221] oak
0000:05:00.0 mvc-sw2: renamed from enp5s0

    reboot   system boot  5.4.0-192-generi Tue Nov 21 23:18         : failed
    2023-11-21T23:16:44.233996+00:00 av20-mvc-01 systemd-networkd[1136]:
eth1: Interface name change detected, eth1 has been renamed to enp5s0.
    2023-11-21T23:16:44.234049+00:00 av20-mvc-01 systemd-networkd[1136]:
enp5s0: Interface name change detected, enp5s0 has been renamed to mvc-sw2.
    2023-11-21T23:16:44.235208+00:00 av20-mvc-01 kernel: [    7.430556] oak
0000:05:00.0 enp5s0: renamed from eth1
    2023-11-21T23:16:44.235216+00:00 av20-mvc-01 kernel: [    7.693221] oak
0000:05:00.0 mvc-sw2: renamed from enp5s0
    2023-11-21T23:18:45.186181+00:00 av20-mvc-01 systemd-networkd[986]:
enp5s0: Interface name change detected, enp5s0 has been renamed to eth1.
    2023-11-21T23:18:45.186186+00:00 av20-mvc-01 systemd-networkd[986]:
eth1: Interface name change detected, eth1 has been renamed to enp5s0.
    2023-11-21T23:18:45.187417+00:00 av20-mvc-01 kernel: [    6.926580] oak
0000:05:00.0 enp5s0: renamed from eth1

Henti


> It is possible that there are conflicting rules in initrd. It is also
> possible that udev races with the networkd.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240822/5fc21022/attachment.htm>


More information about the systemd-devel mailing list