[systemd-devel] Problem: Renaming the USB network interface makes SYSTEMD_WANTS not working
Charles
cgat at protonmail.com
Sun Aug 28 20:35:33 UTC 2022
Hello,
Adding NAME="mywifi" to an udev rule causes the SYSTEMD_WANTS service to not be executed. Removing NAME="mywifi" and the service is executed. How come?
> /etc/udev/rules.d/10-network.rules
> SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="...", TAG+="systemd", ENV{SYSTEMD_WANTS}="test.service"
/etc/systemd/system/test.service
> [Service]
> Type=simple
> ExecStart=/bin/echo %n started!
First try, it works:
I type:
> # journalctl -f -u test.service
I plug the USB Wi-Fi device and it prints:
> "test.service started!"
Note that ip link show returns wlan1.
Now I add NAME="mywifi" which gives:
> /etc/udev/rules.d/10-network.rules
> SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="...", NAME="mywifi", TAG+="systemd", ENV{SYSTEMD_WANTS}="test.service"
I plug the USB Wi-Fi device and it prints nothing.
Note that ip link show returns mywifi.
I remove NAME="mywifi" and it prints "test.service started!" again.
I really do not understand. When using RUN, it works all the time. SYSTEMD_WANTS seems to work only when the interface is not renamed. I tried also to rename it with a .link file, it got renamed but the service is still not triggered.
Hope you can help me out.
Thanks in advance for your time,
Charles
Sent with [Proton Mail](https://proton.me/) secure email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220828/f63032d6/attachment.htm>
More information about the systemd-devel
mailing list