JacksonJames810
Posts: 1
Joined: Sun Dec 31, 2017 12:13 am

Re: Pi Zero W: Truly headless setup?

Sun Dec 31, 2017 12:20 am

I need help. I just bought my first Pi and it is the Rpi Zero W I am trying to figure out how to make it headless. I have tried several times and it just won't let me connect via PuTTY. It says that the host does not exist. for the wpa_supplicant i wrote:
network={
ssid="MyNetworkName"
psk="PASSWORD"
key_mgmt=WPA-Personal
}
Can someone help me figure out what I am doing wrong.

SurferTim
Posts: 1764
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Pi Zero W: Truly headless setup?

Sun Dec 31, 2017 2:00 am

Put this in wpa_supplicant.conf above the network section. Change the two letter country code to yours.

Code: Select all

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

network={
ssid="MyNetworkName"
psk="PASSWORD"
}

spex357
Posts: 29
Joined: Fri Jan 10, 2014 5:15 pm

Re: Pi Zero W: Truly headless setup?

Tue May 15, 2018 11:18 am

lafalken wrote:
Fri Aug 11, 2017 12:57 pm
Hi!
This is a strange thing. Have anyone really got the Zero W to show up in the net by only adding ssh and the wireless info file?

No, i've tried different image writers, different Raspians, different SDcards, different file editors, even a different font and different indent. Yesterday I tried over twenty video tutorials and everyone failed just as they said the word Putty. Just for the fun of it I've just used putty to access my other headless Pi's
It reminds me of when I was a Talktalk customer and I lost my Internet connection, "can you re-install windows, can you use a different modem, can you use a different cable " in reality the connection was down and no amount of anything would work.

jbudd
Posts: 716
Joined: Mon Dec 16, 2013 10:23 am

Re: Pi Zero W: Truly headless setup?

Wed May 16, 2018 1:03 am

a different font and different indent
Are you using a word processor to write the wpa_supplicant.conf file? You should use a simple text editor such as Notepad++.
Word processors tend to replace double quotes "..." with something like “...”. The second version will mess up the wifi.
Some people say that Windows style line endings CR/LF mess up the file too, though I have not found this to be a problem on my Pi's. Notepad++ has a setting to use Linux line endings (Edit | EOL Conversion).
Yesterday I tried over twenty video tutorials and everyone failed just as they said the word Putty.
How old were they? The requirements for Raspbian Stretch are different from Jessie - the country code Must now be included in wpa_supplicant.conf.
Just for the fun of it I've just used putty to access my other headless Pi's
Then you have a working wpa_supplicant.conf file on those Pi's. Copy it to your PC (FTP, or even cut and paste into Notepad++) and use that on the Zero W.

Headless setup seems to cause endless problems, but it's really very reliable. Two files with the right info, put in the right place on a newly burned SD card and it works every time for me.

This thread is a bit elderly, but you can find straightforward and complete headless setup instructions in many of HawaiianPi's more recent posts.

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

Re: Pi Zero W: Truly headless setup?

Wed May 16, 2018 8:25 am

spex357 wrote:
Tue May 15, 2018 11:18 am
No, i've tried different image writers, different Raspians, different SDcards, different file editors, even a different font and different indent. Yesterday I tried over twenty video tutorials and everyone failed just as they said the word Putty. Just for the fun of it I've just used putty to access my other headless Pi's ...
This is why you shouldn't use Youtube for instructions. The videos are often old and out of date. Even my earllier post in this thread was written for Raspbian Jessie, and things have changed since then. The main difference is with the wpa_supplicant.conf file, but I'll post the entire updated procedure again.

