Maros Hluska

Back

Raspberry Pi SSH wpa_supplicant.conf Fix

Tweet

Raspberry Pi 2 Model B

After a power outage, I was suddenly not able to SSH into my Raspberry Pi. It's a Raspberry Pi 2 model B with Raspbian Stretch Lite (2017-08-16).

So I did a fresh install, added a wpa_supplicant.conf file an an empty ssh file to the /boot directory of the SD card as usual but it was still not connecting to my router.

I followed this guide to connect my Mac directly to the Raspberry Pi using ethernet cable. Essentially, I had to enable network sharing on the Mac, use ifconfig to find my IP address, use nmap -n -sP 192.168.2.1/24 to find the Raspberry Pi's IP then SSH in as normal: ssh pi@<ip address> (default password raspberry).

Then, this recent post on the Raspberry Pi forum helped. Running sudo journalctl revealed that things were misconfigured:

Aug 16 01:22:14 raspberrypi dhcpcd-run-hooks[394]: wlx74da380f9771: ctrl_interface not defined in /etc/wpa_supplicant/wpa_supplicant.conf
Aug 16 01:22:14 raspberrypi dhcpcd[363]: wlx74da380f9771: not interacting with wpa_supplicant(8)

Long story short, it's possible that a recent update to Raspbian Stretch Lite requires a new wpa_supplicant.conf format that looks like this:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid=<ssid>
    psk=<psk>
}

Note: The <psk> section is no longer the actual WiFi password. I had to generate the network portion of the config using a command: $ wpa_passphrase <ssid> <psk> and manually prepend the first three lines for the Raspberry Pi to auto-connect to my WiFi.