LONG STORY SHORT: this should not be necessary. use a fresh version of raspbian, and use sudo-raspi config to set wifi country, wifi name and password. If it doesn't work, check your router for uncommon settings. If it doesn't work for your 5ghz wifi, try it on 2.4ghz. If it still doesn't work, GIVE UP. This is a rabbit hole that will eat up a lot of time.
If you router encryption is set to AES
then set the encryption on the RPi to CCMP
Code: Select all
I thought the post I quoted worked, and it did once, but after reboot nothing worked again. I spent another 5 hours trying to diagnose this issue, learned a lot, but ultimately gave up. My freshly installed and upgraded Pi 3 B+ just refuses to connect to my 5ghz wifi. The strange part is it connects successfully to the 5ghz hotspot on my phone (perhaps it's 5ghz N standard instead of ac?)
I have no idea why it worked that ONE TIME previously. But now it works completely fine for the 2.4ghz. So, I conclude there is a bug or crappy wifi hardware on the Pi, or some setting the pi doesn't like on my almost-default mikrotik router. It should work, but doesn't.
THE WIFI SHOULD WORK JUST BY USING sudo raspi-config AND SETTING THE WIFI COUNTRY AND SSID/PASSWORD. The result of this command should be a /etc/wpa_supplicant/wpa_supplicant.conf with the default two lines of ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev, update_config=1, and additionally the country key, and the network object with ONLY ssid and psk keys.
Contrary to the post I quoted, the explicit keys mentioned (key_mgmt, proto...) should be unnecessary, because the default settings have multiple common options chosen. This is seen on the official (?) website https://w1.fi/cgit/hostap/plain/wpa_sup ... icant.conf
from the site: # If not set, key_mgmt defaults to: WPA-PSK WPA-EAP
# If not set, proto defaults to: WPA RSN
# If not set, pairwise defaults to: CCMP TKIP
# If not set, auth_alg is OPEN, additionally LEAP is enabled if it is allowed as one of the EAP methods
HELPFUL COMMANDS FOR DIAGNOSIS:
sudo iwlist wlan0 scan , this should list all wifi signals within range. if this doesn't work, you have some other problem. I recommend a fresh version of raspbian. If it works but doesn't return your wifi, and you're sure it's not hidden, then somethine else is wrong. I had to set my 5ghz channels to "automatic" in order to get my 5ghz wifi to show up, which is strange.
If it works and you see your wifi, it also lists which proto, pairwise, and auth_alg it uses, so you can be sure. This is a good first step.
For restarting your wifi: ip link set wlan0 down and ip link set wlan0 up
For killing old wpa_supplicant daemons: sudo killall wpa_supplicant
For removing old wpa_supplicant files: sudo rm /var/run/wpa_supplicant/wlan0
For starting new wpa_supplicant daemons: sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf . This should not return any errors. After you're sure it started OK, put it in the background with Ctrl+z and the command "bg".
Also some people mention the command: sudo rfkill unblock wifi