My local network uses WPA2-PSK (AES), and this is the procedure I use for setting up headless boot with SSH and wireless network. It works with Raspbian Jessie or Stretch, Desktop or Lite, and with the built-in WiFi on the Pi3B(+) & Pi Zero W, or a Raspbian compatible USB WiFi dongle on other models. Everything is done before you boot, and can be done on a Windows or Mac computer which only has access to the small FAT32 "boot" partition of a Raspbian imaged SD card.
  1. Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
  2. Grab the Etcher software from https://etcher.io/
  3. Install Etcher and use it to write the Raspbian image to your SD card.
    • You don't need to extract the image or format the card prior to writing.
    • Just run Etcher, choose the Raspbian .zip you downloaded, pick your SD card and write.
    • If you have trouble, verify the SHA256 checksum of the download.
    • Writing an image to your card will erase everything previously on it!
  4. Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the card (labelled "boot").
    • If you get a message telling you the card must be formatted, cancel it.
  5. On that small FAT32 partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don't matter.
  6. To connect to a wireless network, create another file on the card called wpa_supplicant.conf, which has the following inside:

    Code: Select all

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=US
    
    network={
         ssid="Your network name/SSID"
         psk="Your WPA/WPA2 security key"
         key_mgmt=WPA-PSK
    }
    • Edit country=, ssid= and psk= with your information and save the file.
    • Use the 2 letter country abbreviation in CAPS (without this you will have no WiFi).
    • Use a pure text editor, not a word processor, to edit the wpa_supplicant.conf file.
  7. Make sure that both files are in the main directory of the small FAT32 partition, not in any folder.
  8. Safely eject the card from your PC and use it to boot the Pi.
If Raspbian finds an ssh file it will enable SSH and delete the file. If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. Give your Pi some time to boot and connect to your network (the first boot always takes longer), then you should be able to SSH into the Pi and configure it how you like.

If you have a Zeroconf network service installed (Apple's iTunes or Bonjour install Zeroconf), you can SSH into [email protected] (provided you don't have any other Pi computers on your network with the same default hostname). Otherwise you must SSH into your Pi's IP address, which you can find by logging into your router and checking the list of connected clients, or using a network scanner app (like Fing for smartphones).

To login using SSH from Windows, you can use an app called PuTTY, which looks like this (click picture for download link).
Image

In the Host Name (or IP address) field, enter either, make sure SSH is selected (it should be by default) and click on Open.

If you have done everything correctly, a terminal window will open and you should see a password request. Although, if it's the first time you've connected to your Pi, you may have to answer "yes" to a security question, and then you'll get the password prompt. After login you'll get a warning about having SSH enabled with the default password, so type passwd[Enter] and enter a new password (twice). And now you can do whatever you need to configure your little Raspberry Pi computer.

Code: Select all

sudo raspi-config
Will bring up the Raspbian configuration utility. If you have more than one Raspberry Pi computer on your network it's a good idea to change the hostnames to something unique so that they can easily be identified.

Note:
If you have attempted this and failed, then unplugged power to turn off your Pi, you should start over with a freshly imaged card. Improperly powering down the Pi can cause SSH key generation to fail, which will prevent SSH logins (even if everything else is correct).
Last edited by HawaiianPi on Tue Oct 16, 2018 11:31 pm, edited 1 time in total.
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?

coenvanwyk
Posts: 10
Joined: Tue Oct 16, 2018 7:12 pm

Re: Pi Zero W: Truly headless setup?

Tue Oct 16, 2018 7:49 pm

Hi guys,

Complete noob here, although I did a bit of Basic programming back in Noah's time.

I have a Pi Zero W, and am trying to set it up headless from my Mac. I have a NOOBS card with it, and managed to download and make a second, just in case.

Now I am trying to set up the ssh and wpa-supplicant files. Info I get is confusing, and does not work.

I opened the OS>Raspbian>boot folders.

Do I create a blank file called ssh.txt, and paste it in there?

Do I do the same with the wpa-supplicant one? I see various formats of how it should look on this forum, can someone please help with the latest format?

Sorry for the basic questions, it's a steep learning curve.

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

Re: Pi Zero W: Truly headless setup?

Tue Oct 16, 2018 11:35 pm

NOOBS is an interactive OS installer, and is not recommended for headless use.

Follow my instructions in the post right above yours to create a Raspbian SD card and configure it for headless boot with WiFi and SSH.
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?

PhatFil
Posts: 508
Joined: Thu Apr 13, 2017 3:55 pm

Re: Pi Zero W: Truly headless setup?

Tue Oct 16, 2018 11:49 pm

