Bug 89811

Summary: networkd: Bonding (active-backup) Does Not Play Well with WiFi Links (wpa_supplicant)
Product: systemd Reporter: Martin Gallant <freedesktop>
Component: generalAssignee: Tom Gundersen <teg>
Status: NEW --- QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: watanabe.yu
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Complete journalctl -b
wpa_supplicant service file (From upstream)

Description Martin Gallant 2015-03-29 18:02:26 UTC
Created attachment 114701 [details]
Complete journalctl -b

There is a troubling race condition between netdev bond devices and WiFi,
where the WiFi component refuses to come up without coaxing.

I found a reference to a similar report in the systemd developer mailing list:
(Question 3) http://lists.freedesktop.org/archives/systemd-devel/2015-March/028971.html

My configuration, and a log snippet:
(Arch Linux system, running linux-2.19.3 and systemd v219)

===========
==> /etc/systemd/network/10-bond0.netdev <==
[NetDev]
Name=bond0
Kind=bond

==> /etc/systemd/network/20-eno1.network <==
[Match]
Name=eno1

[Network]
Bond=bond0

==> /etc/systemd/network/21-wlp2s0.network <==
[Match]
Name=wlp2s0

[Network]
Bond=bond0

==> /etc/systemd/network/32-dhcp.network <==
[Match]
Name=bond0

[Network]
DHCP=v4

[DHCP]
UseDomains=true

==> /etc/modprobe.d/bonding.conf <==
options bonding mode=active-backup
options bonding primary=eno1
options bonding miimon=1000
options bonding updelay=2000
options bonding downdelay=8000

--- journalctl -b | grep networkd ---
Mar 29 10:43:15 e5550 systemd-networkd[341]: bond0           : netdev ready
Mar 29 10:43:15 e5550 systemd-networkd[341]: Enumeration completed
Mar 29 10:43:15 e5550 systemd-networkd[341]: wlp2s0          : wlp2s0          : could not join netdev: Operation not permitted
Mar 29 10:43:15 e5550 systemd-networkd[341]: wlp2s0          : failed
Mar 29 10:43:15 e5550 systemd-networkd[341]: eno1            : link configured
Mar 29 10:43:18 e5550 systemd-networkd[341]: eno1            : gained carrier
Mar 29 10:43:18 e5550 systemd-networkd[341]: wlp2s0          : gained carrier
Mar 29 10:43:19 e5550 systemd-networkd[341]: bond0           : gained carrier
Mar 29 10:43:19 e5550 systemd-networkd[341]: bond0           : DHCPv4 address 192.168.0.54/24 via 192.168.0.2
Mar 29 10:43:19 e5550 systemd-networkd[341]: bond0           : link configured

===========

As reported earlier, an orderly restart of the networking daemon clears the problem

# ip link set eno1 down
# ip link set wlp2s0 down
# systemctl restart systemd-networkd
(And now we are golden)

Here is a hack workaround which might prove a clue as to the root cause.
If I force wpa_supplicant to come up after systemd-networkd, e.g.

===========
$ cat /etc/systemd/system/wpa_supplicant\@wlp2s0.service.d/customdependency.conf
[Unit]
After=systemd-networkd.service
===========

I can get the wireless interface to come up fairly reliably with every reboot.

My eventual goal is to stack a bridge device on top of bond0,
but I cannot get this to work no matter what.
I think the root cause of this race condition is what is blocking me.
Comment 1 Martin Gallant 2015-04-14 16:30:07 UTC
More background info re. wpa_supplicant:
(I am using service file from wpa_supplicant upstream, attached)

$ pacman -Q wpa_supplicant
wpa_supplicant 2.3-1

$ sudo systemctl status wpa_supplicant@wlp2s0
● wpa_supplicant@wlp2s0.service - WPA supplicant daemon (interface-specific version)
   Loaded: loaded (/usr/lib/systemd/system/wpa_supplicant@.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2015-04-14 09:04:08 PDT; 19min ago
 Main PID: 399 (wpa_supplicant)
   CGroup: /system.slice/system-wpa_supplicant.slice/wpa_supplicant@wlp2s0.service
           └─399 /usr/bin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-wlp2s0.conf -iwlp2s0
Comment 2 Martin Gallant 2015-04-14 16:31:27 UTC
Created attachment 115070 [details]
wpa_supplicant service file (From upstream)
Comment 3 Martin Gallant 2015-07-13 03:02:30 UTC
Corrected workaround: (Note added Requires= stanza)

===========
$ cat wpa_supplicant\@wlp2s0.service.d/customdependency.conf 
[Unit]
Requires=systemd-networkd.service
After=systemd-networkd.service
Comment 4 Yu Watanabe 2019-08-19 16:14:46 UTC
Do you still have this issue with recent release of systemd? If so, could you provide the recent debugging logs. Thank you.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.