Bug#982688: wireless interface name unstable across reboots

Michael Biebl biebl at debian.org
Mon Feb 22 13:38:40 GMT 2021


Am 18.02.21 um 21:20 schrieb Michael Biebl:
> Am 18.02.2021 um 21:03 schrieb Yuri D'Elia:
>> On Thu, Feb 18 2021, Michael Biebl wrote:
>>> There is afaics.
>>> udev announces devices only after it has fully processed all udev rules.
>>
>> Asking here since it's on topic and you might be more familiar with it
>> than I am: as these devices also emitted as an event or target that can
>> be used in a unit for dependency then?
> 
> Please ask on the systemd-devel mailing list (this is a bug tracker).

This is basic systemd 101 and all documented in the man pages and this 
feels like a support request and not a bug report, which is why this is 
better directed at the systemd devel mailing list (or even debian-user).
Anyway.

You can start a service based on a hardware event.
For that, create a udev rule and start the service(or target) via 
SYSTEMD_WANTS
https://www.freedesktop.org/software/systemd/man/systemd.device.html#

There is no dedicated target for wireless interfaces (since systemd 
can't know in advance what type of hardware will be plugged in at 
runtime). For every device, systemd will synthesize a .device unit 
though. So what you can do, is to order your service after it.
Say your interface is named wlp3s0, then there will be a 
sys-subsystem-net-devices-wlp3s0.device unit, which is marked as ready 
once it has been fully processed by udev.
So in theory, you could add

[Unit]
Wants=sys-subsystem-net-devices-wlp3s0.device
After=sys-subsystem-net-devices-wlp3s0.device

to iwd.service, to delay the start of iwd.service.

This doesn't really help though.
iwd will re-initialize your wireless interface when it starts (I think 
it unloads the firmware or something like that). At that point, both iwd 
and udevd are running and race against each other and usually iwd wins 
to claim the device.
iwd could fix this, by using libudev, to only grab the device after it 
has been processed by udev, but as I tried to explain, upstream decided 
not to do that.
So you basically have an unfixable race due to the design decisions of 
iwd. This is why you can do any udev based interface renaming when you 
use iwd and this is why iwd explicitly disables it.

Hope that clarifies.
Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20210222/32bbb6d7/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list