Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 831635 - net-misc/networkmanager does not wait for net-wireless/iwd on OpenRC systems
Summary: net-misc/networkmanager does not wait for net-wireless/iwd on OpenRC systems
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-20 20:34 UTC by Nikita Zlobin
Modified: 2022-11-13 03:02 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Zlobin 2022-01-20 20:34:02 UTC
This is second problem after bug #831631. I'm not sure, what's reason - openrc of iwd. Probably iwd, because I see its init service requires dbus, but it doesn't check e.g. dbus service file (may be openrc could have special function for that).

iwd starts as service ok, but networkmanager doesn't see it via dbus. If iwd service file fixed - nm will start new iwd after startup, probably replacing service (pidof showes only 1 pid, which is different from /run/iwd.pid).

However, if iwd dbus service command is not fixed and iwd was not spawned, networkmanager will use existing iwd system service after restart, which makes me to suspect openrc starting iwd & networkmanager in wrong order. Or at least iwd has no time to add to dbus before searched by networkmanager.

openrc-0.44.10, iwd-1.20

Reproducible: Always

Steps to Reproduce:
1. ensure, that /usr/share/dbus-1/system-services/net.connman.iwd.service is unmodified after install.
2. eselect rc add iwd
3. reboot
Actual Results:  
iwd works, but networkmanager can't see it in first start by openrc.
"nmcli device" showes its device "unavailable".
But if networkmanager is restarted - wifi status will be either connected or disconnected (nm-applet should show wifi networks if any).

Expected Results:  
NetworkManager should pick iwd on system start. If problem is in init service file - it probably should check for dbus service before to mark it as started.
Comment 1 Nikita Zlobin 2022-10-04 18:40:36 UTC
I just figured out, that problem with init sequence goes not from iwd, but from openrc itself.

First I guessed, that service scripts just need some dbus interactions (checking dbus service presence besides pid). However, problem doesn't appear with either 'need iwd' or 'want iwd' line added to depend() in NetworkManager service. And 'after iwd' line makes no difference. Also, from iwd service side, tried 'keyword -timeout' without visible effect too.

Looks like as if after/before used different wait code than want/need - imho, there should be no difference besides unconditional dependency startup (e.g. if started via 'service', 'rc-service' or 'eselect rc start').
Comment 2 Mike Gilbert gentoo-dev 2022-10-05 17:12:44 UTC
(In reply to Nikita Zlobin from comment #1)

I did some testing with OpenRC 0.45.2, and the "after" function in depend() seems to work just fine with some trivial services.

I suspect you're hitting a general race condition between iwd presenting itself on the system bus and NetworkManager attempting to connect to it. The difference between "need/want iwd" and "after iwd" is probably just random chance.

It's worth noting that the iwd init script sets command_background="yes". That means the daemon does not fork itself and relies on OpenRC to do it. That also means that OpenRC has no way of knowing when iwd has sucessfully initialized and is listening on the system bus. It simply execs iwd and continues on immediately.

In any case, the current init scripts for iwd and NetworkManager have no ordering at all, so I am re-assigning this to the NetworkManager maintainer.