Context
I'm currently trying to bake a yocto image for the Raspberry Pi 3B and I want it to connect automatically to Wifi.
This is the repo: https://github.com/retpolanne/raspberry-pi-image-ansible
For configuring wpa_supplicant, I created this .bbappend for wpa_supplicant and it successfully adds my wpa config to /etc/wpa_supplicant.conf. https://github.com/retpolanne/raspberry-pi-image-ansible/blob/master/rpi-build/recipes-connectivity/wpa-supplicant_2.10.bbappend
My /etc/wpa_supplicant.conf looks like this:
ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 update_config=1 country=BR network={ ssid="myssid" psk=mypsk } My build also bakes dhcpcd.
Issue
As far as I understand, dhcpcd should start up wpa_supplicant via a hook. This doc here tells me that, in order to make dhcpcd automatically start wpa_supplicant, I need to ln -s /usr/share/dhcpcd/hooks/10-wpa_supplicant /usr/lib/dhcpcd/dhcpcd-hooks/. The 10-wpa_supplicant file exists, however the /usr/lib/dhcpcd/dhcpcd-hooks doesn't. I tried creating it but wpa_supplicant still doesn't start.
wpa_supplicant systemd service is disabled by default, but if I enable it it get started but not by dhcpcd.
More context
I found that the dhcpcd-run-hooks script is located at /usr/libexec/dhcpcd-run-hooks for some reason and it has these hook addresses:
# We source each script into this one so that scripts run earlier can # remove variables from the environment so later scripts don't see them. # Thus, the user can create their dhcpcd.enter/exit-hook script to configure # /etc/resolv.conf how they want and stop the system scripts ever updating it. for hook in \ /etc/dhcpcd.enter-hook \ /usr/libexec/dhcpcd-hooks/* \ /etc/dhcpcd.exit-hook do Linking to the libexec directory:
ln -s /usr/share/dhcpcd/hooks/10-wpa_supplicant /usr/libexec/dhcpcd-hooks/ Aaaand wpa_supplicant started!
TL;DR
How do I make wpa_supplicant be started by dhcpcd through systemd?