4

I am trying to set up a Raspberry Pi Zero with Raspbian Stretch headlessly.

From my understanding, in order to accomplish this task requires three steps:

  1. Flash Raspbian to a microSD (I did so using Etcher).
  2. Add an empty ssh file in the boot directory.
  3. Add a wpa_supplicant.conf file with my network information in the boot directory.

The problem is, for some reason, both of the aforementioned files disappear after I try to boot up the Pi.

This is the process I use to create the files:

  1. I create the files on the microSD card using sudo (for me the directory is in /media/MyMachine/boot).

  2. Ensure that both files are inside the boot directory (even cat them to see all the right changes have been made).

  3. Stick the card in the Pi.

  4. When I cannot find the Pi on my network, I check the card and find that neither the ssh file nor the wpa_supplicant.conf file are in the boot directory.

EDIT: I should note that I am using Ubuntu on the machine I use to write onto the microSD card--the Pi contains Raspbian as noted above.

1
  • Make sure the file is being saved in the micro SD, save the file to the card, remove it from your PC, and re-insert it to make sure it is not a problem on the card. Oct 23, 2018 at 20:24

3 Answers 3

4

ssh will be deleted and wpa_supplicant will be moved. That's why they vanished.

Looks like your wpa_supplicant is not configured correctly and therefore you don't get any WLAN connectivity. Please see Prepare SD card for Wifi on Headless Pi.

1
  • That's correct and there is likely something wrong with the config for WiFi not to work properly. See my answer here how and whereto wpa_supplicant is moved.
    – Ghanima
    Oct 24, 2018 at 8:35
2

to the boot directory

That depends on your perspective. If you are referring to a context on a running Pi, then the /boot directory should work.

However...there's probably no reason you would want to do this if that were the case.

If this isn't a running system, "the boot directory" is really a misnomer. This refers to the boot partition which, on a running system, is usually mounted on the /boot directory.

If the system is not running, the /boot direcory (which is on the second partition) is not the same thing as the boot partition, which is the first partition and where you want to leave those files.

So, if you've mounted the SD card, you've either mounted the first, the second, or both partitions. If the partition you are looking at has a /boot directory, that's the wrong place. It will not end up on the boot partition and will be hidden underneath the mount point on a running system.

1
  • And a further hint to the OP: the mounted boot partition must contain some system files and drivers which include kernel.img and kernel7.img.
    – Ingo
    Oct 23, 2018 at 20:57
0

Happened to me too. It seems to be due to a misconfigured wpa_supplicant.conf file.

Using the following file fixed it for me:

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

It seems to be some kind of adolescent prank to remove files behind the back of a developer...

1
  • 1
    It's moved, not removed. Yes, it's something I would not expect either. The file is moved to /etc/wpa_supplicant/ . I guess the reasoning was that /boot is a vfat partition and therefor easily accessible from Windows and Mac if you you pop in the SD card. So you can create these two files there, then during boot they are automatically moved. In other words, a hack.
    – JvO
    Jan 12, 2022 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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