johnnyJE
Posts: 21
Joined: Sat Sep 10, 2016 5:09 pm
Location: NYC

Pi 3 B+ WiFi issues: country?

Wed Mar 21, 2018 4:37 am

I am setting up my new Raspberry Pi 3 Model B+ similarly to the 3B before it. I can't seem to get the internal wifi to come on and join a network after booting.

I know from the raspbian release notes that the country needs to be set before wifi will work, and I was able to connect to WiFi by using rasps-config, but not via wpa_supplicant alone.

It is plugged into ethernet on my router so I can ssh in.
I have wpa_supplicant set up, with a country=US directive in there.

For some reason I still get this after booting up:

Code: Select all

pi@raspberrypi:~ $ iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on

eth0      no wireless extensions.
Am I just missing a step where I set that I want wlan0 to come up even though eth0 is connected and has an internet gateway?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6354
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Pi 3 B+ WiFi issues: country?

Wed Mar 21, 2018 6:18 am

If you manually edit wpa_supplicant.conf to set the country, you'll need to run 'sudo rfkill unblock wifi' as well.

johnnyJE
Posts: 21
Joined: Sat Sep 10, 2016 5:09 pm
Location: NYC

Re: Pi 3 B+ WiFi issues: country?

Wed Mar 21, 2018 4:36 pm

ShiftPlusOne wrote:
Wed Mar 21, 2018 6:18 am
If you manually edit wpa_supplicant.conf to set the country, you'll need to run 'sudo rfkill unblock wifi' as well.

The solution was putting the country directive on the first line of wpa_supplicant.conf. I backed out my changes and then used raspi-config to alter the file so I could see if it was making the change and it was. Now I can bake that in to Ansible.

Thanks, I am excited to get to use the speed of this new box. Hopefully I can add more of them as they become more available.

Thus far everything has been very smooth, so great work on this machine and stretch image :) :)

johnnyJE
Posts: 21
Joined: Sat Sep 10, 2016 5:09 pm
Location: NYC

Re: Pi 3 B+ WiFi issues: country?

Thu Mar 29, 2018 2:38 am

So I have been using the pi and trying to get wifi to work from boot. For some reason neither the internal wifi nor the usb 802.11n dongle I have will connect on boot. I have /etc/wpa_supplicant/wpa_supplicant-wlan0.conf set up with no networks and /etc/wpa_supplicant/wpa_supplicant-wlan0.conf set up with my typical networks.

I am ultimately trying to make an access point, but at this point hostapd is failing to start up via systemd on boot. If I run it manually it's all fine.

This is leading me to believe that I haven't configured hot-plug or something related to starting the wireless interfaces. I'm comparing back-to-back with a Pi model 3 and I don't see any differences in configuration in the spots I know to configure.


Running sudo rfkill unblock wifi works for this boot, but as soon as I reboot I am back to no-wifi land. Any ideas?

ifconfig right after boot:

Code: Select all

wlan1     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on

lo        no wireless extensions.

wlan0     unassociated  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency=2.412 GHz  Access Point: Not-Associated
          Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

eth0      no wireless extensions.

output of cat /etc/network/interfaces:

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
output of cat /etc/hostapd/hostapd.conf:

Code: Select all

country_code=US
interface=wlan0
driver=nl80211
ssid=datssid
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=datpsk
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

User avatar
HawaiianPi
Posts: 6675
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Pi 3 B+ WiFi issues: country?

Thu Mar 29, 2018 6:50 am

johnnyJE wrote:
Wed Mar 21, 2018 4:36 pm
The solution was putting the country directive on the first line of wpa_supplicant.conf...
My standard wpa_supplicant.conf file has the country directive on the 3rd line, and it still worked on the 3B+ when I tried it. I just imaged an SD card with the 2018-03-13 Stretch and copied it to the 1st SD card partition. No problem connecting to my network when it booted.

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
	ssid="My network SSID"
	psk="My WPA2 encryption key"
	key_mgmt=WPA-PSK
}
Your problem was likely caused when editing the file (curly quotes, hidden control character, etc.). The wpa_supplicant.conf can be a bit fussy about such things.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups, and where is that annoying music coming from?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6354
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Pi 3 B+ WiFi issues: country?

