How to make wpa_cli talk to wpa_supplicant in Ubuntu
On a stock Ubuntu 11.04 distribution, wpa_cli can not talk to wpa_supplicant. Regardless of the options used, wpa_cli will always report:
Could not connect to wpa_supplicant - re-trying
That’s because wpa_cli expects to talk to wpa_supplicant over a control socket, but the default wpa_supplicant command line options don’t create a control socket (only the D-Bus interface is activated).
The fix is fairly easy. Modify the following file:
and pass the -O option to wpa_supplicant by replacing the
Exec=/sbin/wpa_supplicant -u -s
Exec=/sbin/wpa_supplicant -u -s -O /var/run/wpa_supplicant
Notice, that’s a capital-o, not a zero in the command line.
Restart the supplicant with:
sudo killall wpa_supplicant and run
ps auxww | grep wpa_supplicant to verify that the new options are being used.
If you notice that your changes are ignored, try making the same changes to:
You should now be able to run wpa_cli without any command line options (or with
wpa_cli -p /var/run/wpa_supplicant) and talk to wpa_supplicant.