systemd-networkd not renaming devices on boot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
Fix Released
|
Undecided
|
Unassigned | ||
cloud-init (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned | ||
netplan.io (Ubuntu) |
Fix Released
|
Undecided
|
Mathieu Trudel-Lapierre | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned | ||
Cosmic |
Fix Released
|
Undecided
|
Mathieu Trudel-Lapierre | ||
nplan (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned | ||
systemd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
[Impact]
Systems relying on renaming network interfaces at boot and when 'netplan apply' is run.
[Test case]
- Write a new netplan YAML (adjusting for current system as necessary):
network:
version: 2
ethernets:
ens3:
dhcp4: true
match:
- Bring down interface : 'ip link set dev ens3 down'
- Run 'netplan apply'
- Verify that the device is correctly renamed to 'myif0'.
- Reboot.
- Make sure the device is correctly renamed to 'myif0'.
[Regression potential]
Changes in rename logic to add udev rules may otherwise impact applying different settings to the network interfaces. Changes in settings on network interfaces, missing parameters (especially on bonds, bridges) should be investigated as potential regressions. Other failures to apply network settings might also happen if there's a race between applying renames via the udev rules, and using the new names to apply configuration changes to the interfaces.
=== systemd issue ===
Renaming devices doesn't seem to work.
If I disable all other network configuration and create /etc/systemd/
[Match]
MACAddress=
[Link]
Name=myiface3
I expect this to cause the device with that MAC address to be renamed to myiface3. However, when I reboot, I instead see:
$ ip l
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens3: <BROADCAST,
link/ether 52:54:00:c1:c9:bb brd ff:ff:ff:ff:ff:ff
The device is not renamed.
This link file is pretty much identical to Example 2 in https:/
The renaming does work if I boot with net.ifnames=0, and oddly, it also works if I unbind the device and rebind it as netplan apply does. No setting of NamePolicy seems to help.
=== Original Bug ==
'set-name:' doesn't change the name of a network interface on boot, it only works when you do netplan apply.
Say I take this 50-cloud-init.yaml file:
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/
# network: {config: disabled}
network:
version: 2
ethernets:
ens3:
dhcp4: true
match:
Say I change set-name to 'myiface3' and reboot. I expect that the device will be called myiface3 and brought up fine with dhcp. However, instead I see:
$ ip a
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,
link/ether 52:54:00:de:bd:f6 brd ff:ff:ff:ff:ff:ff
The name has not been changed, and the device has not been brought up.
If I run netplan apply however, I see the following:
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: myiface3: <BROADCAST,
link/ether 52:54:00:de:bd:f6 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.151/24 brd 192.168.122.255 scope global dynamic myiface3
valid_lft 3575sec preferred_lft 3575sec
inet6 fe80::5054:
valid_lft forever preferred_lft forever
So names are successfully changed with netplan apply.
This seems to be some udev-related timing or priority issue that I'm still trying to hunt down.
This breaks some forms of migration in certain cloud environments.
Changed in netplan: | |
status: | New → Confirmed |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
tags: | added: bionic |
description: | updated |
summary: |
- set-name doesn't work on boot, only with netplan apply + systemd-networkd not renaming devices on boot |
description: | updated |
Changed in netplan: | |
status: | Incomplete → Confirmed |
Changed in cloud-init (Ubuntu): | |
status: | New → Confirmed |
Changed in netplan.io (Ubuntu): | |
status: | New → In Progress |
assignee: | nobody → Mathieu Trudel-Lapierre (cyphermox) |
Changed in nplan (Ubuntu): | |
status: | New → Fix Released |
description: | updated |
tags: |
added: verification-done-xenial removed: verification-needed-xenial |
Changed in netplan.io (Ubuntu Bionic): | |
status: | New → Fix Committed |
tags: | added: verification-needed-bionic |
tags: |
added: verification-failed-bionic removed: verification-needed-bionic |
tags: | removed: verification-needed |
tags: |
added: verification-done-bionic removed: verification-failed-bionic |
Changed in nplan (Ubuntu Xenial): | |
status: | Fix Committed → Fix Released |
Changed in netplan.io (Ubuntu Bionic): | |
status: | Fix Committed → Fix Released |
Changed in netplan: | |
status: | Confirmed → Fix Released |
Changed in netplan.io (Ubuntu Bionic): | |
status: | Fix Released → Fix Committed |
tags: |
added: verification-needed verification-needed-bionic removed: verification-done-bionic |
tags: |
added: verification-failed-bionic removed: verification-needed-bionic |
tags: | removed: verification-needed |
tags: |
added: verification-needed verification-needed-bionic removed: verification-failed-bionic |
tags: |
added: verification-failed-bionic removed: verification-needed-bionic |
tags: |
added: verification-done-bionic removed: verification-failed-bionic |
tags: |
added: verification-failed-bionic removed: verification-done-bionic |
tags: |
added: verification-needed-bionic removed: verification-failed-bionic |
Changed in netplan.io (Ubuntu Cosmic): | |
status: | Fix Released → Fix Committed |
tags: | added: verification-needed-cosmic |
description: | updated |
tags: | removed: verification-needed-xenial |
Changed in systemd (Ubuntu): | |
status: | Confirmed → Invalid |
Works for me. I've been using a config like this for a while, the system sets the interface name at boot as expected:
network:
version: 2
renderer: networkd
ethernets:
mainif:
match:
macaddress: "b8:27:eb:b6:35:86"
set-name: mainif
addresses: [ "10.3.0.5/23" ]
gateway4: 10.3.0.1
[...]
The difference here is that this is hardware rather than a VM. Are we sure that the network interface shows up sufficiently early, and that the mac can be matched at the time?