donvukovic
Posts: 13
Joined: Fri May 24, 2013 1:50 pm

Problems with Headless operation

Mon Apr 15, 2019 10:23 pm

I am using a Win7 laptop (Dell Latitude) to write an SD card.
I found online that adding the wps_supplicant.conf file would allow for headless operation.
Today I discover that the wps_supplicant.conf is somehow corrupted and will not allow wifi to be enabled.
I wrote an SD card without the wps_supplicant.conf file, then with a keyboard and screen I ran sudo raspi-config.
I added my ssid/psk and turned on SSH.
After rebooting I can now have wifi and I can ssh into the pi.

I am using Notepad++, with Unix(lf) and UTF-8.

The wpa_supplicant.conf file is as follows:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
ssid="MySSID"
psk="MyPassWord"
key_mgnt=WPA-PSK
}

When I copy this file to the SD card with Win7, reboot the pi 0w, the wifi does not work and
running sudo raspi-config states "could not communicate with wpa_supplicant".

What does this error mean and how can I fix it.

Thank You all.

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

Re: Problems with Headless operation

Mon Apr 15, 2019 10:43 pm

It’s possible the file you created on the PC has both a carriage return and line feed at the end of each line.

It’s best to use either a MAC or Linux box that handles this or use something like Notepad++ to create the file. I believe (but not tested) that the new version of Notepad (released by MS into the public domain) can finally do this.
Need Pi spray - these things are breeding in my house...

donvukovic
Posts: 13
Joined: Fri May 24, 2013 1:50 pm

Re: Problems with Headless operation

Tue Apr 16, 2019 12:14 am

>> It’s possible the file you created on the PC has both a carriage return and line feed at the end of each line.


No, unless Notpad++ is wrong.


I am using Notepad++, with Unix(lf) and UTF-8.

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

Re: Problems with Headless operation

Tue Apr 16, 2019 12:36 am

Possibly lack of indent on the SSID etc lines between the { and }
Possible auto correct on quotes - a pain on iOS for me!
Need Pi spray - these things are breeding in my house...

donvukovic
Posts: 13
Joined: Fri May 24, 2013 1:50 pm

Re: Problems with Headless operation

Tue Apr 16, 2019 1:21 am

I changed TABS to spaces.
The <CR> 0x0d are not there.

The png attached is the file on the SD card.
Does anyone see anything ?!?
wpa_supplicant.conf.hex.png
wpa_supplicant.conf.hex.png (14.94 KiB) Viewed 507 times

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

Re: Problems with Headless operation

Tue Apr 16, 2019 1:22 am

Sorry i cant provide answers only confirmation of similar experiences.

I too used notepad+ with settings recommended to suppress either a lf or cr,(cant recall specifics) and it too resulted in a similar failure, However connection via a usb/nic provided ssh access and running raspi-config to set up wifi among other attributes was NOT an issue..
Pi-0-W #2 again similar results with a wpa_supplicant.conf file with wifi credentials provided for initial startup in the boot partition.
For #3 i didnt bother trying and simply used the usb.nic for the initial setup connection.

If you dont have access to a usb/nic and the screen/keyboard use is inconvenient and you expect to want to add further headless zeros to your net perhaps its expedient to use the sd copier after the initial config/setup of your next Pi-0 and save an image of a virgin wifi enabled system.

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

Re: Problems with Headless operation

Tue Apr 16, 2019 1:58 am

donvukovic wrote:
Mon Apr 15, 2019 10:23 pm
I found online that adding the wps_supplicant.conf file would allow for headless operation.
It's supposed to be wpa_supplicant.conf (not wps).

donvukovic wrote:
Mon Apr 15, 2019 10:23 pm
I wrote an SD card without the wps_supplicant.conf file, then with a keyboard and screen I ran sudo raspi-config.
I added my ssid/psk and turned on SSH.
After rebooting I can now have wifi and I can ssh into the pi.
Copy the wpa_supplicant.conf file from the working card to your other card.

donvukovic wrote:
Mon Apr 15, 2019 10:23 pm
I am using Notepad++, with Unix(lf) and UTF-8.
Why bother creating another file when you already have a working one?

donvukovic wrote:
Mon Apr 15, 2019 10:23 pm
The wpa_supplicant.conf file is as follows:

Code: Select all

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

network={
		ssid="MySSID"
		psk="MyPassWord"
		key_mgnt=WPA-PSK
}
It looks okay to me, but wpa_supplicant.conf can be very picky about formatting and is easily broken (could be the extra tab character). I suggest you use the one created by the Raspbian GUI.

Which model Raspberry Pi?
Which Raspbian version?
What are you using for a power supply?
Brand and size of SD card?
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?

