(Re)Naming interfaces fails if interface with this name are already existing

Bug #1976231 reported by Jan-Frederik Schmidt
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Netplan
Triaged
Wishlist
Unassigned

Bug Description

When I use the option "set-name" and "match" and want to set the name of an interface, this operation fails if another interface with this name already exists.
This is understandable so far. I would like to suggest at this point that before renaming (i.e. calling "ip link set $CURRENT_NAME $NEW_NAME") it should be checked if the renaming would be possible and e.g. if the names of two interfaces are exchanged the one is temporarily renamed.

Revision history for this message
Lukas Märdian (slyon) wrote :

Thank you for this suggestion. I don't think it's that easy, though. Especially when netplan is run as a systemd-generator during early boot (i.e. the default use case).

The generator is not using "ip link set ..." to change the name, but rather defines udev rules to make the rename happen. We'd need to have some multi-staged udev rules like this:

If interface is supposed to be renamend:
1) re-name to something temporary "netplan-RANDOM_STRING" and remember the association with the netplan ID, this is to avoid conflicts if the new name would already exist.
2) re-name again (after all re-names moved to a temporary name), to the actual "set-name" value.

I'm marking this as a whishlist item.

Changed in netplan:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Jan-Frederik Schmidt (janfschmidt) wrote :

Thanks for your quick reply!

Interesting, but that means that the behavior of netplan to during system startup and at a "netplan apply" is different, correct? Because when I run "netplan apply" I get an error message with a python stacktrace saying that "ip link set $CURRENT_NAME $NEW_NAME" has failed.

Anyway, I'm glad that my suggestion at least made it to the wishlist :) Best regards!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.