Public bug reported:

NetworkManager crashes repeatedly (SIGABRT, nm_assert_not_reached() in
nms-keyfile-writer.c, function _internal_write_connection()) whenever it
tries to re-sync connection profiles to disk while ANY stored connection
contains an invalid IPv4 address/prefix combination — in my case an
Ethernet connection with ipv4.method=shared and address 192.168.1.1/0
(prefix /0 is invalid for a host address).

Trigger: Every time I tried to connect to a new, not-yet-saved Wi-Fi network, 
NetworkManager would crash and restart instead of connecting.
This happened because connecting to a new network makes NM write a new profile 
to disk, which triggers a re-sync/re-validation of all stored connections — 
including my unrelated, long-broken wired connection.

Log output:
NetworkManager[PID]: /etc/netplan/90-NM-<uuid>.yaml:9:7: Error in network 
definition: invalid prefix length in address '192.168.1.1/0'
NetworkManager[PID]: <error> BUG: the profile cannot be stored in keyfile 
format without becoming unusable: cannot access file: No such file or directory
NetworkManager[PID]: nm:ERROR:../src/core/settings/plugins/keyfile/nms 
-keyfile-writer.c:551:<unknown-fcn>: assertion failed: (<dropped>)
NetworkManager[PID]: Bail out! nm:ERROR:...: assertion failed: (<dropped>) 
systemd[1]: NetworkManager.service: Main process exited, code=dumped, 
status=6/ABRT

Restart counter reached 13+ in a single session before I found and
removed the offending netplan file.

Root cause: In _internal_write_connection(), after writing a profile, NM 
re-reads and normalizes it as a sanity check. If normalization fails, it logs 
"BUG: the profile cannot be stored..." and calls nm_assert_not_reached(), which 
aborts the whole daemon on builds with asserts enabled (as Ubuntu's package 
is), instead of just failing to
  
This is not a new class of bug — it's the same code path as two previous 
reports: 
- LP #2038811 ("NetworkManager crashes when updating wpa-eap connections") — a 
Canonical maintainer confirmed the assert should be converted to error logging 
+ return FALSE instead of crashing, but the fix applied was narrow (only for 
the EAP-method trigger). 
- LP #1998207 ("netplan network-manager plugin tries to save temporary 
connections") — same exact error string ("cannot access file: No such file or 
directory"), different trigger (temporary VPN interfaces), also fixed narrowly. 
  
My case is a third, distinct trigger (invalid IPv4 prefix in a shared-mode 
connection) for the same unresolved general design flaw: the daemon-wide abort 
in the keyfile-writer's sanity-check path. Requesting that the underlying 
nm_assert_not_reached() be converted to graceful error handling generically, as 
previously suggested, rather than being patched trigger-by-trigger.
  
Environment: Ubuntu 26.04, NetworkManager 1.54.3, netplan.io (installed 
version), GNOME Shell 50.1.
  
Steps to reproduce:
1. Set an Ethernet/Wi-Fi connection's ipv4.method to shared via nmcli or 
Settings, with no explicit address (or a malformed one).
2. Attempt to activate any new connection (e.g. join a new Wi-Fi network).
3. Watch NetworkManager crash with the log signature above.

** Affects: network-manager (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2160278

Title:
  NetworkManager crashes (SIGABRT) via nm_assert_not_reached() in
  keyfile writer on invalid IPv4 prefix in stored connection

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/2160278/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to