donvukovic
Posts: 13
Joined: Fri May 24, 2013 1:50 pm

Re: Problems with Headless operation

Tue Apr 16, 2019 2:57 am

Hello HawaiianPi ,

Your suggestion about coping the wps....conf file from a working Pi 0 W SD card to the /root , then moving that file to my W7 PC did the trick.
I can now create a boot-able SD card on my PC and coping that specific file and it boots correctly with my WiFi working.

Using WinMerge.exe to compare my file vs the file created on the Pi 0 W does show they are different, but not what.

I will look at the binaries of each file an see if I can figure out why.

Thank you for the suggestion.
I hope someone most seasoned then me can figure out the real reason.

Don


.

donvukovic
Posts: 13
Joined: Fri May 24, 2013 1:50 pm

Re: Problems with Headless operation

Wed Apr 17, 2019 3:10 pm

Can anyone tell me if there is a way to "fix" the SD Card with this error "Could not communicate with wpa_supplicant" .

I have reformatted this SD Card and added the "good" wps_supplicant.conf file.

But, I would like to know if there is a way to "fix" this SD Card without reformatting it.

thanks

Don

jahboater
Posts: 4198
Joined: Wed Feb 04, 2015 6:38 pm

Re: Problems with Headless operation

Wed Apr 17, 2019 3:51 pm

donvukovic wrote:
Wed Apr 17, 2019 3:10 pm
But, I would like to know if there is a way to "fix" this SD Card without reformatting it.
If you are using etcher with a ".img" file then you do not have to format the SD card.

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

Re: Problems with Headless operation

Wed Apr 17, 2019 5:06 pm

donvukovic wrote:
Wed Apr 17, 2019 3:10 pm
Can anyone tell me if there is a way to "fix" the SD Card with this error "Could not communicate with wpa_supplicant" .

I have reformatted this SD Card and added the "good" wps_supplicant.conf file.
What is this "wps_supplicant.conf file" you keep posting about?
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?

Ernst
Posts: 1111
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Problems with Headless operation

Wed Apr 17, 2019 5:22 pm

donvukovic wrote:
Tue Apr 16, 2019 1:21 am
I changed TABS to spaces.
The <CR> 0x0d are not there.

The png attached is the file on the SD card.
Does anyone see anything ?!?

wpa_supplicant.conf.hex.png
Yes, I do see that the name is wrong, the correct name of the file is: "wpa_supplicant.conf" (not "wpa_supplicant2.conf")

The other problem I see is that you have misspelled key management, key_mgnt is wrong and must be key_mgmt.
see what I copied from one of your previous posts:

Code: Select all

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

network={
ssid="MySSID"
psk="MyPassWord"
key_mgnt=WPA-PSK <=== !! key_mgmt !!
}
I suggest you correct your error, then copy the file with the correct name to the boot (first) partition on your SD card.
After booting this file will have been moved to the right place (/etc/wpa_supplicant/wpa_supplicant.conf) in the root partition,
and WiFi should be working if you specified the correct ssid / password combination (while within reach of the access point).
The road to insanity is paved with static ip addresses

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

Re: Problems with Headless operation

Wed Apr 17, 2019 5:37 pm

Ernst wrote:
Wed Apr 17, 2019 5:22 pm

The other problem I see is that you have misspelled key management, key_mgnt is wrong and must be key_mgmt.

The simpler solution with key_mgmt is to simply remove those lines - they aren't needed as wpa_supplicant can read the setting that's needed from the access point.
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.

donvukovic
Posts: 13
Joined: Fri May 24, 2013 1:50 pm

Re: Problems with Headless operation

Thu Apr 18, 2019 2:49 pm

Re: key_mgnt is wrong and must be key_mgmt.

Well this goes to show .........
This is a copy and paste from some web site somewhere.

Yes, I have tried this file just this morning with just:
network={
ssid="MySSID"
psk="MyPassWord"
}

and it still fails.

The "good" *.conf file is coping the *.conf file from a working SD Card back to my W7 pc.

Ernst
Posts: 1111
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Problems with Headless operation

Thu Apr 18, 2019 4:06 pm

donvukovic wrote:
Thu Apr 18, 2019 2:49 pm
Re: key_mgnt is wrong and must be key_mgmt.

Well this goes to show .........
This is a copy and paste from some web site somewhere.

Yes, I have tried this file just this morning with just:
network={
ssid="MySSID"
psk="MyPassWord"
}

and it still fails.

The "good" *.conf file is coping the *.conf file from a working SD Card back to my W7 pc.
Absolute perfect that it fails, this is intended. See above.
The wpa_supplicant.conf must specify the country, if not then WiFi will not be activated because in some countries the operating frequencies can be illegal if not set and may lead to prosecution.

