Straight forward wifi client to infra AP connectivity from debian by using wpa_supplicant
wpa_cli -iwlan0 add_network 1 wpa_cli -iwlan0 set_network 1 ssid '"myssid"' OK wpa_cli -iwlan0 set_network 1 psk '"mypwd"' OK wpa_cli -iwlan0 enable_network 1
As result "Association request to the driver failed" in syslog strange entries
nl80211: MLME connect failed: ret=-1 (Operation not permitted)
wlan0: Association request to the driver failed
SSID and PSK are correct obviously. Tearing my hairs out - what is the problem? The same problem with any other ssid.
brcmfmac: brcmf_c_set_joinpref_default: Set join_pref error (-1) brcmfmac: brcmf_cfg80211_connect: BRCMF_C_SET_SSID failed (-1)
Ideas? Direction? Where to look?
UPDATE: the issue was solved It is related to interesting side effect of driver initialization optimization. I have one physical wireless adapter with two virtual interfaces: client (managed) and hotspot (access point). The correct order of load is AP and then Managed (this is another issue, not sure where it comes from). When both interfaces are brought up at the same time or close enough one to another, later interface tries to reuse already loaded instance of device driver, which is obviously impossible (and this is where "Operation not permitted" comes from), so wpa_supplicant is not being initialized properly.
The solution is make AP to be loaded automatically at early stage, while leave Managed to manual mode. Then modify rc.local (or any other late running trigger) to enable Managed interface. For me (sleep 20 || sudo ifup wlan1) & works perfectly, so problem is solved.
Having said that, i think that it is required to open ticket for Debian to fix this issue, since, it is clearly OS bug.