Comment 3 for bug 2038811

Revision history for this message
Lukas Märdian (slyon) wrote : Re: /usr/sbin/NetworkManager:6:g_assertion_message:g_assertion_message_expr:_internal_write_connection:nms_keyfile_writer_connection:nms_keyfile_plugin_update_connection

Reproducer:
nmcli con add type wifi ifname wlan0 ssid asdasd wifi-sec.key-mgmt wpa-eap 802-1x.eap leap 802-1x.identity username 802-1x.password aaaaaaaa

The crash (SIGABRT) happens in NetworkManager's Netplan integration patch, because of running into a "nm_assert_not_reached()" call. This could easily be avoided by muting that assert and just logging the error and returning FALSE (as is already done below the assert):

https://git.launchpad.net/ubuntu/+source/network-manager/tree/debian/patches/netplan/0002-netplan-make-use-of-libnetplan-for-YAML-backend.patch#n319

This would not fix the root-cause, though, which is located in libnetplan: When creating or updating a NetworkManager connection profile that uses a 802.1x eap authentication method unknown to Netplan (such as "leap" or "pwd"), the Netplan keyfile parser is getting confused and generates a broken keyfile config for NetworkManager.

https://github.com/canonical/netplan/blob/main/src/parse-nm.c#L383

This is triggered when manually adding/modifying a corresponding NM connection profile (through the NM GUI, nmcli, NM DBus, ...) or automatically, when migrating a corresponding profile through NetworkManager's "Netplan everywhere" migration as part of the .postinst maintainer script. In the latter case the crash is handled gracefully, NetworkManager is restarted and the broken keyfile is restored from a backup.

https://git.launchpad.net/ubuntu/+source/network-manager/tree/debian/network-manager.postinst#n67

This can be fixed by supporting all of NetworkManager's 802.1x eap authentication methods in Netplan or by making Netplan's passthrough logic detect such cases and handle them as a fallback.

Kudos to @danilogondolfo for the investigation and the proposed patch:
https://github.com/canonical/netplan/pull/415