This what you should have in wpa_supplicant.conf, you can try it with and without the key management line:

Code: Select all

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

network={
    ssid="MySSID"
    psk="MyPassWord"
    key_mgmt=WPA-PSK
}
It will be very useful to connect a monitor and keyboard to the raspberry for testing. After booting login to the Pi and enter the command iwconfig to see the status.

If it still does not work you have to give information to the following questions:
- Do you have administrative access to the access point, if not do you know the administrator of the access point ?
- Is mac filtering active on the access point ?
- What key-management is configured on the access point ? WPA ? WPA2 ? WEP ?
The road to insanity is paved with static ip addresses

fruitoftheloom
Posts: 19563
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Problems with Headless operation

Thu Apr 18, 2019 4:23 pm

Ernst wrote:
Thu Apr 18, 2019 4:06 pm
donvukovic wrote:
Thu Apr 18, 2019 2:49 pm
Re: key_mgnt is wrong and must be key_mgmt.

Well this goes to show .........
This is a copy and paste from some web site somewhere.

Yes, I have tried this file just this morning with just:
network={
ssid="MySSID"
psk="MyPassWord"
}

and it still fails.

The "good" *.conf file is coping the *.conf file from a working SD Card back to my W7 pc.
Absolute perfect that it fails, this is intended. See above.
The wpa_supplicant.conf must specify the country, if not then WiFi will not be activated because in some countries the operating frequencies can be illegal if not set and may lead to prosecution.

This what you should have in wpa_supplicant.conf, you can try it with and without the key management line:

Code: Select all

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

network={
    ssid="MySSID"
    psk="MyPassWord"
    key_mgmt=WPA-PSK
}
It will be very useful to connect a monitor and keyboard to the raspberry for testing. After booting login to the Pi and enter the command iwconfig to see the status.

If it still does not work you have to give information to the following questions:
- Do you have administrative access to the access point, if not do you know the administrator of the access point ?
- Is mac filtering active on the access point ?
- What key-management is configured on the access point ? WPA ? WPA2 ? WEP ?

Please use the Official Help rather than some "this may be right" tutorial:

https://www.raspberrypi.org/documentati ... iguration/

https://www.raspberrypi.org/documentati ... te-access/

https://www.raspberrypi.org/documentation
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

donvukovic
Posts: 13
Joined: Fri May 24, 2013 1:50 pm

Re: Problems with Headless operation

Thu Apr 18, 2019 9:11 pm

Thank You all for making suggestions about this problem.

I have now come full circle and still have the same problem.


The wpa_supplicant.conf file is as I started:

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

network={
ssid="MySSID"
psk="MyPassWord"
key_mgmt=WPA-PSK
}

I have copied and pasted this text into 4 editors and saved these files to the SD Card.
Boot the card on my Raspi 0 W and each time the WiFi fails to connect.

So there is no solution, but I have a working *.conf file I can just copy to my SD Card to get a headless Pi.

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

Re: Problems with Headless operation

Fri Apr 19, 2019 1:28 am

I know this sounds daft but it bit me the other night on one Zero W.

Do you have a keyboard and mouse in the Pi that does not boot?

This Zero W was happy till some point in the last few weeks updates where it stopped joining WiFi till the keyboard and mouse was fitted (I use a wireless set with just one dongle).

This is due the to random number generator (technically entropy part) and has been addressed in the very latest version by adding rng-tools in along the lines of https://www.nico-maas.de/?p=1562

I thought I had done this on all boxes but obviously missed (at least) one :oops:
Need Pi spray - these things are breeding in my house...

donvukovic
Posts: 13
Joined: Fri May 24, 2013 1:50 pm

Re: Problems with Headless operation

Fri Apr 19, 2019 4:01 pm

>>I know this sounds daft but it bit me the other night on one Zero W.
Yes, I have 3 Pi 0 W boards available.

>>Do you have a keyboard and mouse in the Pi that does not boot?
Yes, I have a wireless keyboard/mouse.
I have tried with/without the dongle plugged in.

>>This Zero W was happy till some point in the last few weeks updates where it stopped joining WiFi till the keyboard and mouse was fitted (I use a wireless set with just one dongle).
If you were to google "Could not communicate with wpa_supplicant", you would find that this has been a problem for over 6 years.

>>This is due the to random number generator (technically entropy part) and has been addressed in the very latest version by adding rng-tools in along the lines of https://www.nico-maas.de/?p=1562
OK

>>I thought I had done this on all boxes but obviously missed (at least) one
I do not understand what this means.

Return to “Beginners”