flamner
Posts: 4
Joined: Wed Oct 03, 2018 6:22 am

raspbian stretch lite wpa_supplicant.conf

Wed Oct 03, 2018 6:31 am

not working... Hi I tried to setup wifi connection on my pi zero W, I don't have wired keyboard, so the only way is ti prepare wpa_supplicant.conf and ssh file and put it on sd card. I did it on raspbian jessie and it worked like a charm, but now it's not. After boot raspbian delete those files, and wifi not work. Any solutions?? :(

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

Re: raspbian stretch lite wpa_supplicant.conf

Thu Oct 04, 2018 2:26 pm

What does your wpa_supplicant.conf file look like?

flamner
Posts: 4
Joined: Wed Oct 03, 2018 6:22 am

Re: raspbian stretch lite wpa_supplicant.conf

Sat Oct 06, 2018 5:30 am

Code: Select all

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

network={
    ssid="NAME"
    scan_ssid=1
    psk="PASSWD"
    key_mgmt=WPA-PSK
}

flamner
Posts: 4
Joined: Wed Oct 03, 2018 6:22 am

Re: raspbian stretch lite wpa_supplicant.conf

Sat Oct 06, 2018 11:19 am

In raspbian jessie lite everything works fine

DirkS
Posts: 9956
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: raspbian stretch lite wpa_supplicant.conf

Sat Oct 06, 2018 12:14 pm

flamner wrote:
Sat Oct 06, 2018 11:19 am
In raspbian jessie lite everything works fine
How did you verify that it is not working in Stretch?

dgordon42
Posts: 764
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: raspbian stretch lite wpa_supplicant.conf

Sat Oct 06, 2018 4:36 pm

flamner wrote:
Sat Oct 06, 2018 5:30 am

Code: Select all

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

network={
    ssid="NAME"
    scan_ssid=1
    psk="PASSWD"
    key_mgmt=WPA-PSK
}
Try it without the "scan_ssid=1" line.

Hope this helps,
Dave.

User avatar
DougieLawson
Posts: 36302
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: raspbian stretch lite wpa_supplicant.conf

Sat Oct 06, 2018 5:59 pm

You need the scan_ssid=1 line if the AP hides its SSID. It shouldn't have any effect on a visible network.

Does the AP use WPA/WPA2 or some other WiFi security like WEP?
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

flamner
Posts: 4
Joined: Wed Oct 03, 2018 6:22 am

Re: raspbian stretch lite wpa_supplicant.conf

Mon Oct 08, 2018 4:24 am

DirkS wrote:
Sat Oct 06, 2018 12:14 pm
flamner wrote:
Sat Oct 06, 2018 11:19 am
In raspbian jessie lite everything works fine
How did you verify that it is not working in Stretch?
I tried the same wpa_supplicant.conf file on jessie and stretch.
DougieLawson wrote:
Sat Oct 06, 2018 5:59 pm
You need the scan_ssid=1 line if the AP hides its SSID. It shouldn't have any effect on a visible network.

Does the AP use WPA/WPA2 or some other WiFi security like WEP?
WPA-PSK/WPA2-PSK

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

Re: raspbian stretch lite wpa_supplicant.conf

Mon Oct 08, 2018 7:48 am

I see nothing wrong with that wpa_supplicant.conf file (other than you shouldn't be hiding your SSID). In fact, I copied and pasted it into Notepad, added my network info, saved it to a freshly imaged Raspbian Stretch micro SD card, and booted it in my Pi Zero W. It works as expected.

Generally problems like this are in the formatting or encoding of the file. Things like hidden control characters or curly quotes, which are sometimes introduced by the editor used, will invalidate the file. However, you say it works in Jessie, so... ¯\_(ツ)_/¯

Try this Raspbian Lite image I have pre-configured for USB Gadget mode.
2018-06-27-raspbian-stretch-lite_Pi0-USB.zip
SHA-256: fb92d04adfca58b61ecbaedc4d748947ddb3c4121321f64cc3d49f75d296266e

Use Etcher to write it to your card and copy your wpa_supplicant.conf file to the FAT32 "boot" partition.

Unplug your power supply from the Pi Zero W and connect a normal micro USB data cable to the data port on your Pi Zero W (leave nothing connected to the power port). Insert the micro SD card and plug the other end of the micro USB cable into a USB port on your main (Windows/Mac/linux) PC.

The Pi Zero W will start to boot and after a minute or two a new USB Ethernet/RNDIS Gadget network adapter will get installed.

If you have a MacOS or Linux PC you should then be able to SSH into [email protected] For Windows you will need to install an mDNS/Zeroconf network service, and the simplest way to do that is to install Apple's Bonjour print service (then you'll be able to SSH into [email protected] with Windows).

With fully up to date Windows 10 you can SSH from cmd.exe or Windows Power Shell. Otherwise install and use the PuTTY application.

Once you are logged in to your Pi0W, try the following commands.

Code: Select all

sudo cat /etc/wpa_supplicant/wpa_supplicant.conf

ifconfig

cat /sys/firmware/devicetree/base/model;echo
The first will show you the contents of the wpa_supplicant.conf file (see if that is the same as your file).

The second will show if WLAN0 has a valid IP address (you should be able to SSH into that IP as well).

The third command will display the model and version of your Pi (if it doesn't say it's a Pi Zero W, something is wrong).
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: 6020
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: raspbian stretch lite wpa_supplicant.conf

Mon Oct 08, 2018 9:28 am

Some more commands to help diagnose what's going on:

Code: Select all

rfkill list all
lsmod
wpa_cli -i wlan0 status
wpa_cli -i wlan0 scan && sleep 5
wpa_cli -i wlan0 scan_results
sudo journalctl -b0 -u dhcpcd
pgrep -a wpa_supplicant

macgyverapi
Posts: 2
Joined: Sun Feb 17, 2019 3:22 pm

Re: raspbian stretch lite wpa_supplicant.conf

Sun Feb 17, 2019 3:36 pm

Also Note: you won't be able to connect to 5G networks on the first bootup.

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

Re: raspbian stretch lite wpa_supplicant.conf

Mon Feb 18, 2019 8:04 pm

macgyverapi wrote:
Sun Feb 17, 2019 3:36 pm
Also Note: you won't be able to connect to 5G networks on the first bootup.
The Pi Zero W doesn't support 5GHz (much less 5G, which is a mobile broadband standard), so it won't connect to that on any boot.

The Raspberry Pi 3B+ connects to 5GHz on first boot (or any other boot) with a properly configured wpa_supplicant.conf file.

Not really sure what you were trying to imply... :?
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?

Return to “Troubleshooting”