12

I have two RasPi3, both on the newest Jessie and updated && upgraded. The problem is that both Pis can see networks but are not connecting to them.

sudo iwlist wlan0 scan

Gives me multiple networks including the one I want to connect to. Typing in the credentials and authentication into the wpa_supplicant.conf file doesn't work. Then I installed xrdp on the Pis to see if a connection over that is possible. Again I see available networks including the one I want to connect to. I click it, type in the requested key and nothing happens. Afterwards a mouseover on the networks button in the upper right corner shows "wlan0 not associated".

sudo ifup wlan0

tells me that the wlan0 interface is already configured. Makes sense. The newest firmware for the WiFi chip on the board is installed.

When I set the Pis up, they connected without any problems. Even to the same network as they should now. Nothing changed in the meantime.

What can I try?

EDIT: Just tested to connect to my phone using the mobile hotspot. No problem at all...It gets confusing.

BallerNacken
  • 343
  • 1
  • 4
  • 13
  • Have you tried (shock! horror!) the Foundation Guidelines https://www.raspberrypi.org/documentation/configuration/wireless/README.md – Milliways Jul 08 '16 at 10:17
  • 2
    They are useless as they tell me what I just described and I can't use `wpa_gui` anymore in the new raspbian jessie releases. – BallerNacken Jul 08 '16 at 10:42
  • 2
    Then there is always [the dark side](http://raspberrypi.stackexchange.com/questions/37594/how-can-i-disable-autoconfigured-networking-on-raspbian). Presuming you have a correct `wpa_supplicant.conf`, it actually only takes two or three commands to manually connect, -- `ip link set wlan0 up` (maybe superfluous), `wpa_supplicant ...`, and `dhclient...`. This may make it easier to figure out what's wrong, *but first you have to disable autoconfiguration, dhcpcd, etc.*. – goldilocks Jul 08 '16 at 12:25
  • Okay that has to wait until Wednesday. But thanks I will try all that. – BallerNacken Jul 08 '16 at 15:04
  • Did you ever got it working? – clankill3r Dec 14 '16 at 18:17
  • 1
    Yes by using a WiFi dongle instead of the onboard WiFi. Disabled the onboard WiFi using a blacklist. Works perfectly fine. But couldn't find the reason why it was not working normally. – BallerNacken Dec 16 '16 at 10:55
  • 1
    @goldilocks answer works like a charm on my Pi3. `ip link set wlan0 up`. – IgorGanapolsky Dec 18 '16 at 23:55

1 Answers1

7

To work withwpa_supplicant on some routers and networks can be pretty tricky and hard to diagnose. Using the following method I have a 100% success rate.
First to confirm your network is available and visible try (just the SSID is enough):

  iwlist wlan0 scan | grep SSID

Then create a network credential entry for supplicant with:

wpa_passphrase "<ssid>" "<password>" >> /etc/wpa_supplicant/wpa_supplicant.conf

Note ssid (and password) are case sensitive.

This will create a 64 char PSK as follows:

network={
        ssid="ssid"
        #psk="password"
        psk=44116ea881531996d8a23af58b376d70f196057429c258f529577a26e727ec1b
}

You may edit your .conf to remove (or '#' comment) the replaced network.

This network definition will be enough to associate/register. You don't need the usual parameters like:

proto=WPA WPA2
pairwise=CCMP TKIP
group=CCMP TKIP
key_mgmt=WPA-PSK WPA-EAP

If this is not working, you can debug it running supplicant in debug mode, be a fast reader or use ^S/^Q on your console to pause it:

wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B -D

If wpa_supplicant is running on wlan0 you will receive the message:

Successfully initialized wpa_supplicant
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface 'DIR=/var/run/wpa_supplicant GROUP=netdev'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

Just kill the running version, in this example is process '651' (second column, after 'root'):

> ps aux | grep supplicant
root       651  0.0  0.7   7244  3516 ?        Ss   15:20   0:00 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
root      1651  0.0  0.4   4272  1844 pts/0    S+   16:35   0:00 /bin/grep --color supplicant
> kill 651

and try again.

fcm
  • 1,789
  • 2
  • 16
  • 30
  • Hello, first I tried with WEP network, so in my /etc/wpa_supplicant/wpa_supplicant.conf file there was old WEP setting (even I rebooted RP3). I deleted old one, and it worked. – tanaydin Mar 11 '17 at 11:15
  • you saved my life trying to fix this from few days, thank you! – Teodor Mar 22 '19 at 16:17