Thu Mar 29, 2018 9:03 am

The issue is that the check in place looks at wpa_supplicant.conf, but not interface-specific conf files. It may help to just add the country line to the global file.

johnnyJE
Posts: 21
Joined: Sat Sep 10, 2016 5:09 pm
Location: NYC

Re: Pi 3 B+ WiFi issues: country?

Fri Mar 30, 2018 2:05 am

ShiftPlusOne wrote:
Thu Mar 29, 2018 9:03 am
The issue is that the check in place looks at wpa_supplicant.conf, but not interface-specific conf files. It may help to just add the country line to the global file.

This worked :) Thank you for spending time browsing the forums and replying. I would never have found this detail except by trial and error.

Details:
Adding the country code to /etc/wpa_supplicant/wpa_supplicant.conf as the only directive did the trick. I also have /etc/wpa_supplicant/wpa_supplicant-wlan0.conf with no wifi networks and /etc/wpa_supplicant/wpa_supplicant-wlan1.conf with my wifi networks and it all works now. I get hostapd working on wlan0 from boot and I get wlan1 joining my home wifi and all is well.

Daza85
Posts: 3
Joined: Tue Apr 17, 2018 4:33 am

Re: Pi 3 B+ WiFi issues: country?

Tue Apr 17, 2018 5:29 am

Hi i am having a few issues with the location settings as i travel around i have to keep changing the location setting manually. Is there an easier way that the pi can get this detail from the local router? As if i set GB for instance then go to Austria for instance it wont let me connect to local wifi or bins out once i connect until i update the location setting which is a pain. I guess i could put a little script together to start a boot so you have to select your wifi country if it needs changing but that adds another thing to do. Any help would be great or the ability to switch it off.

Thanks

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6354
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Pi 3 B+ WiFi issues: country?

Tue Apr 17, 2018 7:01 am

Daza85 wrote:
Tue Apr 17, 2018 5:29 am
Hi i am having a few issues with the location settings as i travel around i have to keep changing the location setting manually. Is there an easier way that the pi can get this detail from the local router? As if i set GB for instance then go to Austria for instance it wont let me connect to local wifi or bins out once i connect until i update the location setting which is a pain. I guess i could put a little script together to start a boot so you have to select your wifi country if it needs changing but that adds another thing to do. Any help would be great or the ability to switch it off.

Thanks
GB and AT have the same channels enabled, so there shouldn't be any problem there. There's a lot of overlap with other countries, so it would be somewhat unusual to be unable to connect to wifi while travelling. Some routers will also change your regulatory domain when you connect to them as well (temporarily).

regmar
Posts: 6
Joined: Sun Jan 28, 2018 7:54 pm

Re: Pi 3 B+ WiFi issues: country?

Tue Apr 17, 2018 1:58 pm

Can someone explain how to use ifup/ifdown wlan0 with the latest raspian considering that /etc/network/interfaces is not used anymore?

from manpage:

Code: Select all

The  ifup  and  ifdown  commands  may be used to configure (or, respec‐
tively, deconfigure) network interfaces based on interface  definitions
in  the  file  /etc/network/interfaces.  ifquery command may be used to
parse interfaces configuration.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6354
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Pi 3 B+ WiFi issues: country?

Tue Apr 17, 2018 2:09 pm

regmar wrote:
Tue Apr 17, 2018 1:58 pm
Can someone explain how to use ifup/ifdown wlan0 with the latest raspian considering that /etc/network/interfaces is not used anymore?

from manpage:

Code: Select all

