8

I am trying to start up my Raspberry Pi Zero W completely headless, but somehow it won't connect to my WiFi. Here's what I did:

  1. Plug SD card running RASPBIAN JESSIE WITH PIXEL (should it be something else?) into my Windows PC
  2. Create an ssh file on the root of the SD card
  3. Create a wpa_supplicant.conf file with the following content:

wpa_supplicant.conf:

network={
    ssid="My WiFi 2.4"
    psk="mypassword123"
    key_mgmt=WPA-PSK
}

Then I plug the SD card into the Pi, boot it up, but it never appears as a client on my router, nor can I see an indication saying it's connected when I hook it up using my HDMI cable.

My WiFi settings:

enter image description here

When I plug the SD card back into the PC again, the files are missing (I assume it does its magic and applies the settings, then removes the files afterwards). However, when I look at the monitor, it shows SSH has been enabled, so I know that works.

What can I do here? I'm clueless right now.

13

The accepted answer does not give a solution to anyone having this problem.

From a point on (maybe debian jessie?), the /etc/wpa_supplicant/wpa_supplicant.conf requires these lines on top of the network configs:

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

network={
    ssid="Home Wifi"
    psk="mypassword"
    key_mgmt=WPA-PSK
}

Change the country code and WiFi info to yours.

Official documentation

4

Went with PiBakery (which is awesome). Just installed Jessie Lite and I am now hooked up to the WiFi. Completely headless.

  • 2
    I don't know why your original didn't work, but the process is documented in raspberrypi.stackexchange.com/a/67016/8697 . This also explains where the file is located; NOTE you need sudo to view it. – Milliways May 28 '17 at 23:41
  • @Milliways Yeah, it's weird why it didn't work. Oh well, at least I found a solution. – MortenMoulder May 28 '17 at 23:45
  • PiBakery is very interesting. Hadn't heard of it before. Good job. – SDsolar May 29 '17 at 7:50
  • 1
    Here's a link to PiBakery: pibakery.org/index.html – jwfearn May 29 '17 at 17:29
2

You probably created the file "wpa_supplicant.conf" using a Windows format for end-of-line characters which the Raspberry Pi can't understand. Check to see if "wpa_supplicant.conf" has a Unix format for EOL characters. You can check this and convert ifd needed to Unix format, using a advanced editor like Notepad++ (which is free software for Windows downloadable at https://notepad-plus-plus.org).

2

This is a Raspberry Pi Zero W:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=UK
network={
 ssid="my-ssid"
 psk="my-network-password"
 key_mgmt=WPA-PSK
}

then: sudo rfkill unblock all the wifi came up and when I rebooted, to make sure, it stayed up.

0

I have found that the syntax of wpa_supplicant.conf is very picky. For example the line "priority = 1" fails whereas "prioriy=1" works. Any syntax errors will cause failure.

-3

Dropping the wpa_supplicant.conf along with the ssh file into /boot should have worked. (I honestly don't know why it wouldn't, in your case)

Anyway, on the bright-side, you do have SSH working which is all you need to configure and control a headless Pi. Try a manually configuring wpa_supplicant directly by editing the file in /etc/wpa_supplicant/wpa_supplicant.conf. The command in the ssh terminal is as follows:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Detailed and complete instructions may be found in the reference below in the official docs.

Reference: RPi Foundation Docs: Setting wifi up via the command line

  • That's great and all, but how would I SSH into my Pi, if it's not connected to the network? And no, I won't do any crazy workaround to enable the Pi as an ethernet adapter, which I can SSH into through USB. – MortenMoulder May 31 '17 at 6:42
  • 1
    My bad, forgot that the Zeros doesn't have any other ports other than that microusb. – C.M. Au Yong Jun 4 '17 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.