You are not logged in.

#1 2012-12-18 10:18:13

Thump
Member
Registered: 2012-12-08
Posts: 12

Systemd starts hostapd before populating wlan0 device

Hi forum.
I've experienced an issue once after accidental reboot and I want it never happen again.
Hostapd failed to start on boot, here the logs:

hostapd[206]: Configuration file: /etc/hostapd/hostapd.conf
hostapd[206]: Could not read interface wlan0 flags: No such device
hostapd[206]: Could not read interface wlan0 flags: No such device
hostapd[206]: nl80211 driver initialization failed.

And here is my unit:

[Unit]
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Wants=network.target
Before=network.target
Before=network.service

[Service]
Type=forking
PIDFile=/run/hostapd.pid
ExecStart=/usr/bin/hostapd /etc/hostapd/hostapd.conf -P /run/hostapd.pid -B

[Install]
WantedBy=multi-user.target

Please assist me to add required dependency for hostapd unit so it would not start before wlan0 device populates in the system. I think I know that udev populates devices, but I don't know how to add such dependency.
Also I'm interesting if the same could happen with my "network.service" which should switch the state of eth devices...

Offline

#2 2012-12-18 11:10:59

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,110
Website

Re: Systemd starts hostapd before populating wlan0 device

If you want to order on a network device, you can use the below requirements:

After=sys-subsystem-net-devices-wlan0.device
BindsTo=sys-subsystem-net-devices-wlan0.device

Offline

#3 2012-12-18 11:21:36

Thump
Member
Registered: 2012-12-08
Posts: 12

Re: Systemd starts hostapd before populating wlan0 device

Thank you, falconindy.
I will add similar lines to my network units. I hope I'll never get failures anymore.
Systemd is a complex thing!

Offline

Board footer

Powered by FluxBB