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 Touch seeded packages, which is subscribed to network-manager in Ubuntu. https://bugs.launchpad.net/bugs/2098093 Title: Setting primary interface for a bond fails with netplan Status in netplan.io package in Ubuntu: Triaged Status in network-manager package in Ubuntu: Confirmed Bug description: Ubuntu 2404 network-manager 1.46.0-1ubuntu2.2 netplan.io 1.1.1-1~ubuntu24.04.1 When [improving support for primary interfaces of bonds](https://github.com/cockpit-project/cockpit/pull/21533) in Cockpit, we encountered this message in the journal: ``` Feb 10 08:43:17 ubuntu NetworkManager[9361]: /etc/netplan/90-NM-861a710b-9858-48f4-b5e5-a770ab67bd1f.yaml:13:18: Error in network definition: tbond: interface 'cockpit' is not defined Feb 10 08:43:17 ubuntu NetworkManager[9361]: primary: "cockpit" Feb 10 08:43:17 ubuntu NetworkManager[9361]: ^ ``` The message seems to come from "netplan apply": ``` # netplan apply [...] /etc/netplan/90-NM-4883fb46-4315-41f1-b945-bb096768da61.yaml:13:18: Error in network definition: tbond: interface 'cockpit' is not defined primary: "cockpit" ^ # echo $? 78 ``` NetworkManager seems to ignore the failure, and somehow the bond interface is created anyway, but the "bond.options" setting of its connection doesn't include the expected "primary" attribute: ``` # nmcli con show tbond | grep ^bond bond.options: mode=active-backup,downdelay=0,miimon=100,updelay=0 ``` I have no idea what the relationship between netplan and NetworkManager is. I am guessing that NetworkManager is writing the yaml files in /etc/netplan/. The problem seems to be that the definition of the "cockpit" interface uses a generated name: ``` network: version: 2 ethernets: NM-3287d9ea-ffda-49df-9f21-27594d7cc1b8: renderer: NetworkManager match: name: "cockpit" wakeonlan: true networkmanager: uuid: "3287d9ea-ffda-49df-9f21-27594d7cc1b8" name: "cockpit" passthrough: connection.controller: "tbond" connection.master: "tbond" connection.port-type: "bond" connection.slave-type: "bond" ethernet._: "" ``` If I change this to ``` network: version: 2 ethernets: cockpit: renderer: NetworkManager match: name: "cockpit" [...] ``` then the error disappears and `bond.options` shows the expected value: ``` # nmcli con show tbond | grep ^bond bond.options: mode=active-backup,downdelay=0,miimon=100,primary=cockpit,updelay=0 ``` To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2098093/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp