removing an NM connection removes also the set renderer

Bug #2027584 reported by Alfonso Sanchez-Beato
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Committed

Bug Description

While testing netplan 0.106 from on Ubuntu Core 22:

ubuntu@ubuntu:~$ sudo snap install network-manager
network-manager (22/stable) 1.36.6-5 from Canonical✓ installed
ubuntu@ubuntu:~$ ls /etc/netplan/
00-default-nm-renderer.yaml 70-netplan-set.yaml
ubuntu@ubuntu:~$ sudo cat /etc/netplan/*
  renderer: NetworkManager
  version: 2

ubuntu@ubuntu:~$ nmcli c add type gsm ifname '*' con-name arkessa apn
Connection 'arkessa' (2e763389-e2ca-4465-b633-65b8752fed54) successfully added.

ubuntu@ubuntu:~$ nmcli c del arkessa
Connection 'arkessa' (2e763389-e2ca-4465-b633-65b8752fed54) successfully deleted.
ubuntu@ubuntu:~$ ls /etc/netplan/
ubuntu@ubuntu:~$ sudo cat /etc/netplan/*
  version: 2

00-default-nm-renderer.yaml, which contains the renderer setting, has been removed. I have attached the base snap used for testing.

Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :
Revision history for this message
Lukas Märdian (slyon) wrote (last edit ):

I can reproduce this on Mantic, even using "netplan set network.modems.NM-2e763389-e2ca-4465-b633-65b8752fed54=NULL" directly, instead of "nmcli c del arkessa"

I wonder if this could be related to this refactoring:

Edit: Well, it seems to be reproducible on Kinetic ( 0.105), too. So probably unrelated..

Changed in netplan:
status: New → Triaged
importance: Undecided → High
tags: added: foundations-todo
tags: added: fr-4791
tags: added: netplan-everywhere
Revision history for this message
Lukas Märdian (slyon) wrote (last edit ):

So I found a minimal reproducer and prepared a unit-test case:

# setup
netplan set network.renderer=NetworkManager --origin-hint=00-no-netdefs-just-globals
netplan set network.ethernets.eth99.dhcp4=true --origin-hint=90-some-netdefs
ls -l /etc/netplan/
# test
netplan set network.ethernets.eth99=NULL
# result
cat /etc/netplan/00-no-netdefs-just-globals.yaml

    def test_set_no_netdefs_just_globals(self): # LP: #2027584
        keepme1 = os.path.join(, 'etc', 'netplan',
        with open(keepme1, 'w') as f:
            f.write('''network: {renderer: NetworkManager}''')
        deleteme = os.path.join(, 'etc', 'netplan',
        with open(deleteme, 'w') as f:
            f.write('''network: {ethernets: {eth99: {dhcp4: true}}}''')

        with open(keepme1, 'r') as f:
            yml = yaml.safe_load(f)
            self.assertEqual('NetworkManager', yml['network']['renderer'])

The issue seems to happen in Jammy+ so it's not necessarily a regression.

I'm fairly sure it's related to the combination of (as SRUed into Jammy via 0.105-0ubuntu2~22.04.2):

Especially, the "unlink" part at the bottom of netplan.c:netplan_state_update_yaml_hierarchy seems to ignore any global values (such as "renderer" or "version") and operates on netdefs only.

=> It should probably be fixed in conjunction with

Revision history for this message
Lukas Märdian (slyon) wrote :
Changed in netplan:
status: Triaged → In Progress
Lukas Märdian (slyon)
Changed in netplan:
status: In Progress → Fix Committed
Lukas Märdian (slyon)
tags: removed: foundations-todo
Revision history for this message
Lukas Märdian (slyon) wrote :

I confirmed the reproducer to be working with PR#382 in place in a UC22 image (via

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.