I'm guessing that this problem of systemd not loading the usb wifi device on time is caused by having a slow system. We had this problem with Arch Linux ARM on a Raspberry Pi <http://en.wikipedia.org/wiki/Raspberry_Pi>, which is understandable considering how slow it is compared to modern desktops. We were using a Belkin F5D8053 usb wifi adapter, and had no idea why we saw such seemingly inconsistent behavior with it, until we read this thread and I used shagrat's method.
By the way, if you replace every instance of "netcfg.service" with "netcfg@.service" you can use the "netcfg@<profile>.service" notation to start individual netcfg profiles at boot.
]]>.include /usr/lib/systemd/system/netcfg.service
[Unit]
After=sys-devices-pci0000:00-0000:00:1c.1-0000:03:00.0-bcma0:0-net-wlan0.device
BindTo=sys-devices-pci0000:00-0000:00:1c.1-0000:03:00.0-bcma0:0-net-wlan0.device
Thanks everyone for the quick fix! Marking solved!
]]>That replaces any netcfg.service and, in my case, wpa_supplicant????.service, so I have those disabled.
]]>Sorry, I'm a complete noob concerning systemd...
]]>$ cat /etc/systemd/system/network.service
[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target
After=sys-devices-pci0000:00-0000:00:1c.1-0000:02:00.0-bcma0:0-net-wlan0.device
BindTo=sys-devices-pci0000:00-0000:00:1c.1-0000:02:00.0-bcma0:0-net-wlan0.device
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/hdparm --yes-i-know-what-i-am-doing -m 16 -S0 -B255 /dev/sda
ExecStart=/usr/sbin/wpa_supplicant -B -i ${interface} -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down
ExecStop=/usr/bin/killall wpa_supplicant
[Install]
WantedBy=multi-user.target
@vacant: I guess your solution is kinda the same, but I don't think I can copy your bits (think it's setup-dependant). Where did you find those lines? I checked the journal but didn't find them.
systemctl --full
First column gives the id of the unit you want, you should see your wireless device in the "description" column (I see "BCM43225 802.11b/g/n").
]]>^ I could, but I don't consider that a "clean" fix. For now, I will see if something else works. If not, I might end up doing that.
Maybe this functionality is missing in netcfg? Waiting until a device exists. Or maybe this is part of net-auto-wireless.service / net-auto-wired.service ?
]]>#!/bin/sh
for i in {1..5} # wait up to 5 seconds for wlan or wire
do
[ -d /sys/class/net/wlan0 ] && exit
for f in /sys/class/net/eth*
do
carrier=$(cat "$f/carrier")
[ "$carrier" = "1" ] && exit 0
done
sleep 1
done