in my very limited experience with 3 x pi-0w headless setups using a windows machine to download/flash/edit the sd card image.
using notepad or wordpad can be touch n go to edit/insert wifi credentials, while notepad++ will work and create a file that the raspbian system can read and use.

However imho the simplest solution is to get a usb hub with a supported nic controller and Rj45 socket, and let the pi join your network via eth0/dhcp which it will do without any file edits. Then once the pi's ip has been identified you can ssh in and make the wifi changes to the system via the raspi-config set up tool.

coenvanwyk
Posts: 10
Joined: Tue Oct 16, 2018 7:12 pm

Re: Pi Zero W: Truly headless setup?

Thu Oct 18, 2018 6:25 pm

I did as recommended, but still no pi on Lanscan or bluetooth. I will try again, maybe I did something wrong. Had a problem creating a .config file, Word would not save it as such, not even in .txt mode. Managed a workaround, renamed it on the desktop, but no go. I will check again.

I am interested in the other suggestion, to connect via eth0 DHCP. I have an etherned connection on the Mac but how do I connect the pi to it? Things are still Greek, but I am trying.

coenvanwyk
Posts: 10
Joined: Tue Oct 16, 2018 7:12 pm

Re: Pi Zero W: Truly headless setup?

Thu Oct 18, 2018 6:37 pm

I note that both the ssh.txt and wpa_supplement.config files I put on the boot card disappeared, so perhaps I did something right. Will try to fire up an old Windows computer with a text editor other thanTextEdit.

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

Re: Pi Zero W: Truly headless setup?

Thu Oct 18, 2018 7:25 pm

coenvanwyk wrote:
Thu Oct 18, 2018 6:37 pm
...with a text editor other than TextEdit.
Check the TextEdit configuration to make sure it is not converting straight quotes to curly quotes (that breaks wpa_supplicant.conf).
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?

PhatFil
Posts: 508
Joined: Thu Apr 13, 2017 3:55 pm

Re: Pi Zero W: Truly headless setup?

Thu Oct 18, 2018 10:20 pm

coenvanwyk wrote:
Thu Oct 18, 2018 6:25 pm
I did as recommended, but still no pi on Lanscan or bluetooth. I will try again, maybe I did something wrong. Had a problem creating a .config file, Word would not save it as such, not even in .txt mode. Managed a workaround, renamed it on the desktop, but no go. I will check again.

I am interested in the other suggestion, to connect via eth0 DHCP. I have an etherned connection on the Mac but how do I connect the pi to it? Things are still Greek, but I am trying.
to use a pi-zero with a lan connecton you will need a usb hub with nic/port like https://shop.pimoroni.com/products/thre ... -connector . with such a device (not the cheapest ebay/far east variety due to driver issues) when hooked upto your lan your pi-0 will boot up and retrieve an ip addy from your dhcp server(router?)

while a pi-0 can be connected via usb to a puter in gadget mode you will need to get over this initial hurdle in order to enable that.

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

Re: Pi Zero W: Truly headless setup?

Fri Oct 19, 2018 5:11 am

You DO NOT need to purchase a USB Ethernet adapter at all. You can configure a micro SD card for a completely headless Pi computer without ever booting it.

I have a pre-configured USB Gadget Raspbian Stretch Lite image if you'd like to give it a try. This will let you connect your Mac to your Pi0 with an ordinary micro USB cable and SSH into it.

2018-06-27-raspbian-stretch-lite_Pi0-USB.zip

It's the default Raspbian Stretch Lite 2018-06-27 image with Pi0(W) USB Ethernet Gadget mode pre-configured (config/cmdline .txt files modified and "ssh" file added with no other changes). Just write it you your SD card with Etcher and DO NOT modify anything.
  • Put the card in your Pi0 or Pi0W
  • Connect a normal micro USB data cable to the USB data port of the Pi0 (the one closest to the center)
  • Do not connect anything to the power port (the one closest to the outer edge)
  • Connect the USB-A end of the micro USB cable to your main PC and the Pi0 should start to boot
  • Note that the first boot can take awhile, so give it a couple of minutes before you try to SSH in
