User Tools

Site Tools


doc:appunti:hardware:raspberrypi_wpa_supplicant_problem

This is an old revision of the document!


Rapsberry Pi problem: dhcpcd not starting wpa_supplicant

I got a problem with a Realtek RTL8188EUS UBS WiFi dongle, into a Raspberry Pi Model A+, running Rasbpian 2017-11-29 Stretch Lite (based on Debian 9.1).

The new method used by Raspbian to configure the network interfaces involves dhcpcd, so the /etc/network/interfaces should be almost empty, with just the following:

source-directory /etc/network/interfaces.d

There are no allow-hotplug or auto sections anymore; everything should be managed by dhcpcd, even the start of wpa_supplicant. Which indeed was failing.

First of all I added some debug to dhcpcd: just adding the option -d to the dhcpcd ExecStart into /etc/systemd/system/dhcpcd.service.d/wait.conf. After executing systemctl daemon-reload and a reboot, this was the log:

daemon.debug dhcpcd[772]: dhcpcd-6.11.5 starting
daemon.debug dhcpcd[772]: udev: starting
daemon.info dhcpcd[772]: dev: loaded udev
daemon.debug dhcpcd[772]: wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
daemon.debug dhcpcd[772]: wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER
daemon.info dhcpcd[772]: wlan0: waiting for carrier
daemon.err dhcpcd[772]: timed out
daemon.debug dhcpcd[772]: forking to background

So no wpa_supplicant was fired, the wlan0 interface does not sense the carrier and dhcpcd refuses to configure it. It seems that dhcpcd does not aknowledge that it is a WiFi adapter, so we have to force it. Just add an interface section into /etc/dhcpcd.conf:

interface wlan0
env ifwireless=1
env wpa_supplicant_driver=nl80211,wext

the driver specification is required, otherwise wpa_supplicant will die with the error message

nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
wlan0: Failed to initialize driver interface

After a reboot everything worked as expected, which is confirmed by the wpa_supplicant process running:

wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211,wext

Notice that the configuration file used is /etc/wpa_supplicant/wpa_supplicant.conf, but if one named wpa_supplicant-wlan0.conf exists, it will be preferred.

Alternative: wpa_supplicant started by systemd

The default is to start wpa_supplicant via dhcpcd, as seen above. But if you want, you can force systemd to start the service independently.

You have to start the service against the specific interface name wlan0, so make the following:

cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
systemctl enable wpa_supplicant@wlan0.service

Web References

doc/appunti/hardware/raspberrypi_wpa_supplicant_problem.1518859035.txt.gz · Last modified: 2018/02/17 10:17 by niccolo