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.
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').
(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.