Propelld
Posts: 4
Joined: Tue Apr 16, 2019 7:47 pm

Unable to reconnect to WiFi/networks via headless Pi0

Tue Apr 16, 2019 8:18 pm

I am currently using a headless Pi0 with a radio HAT for an on-the-go device. I installed everything yesterday and had everything working up until this morning. My process (headless):

1) I flashed an SD card with Raspian Stretch Lite from the official Pi website using Etcher.
2) before inserting the card in to the Pi, I added the empty ssh file and wsp file to the boot folder of the card. I included the details for my home wifi and hotspot.
3) I set up everything else for the device I am building and got everything working. I was connected to my home WiFi just fine.
4) I left the house and the pi did not connect to my phone hotspot. I came home and the pi would not connect to my home network. I could not reach it through ssh on PuTTY or by physically connecting it to my pc (my pc doesn't detect the pi as it did before)
5) my radio HAT has a little OLED screen which can show me the IP address, current network and open networks. I can't see any of these in their respective menus, the pi is not picking up on any networks at all.
6) I have tried rebooting from the OLED screen menu and the Pi also won't reboot.

Any ideas on what could be causing this? Do I need to reflash the card? 😩

Andyroo
Posts: 2042
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Unable to reconnect to WiFi/networks via headless Pi0

Wed Apr 17, 2019 12:23 pm

Welcome to the forum.

I assume the wsp file you mention is wpa_supplicant.conf after auto correct :lol:

It’s possible an error in this file is stopping the network programs from starting up.

Do you have a copy of this you could post here (edit out the SSID and password).
What editor did you use to create this - it does not like CR/LF at the end of lines.

No idea about your reboot - what screen / software are you using for that?
Need Pi spray - these things are breeding in my house...

Propelld
Posts: 4
Joined: Tue Apr 16, 2019 7:47 pm

Re: Unable to reconnect to WiFi/networks via headless Pi0

Wed Apr 17, 2019 4:08 pm

Andyroo wrote:
Wed Apr 17, 2019 12:23 pm
Welcome to the forum.

I assume the wsp file you mention is wpa_supplicant.conf after auto correct :lol:

It’s possible an error in this file is stopping the network programs from starting up.

Do you have a copy of this you could post here (edit out the SSID and password).
What editor did you use to create this - it does not like CR/LF at the end of lines.

No idea about your reboot - what screen / software are you using for that?
Hi there! Yes, I do mean wpa :lol:

This is the formal for my wpa file, which I wrote in notepad ++:

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

network={
ssid="My Home Network Name"
psk="homenetworkpassword"
key_mgmt=WPA-PSK
}
network={
ssid="My Hotspot Name"
psk="hotspotpassword"
key_mgmt=WPA2-PSK
}

Propelld
Posts: 4
Joined: Tue Apr 16, 2019 7:47 pm

Re: Unable to reconnect to WiFi/networks via headless Pi0

Wed Apr 17, 2019 4:17 pm

Andyroo wrote:
Wed Apr 17, 2019 12:23 pm
Welcome to the forum.

I assume the wsp file you mention is wpa_supplicant.conf after auto correct :lol:

It’s possible an error in this file is stopping the network programs from starting up.

Do you have a copy of this you could post here (edit out the SSID and password).
What editor did you use to create this - it does not like CR/LF at the end of lines.

No idea about your reboot - what screen / software are you using for that?
This is the screen/HAT I was talking about: https://www.enhancedradio.com/products/ ... plorer-hat

I tried again with a new card, if I only have my home network there, it works. I wonder if I added my hotspot in the wrong way?

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

Re: Unable to reconnect to WiFi/networks via headless Pi0

Wed Apr 17, 2019 4:22 pm

Get rid of those key_mgmt lines - you don't need them wpa_supplicant can work it out when it tries to connect.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a hippy & doctor free zone.

PhatFil
Posts: 1034
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Unable to reconnect to WiFi/networks via headless Pi0

Wed Apr 17, 2019 4:35 pm

try rebooting both your pi-0-w and your home router/ap..
then perhaps try setting a priority for each network
ie

Code: Select all

network={
    ssid = "wifi_A"
    psk = "passwordOfA"
    priority = 1
}
network={
   ssid = "wifi_B"
   psk = "passwordOfB"
   priority = 2
}
I suspect that with equal priorities it started up when out looking for the last network it attached to
And then on return home it started up looking for the hotspot??

to switch from wifi A to Wifi B

Code: Select all

wpa_cli select_network 1
and to switch from wifi B to wifi A

Code: Select all

wpa_cli select_network 0
from https://raspberrypi.stackexchange.com/q ... k-priority

for a headless pi without cli access i think you may need a button or other input to trigger a script

Propelld
Posts: 4
Joined: Tue Apr 16, 2019 7:47 pm

Re: Unable to reconnect to WiFi/networks via headless Pi0

Thu Apr 18, 2019 1:22 am

Thank you all for your advice, I'll test the suggestions asap. I just tried reconnecting again and no dice. I'm a little new to the Pi. Just wondering, is it safe to take out the SD card and edit the wpa file or will that corrupt it?

Andyroo
Posts: 2042
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Unable to reconnect to WiFi/networks via headless Pi0

Thu Apr 18, 2019 2:17 am

Assuming you can handle the EXT4 format on the card and have an editor that does not put return and line feeds into the line you can edit it fine.

One question - do you have a keyboard or mouse fitted?

I just got caught on a Zero W with this issue as I had not installed the rng-tools or haveged modules :oops: and had to dig my keyboard and mouse dongle out to get it connected and load the module. Not fully with it tonight...
Need Pi spray - these things are breeding in my house...

Return to “Troubleshooting”