[systemd-devel] Wrong interface name

Mantas Mikulėnas grawity at gmail.com
Thu Aug 6 13:24:21 UTC 2020


On Tue, Aug 4, 2020 at 4:22 PM Bao Nguyen <baondt at gmail.com> wrote:

> Hello,
>
>
>
> Recently I found that my kvm guest has inconsistent network names every
> reboot. Here is the log
>
>
>
> myPC kernel: virtio_net virtio0 eth000102030405: renamed from eth0
>
> myPC kernel: virtio_net virtio1 eth000102030406: renamed from eth1
>
> myPC kernel: virtio_net virtio2 eth000102030407: renamed from eth2
>

Those look different from udev's typical "persistent" naming scheme, which
never uses the eth* prefix. It might be a custom udev rule, or another (non
udev) service doing the renaming – the same message is shown in all cases.


> myPC kernel: virtio_net virtio0 eth1: renamed from eth000102030405
>
> myPC kernel: virtio_net virtio1 eth3: renamed from eth000102030406
>
> myPC kernel: virtio_net virtio2 eth4: renamed from eth000102030407
>

This *might* be an old "70-persistent-net" udev rules file (the kind that
Debian used to auto-generate in the past).


>
>
> Looks like systemd-udevd has renamed the interface name but incorrectly.
> Could you please let me know if the above log is printed out because
> system-udevd runs or from kernel?
>

The message is shown by the kernel, but the actual renaming could have been
done by anything – udev, `ip link`, or literally any other userspace tool.


> And why the name is changed incorrectly, is it due to some udev rules?
>

Could be either custom udev rules, or custom /etc/systemd/network/*.link
files, or some network management daemon with its own renaming logic.  My
guess is that lines 1-3 are a custom rule and 4-6 are 70-persistent-net.

You might find at least some information by running `udevadm test
/sys/class/net/eth0` (replace eth0 with any interface that currently
exists).

Systemd's standard interface renaming rules (at 80-net-setup-link.rules)
were written to never override any custom name that earlier rules might
have set.


> Is there any way I can change to make the interface name persistent on
> each reboot.
>

The kernel does not remember anything across reboots. The only way to make
a custom name persistent is to rename it from userspace every single time
(e.g. udev rules).

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200806/ae71c6a7/attachment.htm>


More information about the systemd-devel mailing list