12

I am running 4.9.13-4-ARCH #1 SMP Sat Mar 11 14:16:01 MST 2017 armv7l GNU/Linux and I am using systemd-networkd for the network in conjunction with wpa_supplicant, obviously.

Running wpa_cli -i wlan0:

wpa_cli v2.6
Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license. See README for more details.

Interactive mode

Could not connect to wpa_supplicant: wlan0 - re-trying

Running strace wpa_cli -i wlan0

Suspicious Lines

bind(3, {sa_family=AF_UNIX, sun_path="/tmp/wpa_ctrl_485-2"}, 110) = 0
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/wpa_supplicant/wlan0"}, 110) = -1 ENOENT (No such file or directory)
close(3)
Jonathan Komar
  • 512
  • 2
  • 5
  • 15

1 Answers1

13

You have to specify explicitly the location of the control interface in the /etc/wpa_supplicant/wpa_supplicant-wlan0.conf file.

ctrl_interface=/run/wpa_supplicant
update_config=1

This adds a wpa_supplicant directory in two volatile directories:

  1. /run
  2. /var/run.

For a description of /run and /var/run, see https://unix.stackexchange.com/a/175349/33386. Don't forget to run wpa_cli as root or add ctrl_interface_group to allow users of that group to call wpa_cli.

ctrl_interface=/run/wpa_supplicant # set location of the control socket 
ctrl_interface_group=admin # group admin can use wpa_cli
update_config=1 # allows saving changes to file that are made in cli

Apparently the default location is not set to the actual location. (/var/run/wpa_supplicant) You need to set it manually in Arch Linux and perhaps others.


Notes

The GROUP=netadmin parameter does not work on Arch Linux as on other distributions (or older versions?). If you use this, it will be included in the path of the ctrl_interface because it gobbles up spaces.

Jonathan Komar
  • 512
  • 2
  • 5
  • 15
  • Just to reaffirm. You must include the ctrl_interface directive, which has the effect of wpa_supplicant spawning sockets which will receive connections. Telling wpa_cli the right socket path, is insufficient by itself – cdosborn Oct 15 '19 at 16:48
  • that is included in my startup and I'm still getting the same error. Nothing was created in /run or /var/run and no noticeable errors were produced – Scott Wood Aug 06 '21 at 20:16