Hello,

I believe I have found a bug in meta-networking: networkmanager in Langdale 
when upgrading from Kirkstone. It appears that this recent change:

https://git.openembedded.org/meta-openembedded/commit/?id=009bc195629ac4e885d7ae5148a175c8c8147e8f

restructured the recipe and packages for networkmanager. As part of that 
change, it started explicitly packaging the sysvinit network-manager script, 
which had previously been omitted:

-FILES:${PN} += " \
-    ${libexecdir} \
+SUMMARY:${PN}-daemon += "The NetworkManager daemon"
+FILES:${PN}-daemon += " \
+    ${bindir}/nm-online \
+    ${datadir}/dbus-1 \
+    ${datadir}/polkit-1 \
     ${libdir}/NetworkManager \
-    ${nonarch_libdir}/firewalld/zones \
+    ${libexecdir} \
+    ${localstatedir}/lib/NetworkManager \
+    ${NETWORKMANAGER_DISPATCHERDIR} \
+    ${nonarch_base_libdir}/udev/* \
+    ${nonarch_libdir}/firewalld \
     ${nonarch_libdir}/NetworkManager/conf.d \
-    ${nonarch_libdir}/NetworkManager/dispatcher.d \
     ${nonarch_libdir}/NetworkManager/dispatcher.d/pre-down.d \
     ${nonarch_libdir}/NetworkManager/dispatcher.d/pre-up.d \
     ${nonarch_libdir}/NetworkManager/dispatcher.d/no-wait.d \
-    ${nonarch_libdir}/NetworkManager/VPN \
     ${nonarch_libdir}/NetworkManager/system-connections \
-    ${datadir}/polkit-1 \
-    ${datadir}/dbus-1 \
-    ${nonarch_base_libdir}/udev/* \ 
+    ${nonarch_libdir}/NetworkManager/VPN \
+    ${sbindir}/NetworkManager \
+    ${sysconfdir}/init.d/network-manager \ 
<----------------------------------- here
+    ${sysconfdir}/NetworkManager \
     ${systemd_system_unitdir} \
 "
+    ${sysconfdir}/init.d/network-manager \
+    ${sysconfdir}/NetworkManager \

In configurations running systemd, this results in a NetworkManager.service 
systemd unit and a network-manager sysvinit script. Since these units have 
different name strings, when using systemd, systemd-sysv-generator thinks that 
"network-manager" is missing a .service file and will generate a late file at 
boot time:

[    2.003126] systemd-sysv-generator[141]: SysV service 
'/etc/init.d/network-manager' lacks a native systemd unit file. Automatically 
generating a unit file for compatibility  .....

This results in a conflict; it means there will be two services for 
NetworkManager and one of them will succeed and the other fail. Who wins seems 
to vary based on build configuration since this is likely just a race condition:

[FAILED] Failed to start Network Manager.
See 'systemctl status NetworkManager.service' for details.

root@qemux86-64:~# journalctl -u NetworkManager
May 12 12:06:47 qemux86-64 systemd[1]: Starting Network Manager...
May 12 12:06:48 qemux86-64 NetworkManager[210]: <info>  [1683893208.1727] 
NetworkManager (version 1.40.0) is starting... 
(boot:7d16287e-3a0a-40c6-b94c-6dd6d069fe3c)
May 12 12:06:48 qemux86-64 NetworkManager[210]: <info>  [1683893208.1739] Read 
config: /etc/NetworkManager/NetworkManager.conf
May 12 12:06:48 qemux86-64 systemd[1]: Started Network Manager.
May 12 12:06:48 qemux86-64 NetworkManager[210]: <error> [1683893208.2285] 
bus-manager: fatal failure to acquire D-Bus service 
"org.freedesktop.NetworkManager" (3). Service already taken
May 12 12:06:48 qemux86-64 NetworkManager[210]: <info>  [1683893208.2292] 
exiting (error)
May 12 12:06:48 qemux86-64 systemd[1]: NetworkManager.service: Main process 
exited, code=exited, status=1/FAILURE
May 12 12:06:48 qemux86-64 systemd[1]: NetworkManager.service: Failed with 
result 'exit-code'.
May 12 12:06:48 qemux86-64 systemd[1]: NetworkManager.service: Scheduled 
restart job, restart counter is at 1.
May 12 12:06:48 qemux86-64 systemd[1]: Stopped Network Manager.
May 12 12:06:48 qemux86-64 systemd[1]: Starting Network Manager...
May 12 12:06:48 qemux86-64 NetworkManager[227]: NetworkManager is already 
running (pid 216)


root@qemux86-64:~# systemctl status NetworkManager
x NetworkManager.service - Network Manager
     Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; 
preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-05-12 12:06:50 UTC; 2h 
20min ago
   Duration: 26ms
       Docs: man:NetworkManager(8)
    Process: 236 ExecStart=/usr/sbin/NetworkManager --no-daemon (code=exited, 
status=1/FAILURE)
...

root@qemux86-64:~# systemctl status network-manager
* network-manager.service - LSB: network connection manager
     Loaded: loaded (/etc/init.d/network-manager; generated)
     Active: active (running) since Fri 2023-05-12 12:06:48 UTC; 2h 20min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 211 ExecStart=/etc/init.d/network-manager start (code=exited, 
status=0/SUCCESS)


I initially observed this on our custom Arm based NXP platform, but as you can 
see from my logs above this is reproducible on qemux86-64 by enabling 
networkmanager and systemd.

I would like to submit a patch, but want to discuss the right approach. We 
could install the sysvscript as NetworkManager, but this could make for user 
backward-compatibility problems. Another solution is to make a symlink named 
"network-manager.service" in ${systemd_system_unitdir} as this simply aliases 
the real service. Perhaps there is another better solution...

Thanks

Sincerely,
Ken Sloat

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#102557): 
https://lists.openembedded.org/g/openembedded-devel/message/102557
Mute This Topic: https://lists.openembedded.org/mt/98852053/21656
Group Owner: openembedded-devel+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to