Home > Uncategorized > How to make wpa_cli talk to wpa_supplicant in Ubuntu

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:

/usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service

and pass the -O option to wpa_supplicant by replacing the

Exec=/sbin/wpa_supplicant -u -s

line with

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:

/usr/share/dbus-1/system-services/fi.w1.wpa_supplicant1.service

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.

Categories: Uncategorized Tags:
  1. j
    May 22nd, 2012 at 08:48 | #1

    Tried this with Sabayon but unfortunately made no difference :/

  2. Kees Bergwerf
    July 17th, 2012 at 16:40 | #2

    Thanks for pointing that out. It did not work for me but you pointed me into the right direction.
    I don’t know if it is a good idea to change that script. It might be overwritten by an update. So I looked into the wpa_supplicant config doc http://linux.die.net/man/8/wpa_supplicant and there it was:

    -C ctrl_inter-C ctrl_interface
    Path to ctrl_interface socket (Per interface. Only used if -c is not).

    and you can put that in wpa_supplicant.conf:

    ctrl_interface=/var/run/wpa_supplicant

    That made it work!

    (I run the wpa_gui as root, using Gentoo linux)

    –Kees

  3. icegood
    July 23rd, 2012 at 08:53 | #3

    not valid anymore since at least 12.04.
    There already -O option present by default while wpa_cli still return that error

  4. tiamat
    November 22nd, 2012 at 21:25 | #4

    the version of wpa_supplicant installed on my system does not seem to support the “-O” flag
    wpa_supplicant v0.6.10

    is it possible I need to get an updated version to use this work around?

  5. Guilherme Torres Castro
    August 12th, 2013 at 22:03 | #5

    On fedora 18 i have to make the change on etc/sysconfig/wpa_supplicant

  1. November 23rd, 2012 at 00:32 | #1