It should boot up in USB Ethernet Gadget mode, and your Mac should install a new USB Ethernet/RNDIS Gadget network adapter.

After the Pi0 finishes booting you can SSH into [email protected]

This image was tested and confirmed working on my Windows 10 notebook with my Pi0W and a Pi0v1.3 with a USB WiFi dongle.
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?

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

Re: Pi Zero W: Truly headless setup?

Fri Oct 19, 2018 5:27 am

coenvanwyk wrote:
Thu Oct 18, 2018 6:37 pm
I note that both the ssh.txt and wpa_supplement.config files I put on the boot card disappeared, so perhaps I did something right. Will try to fire up an old Windows computer with a text editor other thanTextEdit.
This means you Pi0W is booting correctly, and the problem is with the editing or creation of the files. As I said above, make sure that TextEdit is in pure text mode and is not reformatting the file. Mac text editors converting straight quotes to curly quotes is a known issue.

So start with a freshly imaged SD card, then add the empty ssh file and a properly formatted wpa_supplicant.conf file, which looks like this:

Code: Select all

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

network={
	ssid="Your network SSID"
	psk="Your WPA/WPA2 security key"
	key_mgmt=WPA-PSK
}
  • Edit country=, ssid= and psk= with your information and save the file.
  • Use the 2 letter country abbreviation in CAPS (without this you will have no WiFi).
  • Use a pure text editor, not a word processor, to edit the wpa_supplicant.conf file.
  • Make sure that both files are in the main directory of the small FAT32 "boot" partition, not in any folder.
  • Safely eject the card from your PC and use it to boot the Pi.
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?

coenvanwyk
Posts: 10
Joined: Tue Oct 16, 2018 7:12 pm

Re: Pi Zero W: Truly headless setup?

Fri Oct 19, 2018 4:51 pm

Thanks, HawaiianPi, I downloaded, flashed, installed, connected. Still waiting, and nothing on the LanScan and the terminal says:


coenvanwyksimac:~ coenvanwyk$ ssh [email protected]
ssh: Could not resolve hostname raspberrypi.local: nodename nor servname provided, or not known

I need to find a p-iman in town, the one I know is busy with a crisis project at the moment. Patience is a virtue.

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

Re: Pi Zero W: Truly headless setup?

Fri Oct 19, 2018 8:15 pm

coenvanwyk wrote:
Fri Oct 19, 2018 4:51 pm
Thanks, HawaiianPi, I downloaded, flashed, installed, connected. Still waiting, and nothing on the LanScan
Which image/post are you referring to, the pre-configured USB Gadget image from 2 posts up, or the default Raspbian with a pre-configured wpa_supplicant.conf from the post above?

If you tried the USB Gadget image, did your Mac detect and install the USB Ethernet/RNDIS Gadget network adapter?

If you tried to edit the wpa_supplicant.conf file, did you first change the settings in TextEdit to prevent the conversion of straight quotes to curly quotes?
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?

coenvanwyk
Posts: 10
Joined: Tue Oct 16, 2018 7:12 pm

Re: Pi Zero W: Truly headless setup?

Sat Oct 20, 2018 6:04 pm

Hi HawaiianPi,

I tried your version, then also the Rasbian stretch version from their website. Neither made the Mac download anything that I could see.

I did not see any settings in TextEdit, will try a few variations tomorrow and report back. I used the text editing program on the old (Windows 6) laptop.

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

Re: Pi Zero W: Truly headless setup?

Sat Oct 20, 2018 8:45 pm

coenvanwyk wrote:
Sat Oct 20, 2018 6:04 pm
Hi HawaiianPi,

I tried your version, then also the Rasbian stretch version from their website. Neither made the Mac download anything that I could see.
The default Raspbian is not configured for USB Gadget mode, but my image works on my Win10 PC. It's been awhile since I've used a Mac, but as far as I know the same configuration should work on Windows, Mac and Linux.
coenvanwyk wrote:
Sat Oct 20, 2018 6:04 pm
I did not see any settings in TextEdit,
A quick google search said to look in: System Preferences > Keyboard > Text, and Uncheck the "Use smart quotes and dashes" checkbox.

