1

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?

1 Answer 1

1

Answering my own question, it seems that the dhcpcd recipe on bitbake put these hooks under /usr/libexec/dhcpcd-hooks.

The solution is to add a bbappend to dhcpcd that runs do_install:append and links the hook to the correct directory.

Example here: https://github.com/retpolanne/raspberry-pi-image-ansible/commit/61e57e9a2329d23e6d3e593e27ae593185e0f734

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.