After some debugging, I could make it work... I'm not a programmer, so
it might be wrong, but it's working:

root@netplan:~# cat fix-bug-1770082.diff 
--- a/netplan/cli/commands/apply.py
+++ b/netplan/cli/commands/apply.py
@@ -170,15 +170,15 @@
             link = netifaces.ifaddresses(interface)[netifaces.AF_LINK][0]
             macaddress = link.get('addr')
             if driver_name in matches['by-driver']:
-                new_name = matches['by-driver'][driver_name]
-                logging.debug(new_name)
+                current_name = matches['by-driver'][driver_name]
+                logging.debug(current_name)
                 logging.debug(interface)
-                if new_name != interface:
-                    changes.update({interface: {'name': new_name}})
+                if current_name != interface:
+                    changes.update({interface: {'name': newname}})
             if macaddress in matches['by-mac']:
-                new_name = matches['by-mac'][macaddress]
-                if new_name != interface:
-                    changes.update({interface: {'name': new_name}})
+                current_name = matches['by-mac'][macaddress]
+                if current_name != interface:
+                    changes.update({interface: {'name': newname}})
 
         logging.debug(changes)
         return changes


After applying the patch, it's working both on reboot and on netplan apply, 
with the interface down, of course.

-- 
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
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to