For a Raspbian image downloaded from the official site, adding the ssh and wpa_supplicant.conf file should get you connected with SSH enabled. If it's not working, but the ssh file is getting deleted and the wpa_supplicant.conf file is getting moved (to /etc/wpa_supplicant/wpa_supplicant.conf) then the Pi is booting and processing the files correctly, so the problem must be with the wpa_supplicant.conf file.

Are you using WPA or WPA2 encryption on your router (hopefully you're not using WEP)?

Is your SSID hidden?

Do you have MAC address filtering or any other security on the router that may be preventing the Pi0W from connecting?

Are you changing anything else on the Raspbian card (setting static IP or editing any other files)?

Can you log into your router to see if the Pi0W shows up in the list of connected clients?

Try rebooting the router.

Do you have access to another Pi with a keyboard and screen (or can you connect your Pi0W to a keyboard and screen)?
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?

coenvanwyk
Posts: 10
Joined: Tue Oct 16, 2018 7:12 pm

Re: Pi Zero W: Truly headless setup?

Sun Oct 21, 2018 9:39 am

Hi HawaiianPi,

Before rebooting the router etc, I thought to try the USB - cable route. I am flashing the image you provided, 2018-06-27-raspbian-stretch-lite_Pi0USB.img again, and will see what happens.

It seems that my Ios (El Capitan 10.11.6) has a RNDIS driver. Now to enable sharing: the google experts say to enable network sharing. If I open Internet Sharing > Ethernet I get a warning that my ISP might cancell my contract for interfering with their network!! However, Network preferences say Ethernet is connected. Internet sharing by WiFi is enabled but seems then to stop the Ethernet connection to the router. So when I have time I will try the latest recommendations.

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

Re: Pi Zero W: Truly headless setup?

Tue Oct 23, 2018 1:56 am

coenvanwyk wrote:
Sun Oct 21, 2018 9:39 am
Hi HawaiianPi,

Before rebooting the router etc, I thought to try the USB - cable route. I am flashing the image you provided, 2018-06-27-raspbian-stretch-lite_Pi0USB.img again, and will see what happens.

It seems that my Ios (El Capitan 10.11.6) has a RNDIS driver. Now to enable sharing: the google experts say to enable network sharing. If I open Internet Sharing > Ethernet I get a warning that my ISP might cancell my contract for interfering with their network!! However, Network preferences say Ethernet is connected. Internet sharing by WiFi is enabled but seems then to stop the Ethernet connection to the router. So when I have time I will try the latest recommendations.
You can connect to WiFi while using USB Gadget mode. Just create a pre-configured wpa_supplicant.conf file like the example in my earlier post above, and put that on the small FAT32 "boot" partition. And if it fails again, we can troubleshoot it since you can SSH in now.

Oh, and since you have SSH access now, enter this command and tell us what it says.

Code: Select all

cat /sys/firmware/devicetree/base/model;echo
And just out of curiosity, where do you see that ISP warning, and what kind of ISP do you have (Cable, DSL, Cellular data)?

PS:
I finally got around to updating my USB Gadget mode image to the latest 2018-10-09 version of Raspbian Lite.
2018-10-09-raspbian-stretch-lite-Pi0USB.zip
SHA-256: f17b68a8aa645176cfac97641569fdaac0a296748ef7dfc8c39c7b36ec81f3fd
Tested and verified working on my Win10 laptop and Pi0W.
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?

coenvanwyk
Posts: 10
Joined: Tue Oct 16, 2018 7:12 pm

Re: Pi Zero W: Truly headless setup?

Fri Oct 26, 2018 7:42 pm

Thanks, downloaded. It's been a hard week, I hope to try this out over the weekend. But thanks for the trouble.

I modified the TextEdit, the Windows machine is busy these days.

We use a fibre-optic cable service, connected by ethernet to my Mac, the wifi provided is weak.

The router uses a WPA2 password, and the network shows on all devices.

Two questions: When I copy your files, do I copy everything, also the 'Code: Select all' header? and: I use the ssh command from the terminal?

As soon as I have results I will post it.

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

Re: Pi Zero W: Truly headless setup?

Fri Oct 26, 2018 8:36 pm

coenvanwyk wrote:
Fri Oct 26, 2018 7:42 pm
We use a fibre-optic cable service, connected by ethernet to my Mac, the wifi provided is weak.
Yea, we have Frontier (Verizon) FiOS and the ISP supplied router/gateway is garbage. When we were in a rental I configured that router as a bridge and installed my own router (which got an external IP). Tech support will probably tell you their router can't be configured as a bridge, but I found instructions elsewhere. In our new home we had them run Ethernet from the ONT into the house.

Two questions: When I copy your files, do I copy everything, also the 'Code: Select all' header?
The stuff under "Code: Select all" is posted in code tags to keep formatting. You can click on 'Select all' to highlight what you are supposed to copy. If you are using the Prosilver forum theme then clicking on Select all may not work correctly, so just grab the text under that.

and: I use the ssh command from the terminal?
Yes, on a Mac you should be able to use SSH from the terminal.
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?

coenvanwyk
Posts: 10
Joined: Tue Oct 16, 2018 7:12 pm

Re: Pi Zero W: Truly headless setup?

Sat Oct 27, 2018 12:12 pm

I'm in! Turns out the USB cable I was using is only a power cable. Now why did they not teach me this at school? :shock:

She talks back to me. Now to try to set up the wifi, and add a camera.

Thanks a lot, I really appreciate the patience.

DrElec
Posts: 1
Joined: Sat Oct 27, 2018 8:54 pm

Re: Pi Zero W: Truly headless setup?

Sat Oct 27, 2018 9:20 pm

@coenvanwyk, glad things are working for you in gadget mode but it kind of leaves the subject of this thread not fully satisfied.

I've been following the conversation closely and tried applying some of the suggestions particularly by @HawaiianPi and I'm at a loss as to why I can't seem to get either of my two Pi Zero W on my network without resorting to any cabled means. So if anyone has any insight please pitch in. For the record I have tried creating a wpa supplicant file using notepad++ (including Linux EoL) and plain old windows notepad, neither has worked. At the moment my supplicant file looks like this:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
ssid="MySSID2G"
psk="PasswordHashGeneratedInDebianUnderWindowsLinuxSubsystem"
key_mgmt=WPA-PSK
}
I've tried simpler versions of that (ctrl_interface line, country, ssid and psk), plain text passwords, different orders and nothing seems to work. I've tried different SD cards on both boards and still nothing. Neither plain old raspbian stretch nor lite seems to do anything as expected.

