Hi Ryan,

[Journal Output]
Attached.

[Reproducer]
uvt-kvm create xenial-test release=xenial arch=amd64
virsh edit xenial-test # change network interface pci slot: s/0x03/0x10/
virsh destroy xenial-test
virsh start xenial-test
uvt-kvm ssh xenial-test
dmesg|grep rename
[    2.790623] virtio_net virtio3 ens16: renamed from eth0
[    6.048520] virtio_net virtio3 ens3: renamed from ens16

[Analysis]
I've been working on this a lot, and I think I have the cause of the difference.

In udev-events.c, udev_execute_rules will _forcibly_ rename a device
with via a netlink message if there is a matching rule that sets a name.
Under Xenial, there *is* a matching rule, in 70-persistent-net.rules, so
this forces a rename. This rename will occur even if the device already
has a name, and therefore even if the rules file isn't in the initramfs.

Under Bionic, this rules file doesn't exist, there is a .link file
instead. Unfortunately, a name in a .link file will only take effect if
the device hasn't been renamed - because of the renaming in initrd, this
means that a link file that is not present in the initrd will never be
able to cause a rename.

[Solutions]
There are a couple of ways we could fix this that come to mind:

 - make netplan generate a file in /run/udev/rules.d for each device
 - make systemd rename devices from a link file even if they've been renamed

My preference is the first, but I'm open to anything we can get
upstream.

Thanks again.

Regards,
Daniel

** Attachment added: "journalctl -b output on Xenial VM with multiple renames"
   
https://bugs.launchpad.net/netplan/+bug/1770082/+attachment/5139894/+files/journalctl-b.txt

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1770082

Title:
  systemd-networkd not renaming devices on boot

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1770082/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to