netplan apply fails to rename network interfaces without reboot

Bug #1904662 reported by Baptiste Petit
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Netplan
Fix Released
Undecided
Unassigned

Bug Description

Dear maintainers, hello.

After talking on netplan's IRC regarding a problem I had with netplan, I think it is possible that, with the member that supported me there, we found a bug.

First let me explain the context:
I am trying to create a script that sets up a bunch of identical machines, as part of this script I need to configure the network of the machines (I identify their mac address then try to attribute them names and network properties by generating a config and trying to apply it).
A big constraint for me is to get this setup script working without needing to reboot the machine.

*Report:*

Ubuntu Version: XUbuntu 20.04
Netplan Version: 0.100-0ubuntu4~20.04.3

I am creating a netplan configuration using match: macaddress: and set-name: to attribute new names to my network interfaces as shown here: https://pastebin.ubuntu.com/p/KHfhCNcPCB/
But when I run `sudo netplan apply` interfaces are not renamed.

Manually pulling them down with `sudo ip link set xxx down` before applying netplan configuration does not solve the situation.

Running `sudo netplan --debug apply` seems to have yielded something weird according to the person that helped me yesterday, and I quote:
> "DEBUG:Skipping non-physical interface: enp6s0" part of your log looks interesting... as enp6s0 actually IS a physical interface and should not be skipped."

Here is the sudo netplan --debug apply result: https://pastebin.ubuntu.com/p/mdK9MPR6P3/

Full disclosure: After reboot the interfaces have the correct name, however as stated at the beginning of this post, for my use-case I need to make it work without a reboot.

For reference, the IRC log where we found this behaviour is here (between 8:36 and 13:56): https://irclogs.ubuntu.com/2020/11/17/%23netplan.html

Tags: fr-937

Related branches

Lukas Märdian (slyon)
tags: added: fr-937
Changed in netplan:
status: New → Confirmed
Revision history for this message
Lukas Märdian (slyon) wrote :

Investigating this issue, it looks like there are several issues with the rename code:

1) "DEBUG:Skipping non-physical interface: enp6s0" -> The rename code seems to ignore interfaces which are matched by name/mac/driver rules (glob). It seems to just consider direct matches between netplan ID & interface name.

2) The logic for renaming interfaces via "udevadm test-builtin net_setup_link /sys/class/net/IFACE" && "udevadm settle" seems to do nothing, i.e. not actually renaming the interface.

Revision history for this message
Lukas Märdian (slyon) wrote :
Lukas Märdian (slyon)
Changed in netplan:
status: Confirmed → Fix Committed
Lukas Märdian (slyon)
Changed in netplan:
status: Fix Committed → Fix Released
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.