The first crash could be fixed by handling that case inside libnetplan.

The "ipvX.method" defaults to "disabled" and it will be added to the
"passthrough" section. At some point post-merging we'd need to check if
there are addresses in the list and if "ipvX.method" is in the
passthrough section and remove it (or just omit it when writing the
passthrough to the keyfile).

We also could do it during the merging. There are 2 cases to consider:
the existing configuration is read before or after the new YAML. So when
we parse the "addresses" list we'd need to see if "ipvX.method:
disabled" is present in the passthrough and when we parse the
passthrough and find the "ipvX.method: disabled" we need to see if there
is something in the addresses list.

None of this solutions sounds great through... we probably shouldn't be
involving the passthrough keys in the libnetplan logic...

-- 
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/2088459

Title:
  Problems with NetworkManager and merging of existing configuration

Status in netplan.io package in Ubuntu:
  Triaged
Status in network-manager package in Ubuntu:
  Triaged

Bug description:
  Merging existing configuration with newly created connections can lead
  to problems.

  See the scenario below:

  Existing configuration:

  # cat /etc/netplan/10-dummy.yaml
  network:
    dummy-devices:
      dummy0:
        renderer: NetworkManager
        addresses:
          - 192.168.0.1/24

  
  Adding a connection through nmcli for the same interface:

  # nmcli con add type dummy ifname dummy0
  Error: Failed to add 'dummy-dummy0' connection: Message recipient 
disconnected from message bus without replying

  
  Error:

  Nov 18 13:42:06 plucky-nm generate[8830]: Permissions for 
/etc/netplan/10-dummy.yaml are too open. Netplan configuration should NOT be 
accessible by others.
  Nov 18 13:42:07 plucky-nm NetworkManager[8623]: <error> [1731937327.2073] 
BUG: the profile cannot be stored in keyfile format without becoming unusable: 
invalid connection: ipv4.addresses: this property is not allowed for 
'method=disabled'
  Nov 18 13:42:07 plucky-nm NetworkManager[8623]: **
  Nov 18 13:42:07 plucky-nm NetworkManager[8623]: 
nm:ERROR:../src/core/settings/plugins/keyfile/nms-keyfile-writer.c:551:<unknown-fcn>:
 assertion failed: (<dropped>)
  Nov 18 13:42:07 plucky-nm NetworkManager[8623]: Bail out! 
nm:ERROR:../src/core/settings/plugins/keyfile/nms-keyfile-writer.c:551:<unknown-fcn>:
 assertion failed: (<dropped>)
  Nov 18 13:42:07 plucky-nm systemd[1]: NetworkManager.service: Main process 
exited, code=dumped, status=6/ABRT
  Nov 18 13:42:07 plucky-nm systemd[1]: NetworkManager.service: Failed with 
result 'core-dump'.
  Nov 18 13:42:07 plucky-nm systemd[1]: NetworkManager.service: Scheduled 
restart job, restart counter is at 1.
  Nov 18 13:42:07 plucky-nm systemd[1]: Starting NetworkManager.service - 
Network Manager...

  
  Trying to cope with the existing configuration doesn't help a lot:

  # nmcli con add type dummy ifname dummy0 ipv4.method manual ipv4.address 
192.168.0.1/24
  Error: Failed to add 'dummy-dummy0' connection: Message recipient 
disconnected from message bus without replying

  
  In this case the error is not even clear:

  
  Nov 18 13:49:59 plucky-nm generate[1156]: Permissions for 
/etc/netplan/10-dummy.yaml are too open. Netplan configuration should NOT be 
accessible by others.
  Nov 18 13:49:59 plucky-nm NetworkManager[810]: **
  Nov 18 13:49:59 plucky-nm NetworkManager[810]: 
nm:ERROR:../src/core/settings/nm-settings-utils.c:103:<unknown-fcn>: assertion 
failed: (<dropped>)
  Nov 18 13:49:59 plucky-nm NetworkManager[810]: Bail out! 
nm:ERROR:../src/core/settings/nm-settings-utils.c:103:<unknown-fcn>: assertion 
failed: (<dropped>)
  Nov 18 13:49:59 plucky-nm systemd[1]: NetworkManager.service: Main process 
exited, code=dumped, status=6/ABRT
  Nov 18 13:49:59 plucky-nm systemd[1]: NetworkManager.service: Failed with 
result 'core-dump'.
  Nov 18 13:49:59 plucky-nm systemd[1]: NetworkManager.service: Scheduled 
restart job, restart counter is at 1.
  Nov 18 13:49:59 plucky-nm systemd[1]: Starting NetworkManager.service - 
Network Manager...


  Applying the configuration works anyway:

  root@plucky-nm:~# netplan apply
  root@plucky-nm:~# nmcli con show
  NAME                UUID                                  TYPE      DEVICE
  Wired connection 1  65bff577-bc73-38c1-8b95-e0acf92e0913  ethernet  enp5s0
  dummy-dummy0        354ebe07-b386-42fb-ab8b-ee8c3486d033  dummy     dummy0
  lo                  9b307900-2954-4e7c-b63e-c7246d1cecfc  loopback  lo
  root@plucky-nm:~# netplan get
  network:
    version: 2
    dummy-devices:
      dummy0:
        renderer: NetworkManager
        addresses:
        - "192.168.0.1/24"
        networkmanager:
          uuid: "354ebe07-b386-42fb-ab8b-ee8c3486d033"
          name: "dummy-dummy0"
          passthrough:
            proxy: {}
            ipv6:
              addr-gen-mode: "default"
              method: "disabled"
              ip6-privacy: "-1"
            dummy: {}

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2088459/+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

Reply via email to