The  ifup  and  ifdown  commands  may be used to configure (or, respec‐
tively, deconfigure) network interfaces based on interface  definitions
in  the  file  /etc/network/interfaces.  ifquery command may be used to
parse interfaces configuration.
As you say, /etc/network/interfaces is a part of ifupdown. It doesn't make sense to use ifup/ifdown without it. What is this for exactly?

You could try `ip link set eth0 up/down`, if you just want to bring a link down or up.

regmar
Posts: 6
Joined: Sun Jan 28, 2018 7:54 pm

Re: Pi 3 B+ WiFi issues: country?

Wed Apr 18, 2018 1:41 pm

Thanks, exactly what I need. I have a Pi 3B and for no reasons, Wi-Fi drops regularly. I have a script which periodically checks connectivity and I use ifup/ifdown (still on Jessie) to bring it back up. Just in case, I want to to do the same for the 3B+ and I am going to use ip link command as you suggested.

May I ask what would be the best approach to deactivate wireless Power Management for the 3B+? I currently use "sudo /sbin/iwconfig wlan0 power off" in /etc/rc.local but I guess there is a better way.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6354
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Pi 3 B+ WiFi issues: country?

Wed Apr 18, 2018 4:26 pm

regmar wrote:
Wed Apr 18, 2018 1:41 pm
Thanks, exactly what I need. I have a Pi 3B and for no reasons, Wi-Fi drops regularly. I have a script which periodically checks connectivity and I use ifup/ifdown (still on Jessie) to bring it back up. Just in case, I want to to do the same for the 3B+ and I am going to use ip link command as you suggested.

May I ask what would be the best approach to deactivate wireless Power Management for the 3B+? I currently use "sudo /sbin/iwconfig wlan0 power off" in /etc/rc.local but I guess there is a better way.
As far as I know, power management is off by default, even if iw says otherwise.

You shouldn't need to do anything to get wifi to reconnect, it should just happen. If it doesn't 'wpa_cli -i wlan0 status' may provide a clue as to what's going on. There are also various ways to log what's happening using wpa_cli.

CCMike
Posts: 4
Joined: Thu Mar 29, 2018 2:01 pm

Re: Pi 3 B+ WiFi issues: country?

Thu Apr 19, 2018 2:39 pm

Hi,
I'm working on the configuration for a headless RPi 3 B+ and need to be able to get the WiFi connecting without requiring the user to connect to a terminal to do any manual setup. We had code in place that would supply the SSID and password in wpa_supplicant.conf but this isn't working now. I've tried adding the country code but that isn't enough to get the WiFi to connect. I also tried rfkill unblock wifi. Wlan0 is now up but still not connected! Reboot doesn't work either.
TIA!

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6354
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Pi 3 B+ WiFi issues: country?

Thu Apr 19, 2018 2:54 pm

CCMike wrote:
Thu Apr 19, 2018 2:39 pm
Hi,
I'm working on the configuration for a headless RPi 3 B+ and need to be able to get the WiFi connecting without requiring the user to connect to a terminal to do any manual setup. We had code in place that would supply the SSID and password in wpa_supplicant.conf but this isn't working now. I've tried adding the country code but that isn't enough to get the WiFi to connect. I also tried rfkill unblock wifi. Wlan0 is now up but still not connected! Reboot doesn't work either.
TIA!
What's the output of 'sudo journalctl --no-pager'?

CCMike
Posts: 4
Joined: Thu Mar 29, 2018 2:01 pm

Re: Pi 3 B+ WiFi issues: country?

Thu Apr 19, 2018 7:56 pm

Thanks, that gave me a big hint about what was the issue! It turned out to be a problem with the wpa_supplicant.conf missing a "{". I'm now back online!

leostereo
Posts: 14
Joined: Sun Mar 18, 2018 4:05 pm

Re: Pi 3 B+ WiFi issues: country?

Wed Aug 15, 2018 3:52 pm

"I am ultimately trying to make an access point, but at this point hostapd is failing to start up via systemd on boot. If I run it manually it's all fine."

How do you manually launch hostapd ?
I cant do it ...
Leo

Return to “Troubleshooting”