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.

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.

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.

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.

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 partition, not in any folder.

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).

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.

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?

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.

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.

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.

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.

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:

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.

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?

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.

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.

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?

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.

@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:

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.