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: 1708
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: 687
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: 2660
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).
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 “Beginners”

Who is online

Users browsing this forum: Google [Bot] and 46 guests