ConnectingMedia
Posts: 4
Joined: Fri Dec 07, 2018 2:29 pm

How is the wpa_supplicant daemon started?

Fri Dec 07, 2018 2:54 pm

Hello everyone!

I'm currently building my custom Debian image for my Raspi 3B+'s. I'm doing that because I need a 64-bit OS for various reasons (MongoDB 4.0 for example). Luckily I found the great project https://github.com/drtyhlpr/rpi23-gen-image, which makes making such an image child's play.

Now onto the harder part.

I'm trying to get the WiFi working with the custom OS. I already have the package wpa_supplicant installed and copied the config.
However when using for example wpa_cli it complains that wpa_supplicant is not running. So I enabled the service, but that didn't change a thing. Comparing with the Raspbian machine I still have running, I noticed that their service isn't even enabled (Also the WiFi connection is not getting established on my custom system). I know it has to do with the daemon not starting, because when I run "wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf" it connects flawlessly and I can connect over WiFi.

So how exactly do I get to autostart the wpa_supplicant daemon on my custom Debian system? Preferably I'd like to use the same or a similar system to that on the offical Raspbian.

ConnectingMedia
Posts: 4
Joined: Fri Dec 07, 2018 2:29 pm

Re: How is the wpa_supplicant daemon started?

Fri Dec 07, 2018 4:16 pm

So I found the file /usr/share/dhcpcd/hooks/10-wpa_supplicant (and two others seemingly unrelated files in that dir)

Checking that script and checking htop, I am certain that script is what's being called to start the daemon on Raspbian.
Hower on my system the file seemingly doesn't get called, which means there must be more to it.

Any pointers are much aprechiated.

ConnectingMedia
Posts: 4
Joined: Fri Dec 07, 2018 2:29 pm

Re: How is the wpa_supplicant daemon started?

Fri Dec 07, 2018 4:37 pm

Ok. It turns out I was missing the package dhcpcd5. But after installing it and copying the config from Raspbian, it still doesn't work.

That's my dhcpcd log:

Code: Select all

Dez 07 16:40:26 CM-RASPI-1 systemd[1]: Starting LSB: IPv4 DHCP client with IPv4LL support...
Dez 07 16:40:26 CM-RASPI-1 dhcpcd[884]: DUID XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
Dez 07 16:40:26 CM-RASPI-1 dhcpcd[884]: eth0: IAID XX:XX:XX:XX
Dez 07 16:40:26 CM-RASPI-1 dhcpcd[884]: wlan0: waiting for carrier
Dez 07 16:40:26 CM-RASPI-1 dhcpcd[890]: DUID XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
Dez 07 16:40:26 CM-RASPI-1 dhcpcd[890]: eth0: IAID XX:XX:XX:XX
Dez 07 16:40:26 CM-RASPI-1 dhcpcd[890]: wlan0: waiting for carrier
Dez 07 16:40:27 CM-RASPI-1 dhcpcd[884]: eth0: soliciting an IPv6 router
Dez 07 16:40:27 CM-RASPI-1 dhcpcd[890]: eth0: soliciting an IPv6 router
Dez 07 16:40:27 CM-RASPI-1 dhcpcd[884]: eth0: soliciting a DHCP lease
Dez 07 16:40:27 CM-RASPI-1 dhcpcd[890]: eth0: soliciting a DHCP lease
Dez 07 16:40:32 CM-RASPI-1 dhcpcd[884]: eth0: using IPv4LL address XX.XX.XX.XX
Dez 07 16:40:32 CM-RASPI-1 dhcpcd[884]: eth0: adding route to XX.XX.XX.XX/XX
Dez 07 16:40:32 CM-RASPI-1 dhcpcd[884]: eth0: adding default route
Dez 07 16:40:32 CM-RASPI-1 dhcpcd[890]: eth0: using IPv4LL address XX.XX.XX.XX
Dez 07 16:40:32 CM-RASPI-1 dhcpcd[890]: eth0: adding route to XX.XX.XX.XX/XX
Dez 07 16:40:32 CM-RASPI-1 dhcpcd[890]: eth0: adding default route
Dez 07 16:40:32 CM-RASPI-1 dhcpcd[884]: forked to background, child pid 917
Dez 07 16:40:32 CM-RASPI-1 dhcpcd[890]: forked to background, child pid 917
Dez 07 16:40:32 CM-RASPI-1 systemd[1]: Started LSB: IPv4 DHCP client with IPv4LL support.
Dez 07 16:40:39 CM-RASPI-1 dhcpcd[917]: eth0: no IPv6 Routers available

lbog
Posts: 185
Joined: Sun Mar 06, 2016 9:44 am

Re: How is the wpa_supplicant daemon started?

Sat Dec 08, 2018 4:09 pm

ConnectingMedia wrote:
Fri Dec 07, 2018 4:37 pm
Ok. It turns out I was missing the package dhcpcd5. But after installing it and copying the config from Raspbian, it still doesn't work.
You could start the wpa_supplicant daemon with a service-unit:

Code: Select all

[Unit]
Description=WPA supplicant daemon (interface- and nl80211 driver-specific version)
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
Before=network.target
Wants=network.target

# NetworkManager users will probably want the dbus version instead.

[Service]
Type=simple
ExecStart=/usr/local/sbin//wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-nl80211-%I.conf -Dnl80211 -i%I

[Install]
Alias=multi-user.target.wants/wpa_supplicant-nl80211@%i.service
or

Code: Select all

[Unit]
Description=WPA supplicant
Before=network.target
Wants=network.target

[Service]
Type=dbus
BusName=fi.w1.wpa_supplicant1
ExecStart=/usr/local/sbin//wpa_supplicant -u

[Install]
WantedBy=multi-user.target
Alias=dbus-fi.w1.wpa_supplicant1.service

walterav1984
Posts: 4
Joined: Tue Feb 14, 2017 8:31 am

Re: How is the wpa_supplicant daemon started?

Tue Dec 11, 2018 6:45 pm

To mimick the Raspbian way of configuration on x86 native Debian (fat boot partition with ssh/wpasupplicant text files) I managed to get wpa_supplicant to behave the same, and remember I was having the same hair pulling issues to get this to work!

This rf.sh script contains the steps to let wpa_supplicant/dhcpcd interact the right way on boot. Don't ask me how I did it but I got it to work. Look at the "autonetconf" function 2nd line, this symlink is probably the reason why it started to work. Tested it with multiple external wifi adapters, without the need to setup them first in /etc/network/interface because of the DHCPCDv5 when using dynamic ip leases.

ConnectingMedia
Posts: 4
Joined: Fri Dec 07, 2018 2:29 pm

Re: How is the wpa_supplicant daemon started?

Thu Dec 13, 2018 8:12 am

walterav1984 wrote:
Tue Dec 11, 2018 6:45 pm
Look at the "autonetconf" function 2nd line, this symlink is probably the reason why it started to work.
Hi,

thank you so much! This is exactly what was missing!
Working flawlessly now.



I think this topic can be closed then.

Return to “Advanced users”