Changing the check as suggested to:

if (!is_volatile && !is_nm_generated && !is_external) {
...

does help and netplan files for tun0 and tun1 are not written anymore.
But, when I create a VPN connection I still have problems.

$ network-manager.nmcli c import type openvpn file <open_vpn_cfg>
$ network-manager.nmcli c up <vpn_conn>
$ network-manager.nmcli c
NAME          UUID                                  TYPE      DEVICE 
<vpn_conn>    7b7fd99d-2651-4796-ba50-beda0890aab9  vpn       ens3   
tun0          1d7b454c-4897-4d3d-899a-619165a996bf  tun       tun0   
tun1          f7b9ba1f-496b-4cca-ae79-31db28a64c29  tun       tun1   
tun2          46935370-3662-4aac-b563-877214b48cd8  tun       tun2   
netplan-ens3  bec3d02a-c9e5-3283-92ab-ee43a4246c85  ethernet  ens3   
$ sudo /snap/bin/network-manager.nmcli d
DEVICE  TYPE      STATE                   CONNECTION   
tun0    tun       connected (externally)  tun0         
tun1    tun       connected (externally)  tun1         
tun2    tun       connected (externally)  tun2         
ens3    ethernet  connected               netplan-ens3 
lo      loopback  unmanaged               --           
$ network-manager.nmcli c down default
$ network-manager.nmcli c 
NAME          UUID                                  TYPE      DEVICE 
netplan-ens3  bec3d02a-c9e5-3283-92ab-ee43a4246c85  ethernet  ens3   
tun0          8bc8d5b1-6000-4b78-9988-72d2d811bfb7  tun       tun0   
tun1          9d614be8-dac1-44ef-acfd-f9c60005b56f  tun       tun1   
default       7b7fd99d-2651-4796-ba50-beda0890aab9  vpn       --     
$ ls /etc/netplan/
00-default-nm-renderer.yaml
50-cloud-init.yaml
90-NM-7b7fd99d-2651-4796-ba50-beda0890aab9.yaml
90-NM-46935370-3662-4aac-b563-877214b48cd8

Note that when you create an OpenVPN connection both a normal NM
connection and a new tunnel device (tun2) are created. NM creates a
external device for tun2. The interesting thing here is that the file
for tun2 is written after setting down the connection, and the NM daemon
actually forgets it (until you restart it and reads the netplan file).
Maybe this storing is in a different code path.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to network-manager in Ubuntu.
https://bugs.launchpad.net/bugs/1998207

Title:
  netplan network-manager plugin tries to save temporary connections

Status in netplan:
  Triaged
Status in network-manager package in Ubuntu:
  Confirmed

Bug description:
  When creating an OpenVPN connection, a temporal connection called tunN
  is created. For instance, after activating a connection called
  vpntest, I have:

  NAME          UUID                                  TYPE      DEVICE 
  vpntest       458856e6-8f0f-4dc6-82f2-dd72868252a0  vpn       ens3   
  tun0          1eb1dbe8-5678-4818-9adf-fb2dc01ed132  tun       tun0   

  tun0 is created/removed after activating/deactivating vpntest and
  should not really be saved, but I see netplan adding it in
  /etc/netplan. And while doing so the plugin also reports some errors
  (I see these when stopping the connection):

  Nov 28 16:16:57 ubuntu NetworkManager[11752]: <error> [1669652217.2920] BUG: 
the profile cannot be stored in keyfile format without becoming unusable: 
cannot access file: No such file or directory
  Nov 28 16:16:57 ubuntu NetworkManager[11752]: 
((src/libnm-core-impl/nm-connection.c:342)): assertion '<dropped>' failed
  Nov 28 16:16:57 ubuntu NetworkManager[11752]: <warn>  [1669652217.2920] 
keyfile: commit: failure to write 1eb1dbe8-5678-4818-9adf-fb2dc01ed132 ((null)) 
to 
"/run/NetworkManager/system-connections/tun0-1eb1dbe8-5678-4818-9adf-fb2dc01ed132.nmconnection":
 keyfile writer produces an invalid connection: cannot access file: No such 
file or directory

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1998207/+subscriptions


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to