The only lead I have got is that during one session of failed attempts I plugged in an hdmi lead and I noticed a line during boot that stated something like '[ ok ] disable wifi if country not set' (don't quote me on the exact wording). The board successfully boots so I guess the supplicant file was accepted and processed (perhaps incorrectly). In any case, disabled wifi would tally with my experiences but I'm open to suggestions of what else might be wrong.

I'm sure I can get these boards online using more traditional means, but the whole point is that I'd like to be able to reliably set them up in a truly headless manner (the hdmi lead for diagnosis and usb gadget mode are a bit cheaty). I can't be the only one who wants to do this. The documentation on raspberrypi.org is out of date. So I feel like there is a hole here that needs to be filled, it seems to be a recurring problem for a lot of people for one reason or another.

Anyway hopefully we can carry on the conversation as I think something is amiss here.

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

Re: Pi Zero W: Truly headless setup?

Sat Oct 27, 2018 9:51 pm

DrElec wrote:
Sat Oct 27, 2018 9:20 pm

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
ssid="MySSID2G"
psk="PasswordHashGeneratedInDebianUnderWindowsLinuxSubsystem"
key_mgmt=WPA-PSK
}
I'm pretty sure that if you use a password hash you need to use something else than 'psk'.
Quick google suggests

Code: Select all

password=hash:PasswordHashGeneratedInDebianUnderWindowsLinuxSubsystem
Not 100% sure though, because the google results seem to indicate this is for EAP
https://www.google.co.uk/search?hl=en&s ... GZEZ_en-GB

You can also use

Code: Select all

wpa_passphrase [ssid-name] [password-name]
The result can be used with 'psk'

Return to “Beginners”