I can reproduce this issue in a clean Noble LXD container:
$ lxc launch ubuntu-daily:noble nn-nm-integration
root@nn-nm-integration:~# apt install network-manager
[...]
# rename primary interface to "cockpit"
root@nn-nm-integration:~# ip link set eth0 name cockpit
root@nn-nm-integration:~# nmcli c del netplan-eth0
root@nn-nm-integration:~# netplan set network.renderer=NetworkManager
--origin-hint=00-renderer
root@nn-nm-integration:~# netplan apply
# Create connections through NM/cockpit
root@nn-nm-integration:~# nmcli con add type ethernet con-name cockpit ifname
cockpit
root@nn-nm-integration:~# nmcli connection add type bond con-name tbond ifname
tbond bond.options
"mode=active-backup,downdelay=0,miimon=100,updelay=0,primary=cockpit"
root@nn-nm-integration:~# nmcli con modify cockpit master tbond
root@nn-nm-integration:~# nmcli con show tbond | grep ^bond
bond.options:
mode=active-backup,downdelay=0,miimon=100,updelay=0
root@nn-nm-integration:~# netplan get
Command failed:
/etc/netplan/90-NM-ec3b1cd3-bf73-4052-9b80-afa81f6ac82e.yaml:13:18: Error in
network definition: tbond: interface 'cockpit' is not defined
primary: "cockpit"
^
# Manual fix as lined out in the bug description:
root@nn-nm-integration:~# nmcli c
NAME UUID TYPE DEVICE
cockpit 2ba922c0-0dcc-412a-8e94-2fcc51f440bd ethernet cockpit
tbond ec3b1cd3-bf73-4052-9b80-afa81f6ac82e bond tbond
lo 7f40f45c-9f66-4971-b467-9583195bddb6 loopback lo
root@nn-nm-integration:~# vim
/etc/netplan/90-NM-2ba922c0-0dcc-412a-8e94-2fcc51f440bd.yaml
=> change "NM-2ba922c0-0dcc-412a-8e94-2fcc51f440bd" NetDef to "cockpit"
root@nn-nm-integration:~# netplan apply
root@nn-nm-integration:~# nmcli con show tbond | grep ^bond
bond.options:
mode=active-backup,downdelay=0,miimon=100,primary=cockpit,updelay=0
root@nn-nm-integration:~# netplan get
network:
version: 2
ethernets:
cockpit:
renderer: NetworkManager
match:
name: "cockpit"
wakeonlan: true
networkmanager:
uuid: "2ba922c0-0dcc-412a-8e94-2fcc51f440bd"
name: "cockpit"
passthrough:
connection.controller: "tbond"
connection.master: "tbond"
connection.port-type: "bond"
connection.slave-type: "bond"
connection.timestamp: "1742818225"
ethernet._: ""
bonds:
tbond:
renderer: NetworkManager
dhcp4: true
dhcp6: true
parameters:
mode: "active-backup"
mii-monitor-interval: "100"
up-delay: "0"
down-delay: "0"
primary: "cockpit"
networkmanager:
uuid: "ec3b1cd3-bf73-4052-9b80-afa81f6ac82e"
name: "tbond"
passthrough:
ipv6.addr-gen-mode: "default"
ipv6.ip6-privacy: "-1"
proxy._: ""
# Additional issue
While playing with this reproducer, I ran into an additional issue: Depending
on how the UUIDs are generated, we might end up in a state where the
/etc/netplan/90-NM-<UUID>.yaml filename for the bond sorts before the YAML file
of the primary interface. In such case, fixing the NetDef name to "cockpit"
manually doesn't do the trick, as Netplan still can't find that interface when
parsing the files.
# Workaround
When the configuration is created through "netplan set" instead of "nmcli" we
can avoid the "NM-<UUID>" naming scheme that is autogenearted by the
Netplan-NetworkManager integration.
So we can replace the following "nmcli" command with the next "netplan set"
command to avoid this issue:
$ nmcli con add type ethernet con-name cockpit ifname cockpit"
$ netplan set "ethernets.cockpit={renderer: 'NetworkManager', match: {name:
'cockpit'}, networkmanager: {name: 'cockpit'}}" --origin-hint=01-primary
# Approach
In order to fix this properly, we need to replicate NetworkManagers
connection-profile naming logic (incl. fallback if some name is already taken)
in Netplan's NM integration code. Additionally, we need to work with additional
parsing passes, to make sure connection-profiles stored in Netplan can always
be found, even if their filename sorts them in a different order. This is a
bigger refactoring for the Netplan-NetworkManager integration and needs some
dedicated engineering time.
** Changed in: netplan.io (Ubuntu)
Status: Confirmed => Triaged
** Changed in: netplan.io (Ubuntu)
Importance: Undecided => Medium
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2098093
Title:
Setting primary interface for a bond fails with netplan
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2098093/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs