4

My image: 2017-08-16-raspbian-stretch-lite from here
My Raspberry Pi: Raspberry Pi Zero W
My computer: Linux (Fedora 26)

What I did

  • I followed the official instructions on how to flash the img to a Micro SD card.
  • Since I don't have an HDMI monitor, I need to be able to ssh into the device. So I followed this guide to be able to ssh into the Pi over USB. But although the Pi showed up as a new network interface that I was able to connect to, I was not able to resolve raspberrypi.local. The network interface also didn't seem have dhcp, so I got no IP form that device.
    So I undid all the changes from that guide again. The Raspberry Pi Zero W already has WiFi, so I didn't bother continuing going through all the hassle...
  • Then I edited my /etc/wpa_supplicant/wpa_supplicant.conf adding the following lines to the end of it:

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

    It connected to my WiFi without a problem and I am able to ping it form my computer.

  • Now this official site says If you want to enable SSH, all you need to do is to put a file called ssh in the /boot/ directory.. So I added an empty file called ssh to the boot partition of the micro SD card. And since that didn't work, I also added an empty file called ssh to the other partition of the card, but into the directory /boot. But it didn't work either. When I say It didn't work, I mean I can still ping it (raspberrypi.local), but when I try to ssh into it I get this:

    fedora@localhost:~$ ssh pi@raspberrypi.local
    ssh: connect to host raspberrypi.local port 22: Connection refused
    

    Connecting to other devices via ssh works just fine in my LAN. Using the IP instead of the hostname doesn't work either (same error). And omitting the username (pi@) also results in the same error. I also tried to ssh from different devices in my LAN; same error.

Any ideas what I could be doing wrong? I mean the Raspberry Pi is quite obviously running and even connecting to my WiFi and responding to pings. It seems like the ssh service is not running or maybe there is a firewall rule blocking port 22 on that device?

  • The ssh file has to be on the SD card at the first boot. I get the impression that you have added it after the first boot, is that so? – MatsK Sep 3 '17 at 12:36
  • Yes, I haven't added the file before the first boot. The article doesn't mention that. Do you know if the file goes into the /boot directory as the article claims or if it actually goes into the partition called boot? – Forivin Sep 3 '17 at 13:22
  • When I have created a Raspbian SD card i copy my ssh and wpa.... to the /boot folder on the SD card. Have you tried to run "sudo rasp-config" and enable ssh? – MatsK Sep 3 '17 at 13:25
  • 1
    Where do I get rasp-config? And how would it be able to enable ssh on my Raspberry Pi? – Forivin Sep 3 '17 at 13:31
  • Sorry, misspelled sudo raspi-config is a built in command, so just type it in the console. – MatsK Sep 3 '17 at 13:33
3

I had the same issue, I just renamed my SSH file to ssh (all small). and yes you've to do this before your first boot

  • You can create the file /boot/ssh at every time and reboot. It will always enable ssh if it wasn't before. – Ingo Apr 20 at 9:18
2

First of all the correct place to put the ssh file is not the /boot/ directory as the official article claimed. The right place is on the other partition which is called boot, right in the root directory.

The reason why it did not work for me initially, was that the Micro SD card that I was using was broken in some way. I can't properly read from the card anymore and the main partition just disappeared over night.
I repeated the steps from my question using a new Micro SD card and everything worked fine. Not even a single problem.

0

from the description above it seem that you have not change the CONFIG.TXT AND CMDLINE.TXT.

try to add dtoverlay=dwc2 at the bottom of the config.txt.

then add modules-load=dwc2,g_ether in cmdline.txt insert the code in between rootwait and quiet init=/usr/. both file above is in the boot. and make sure the usb cable connected to usb connection(the closest from hdmi input) of the pi not the pwr connection.

  • Then please read the question again. Because I did that. – Forivin Sep 4 '17 at 6:24
0

You might what to have a look for my answer here https://superuser.com/a/1279491/345746, even i face this issues and resolved it with few simple steps.

Hope it works for you too.

0

I had a similar problem. I had several Raspberry Pi's that I was reimaging after I plugged the first one in I realized I forgot to set it up properly. I then made changes to all of the SD Cards. The first Raspberry Pi did not work, but all of the other ones did. I had to reimage the SD Card, insert the ssh file, and then it worked.

You have to create the ssh file before the first boot. If you boot the SD Card once and it isn't customized, it will not work as expected.

  • Image the SD Card
  • Make the necessary changes
  • Then first boot
0

I had the same problem with my Pi Zero W V1.1. What I did:

  • used balenaEtcher on my Mac to install Raspbian Buster
  • reinserted the sd card into my Mac created empty file named ssh on first partition boot (not the folder on the second partition rootfs which does not get mounted on my Mac anyway)

    touch /Volumes/boot/ssh
    
  • created the wpa_supplicant.conf:

    nano wpa_supplicant.conf
    
  • inserted the following lines:

    ctrl_interface=DIR=/var/run/wpa_supplicant
    GROUP=netdev
    update_config=1
    country="YOURCOUNTRY"
    
    network={
        ssid="SSID"
        psk="PASSWORD"
    }
    
  • copied the wpa_supplicant.conf to the first partition boot

    cp wpa_supplicant.conf /Volumes/boot
    
  • inserted the sd card into the Pi Zero

  • waited for the installation to complete

I could ping the Pi Zero W, but I still got the message connection refused when I tried to establish an ssh connection from my Mac. This really confused me. First I thought that there might be a bug in the Raspbian Buster image. So I did the same with my Pi 4 and it worked flawlessly, which means that the image was most likely not the problem.

I removed the sd card from my Pi 4 and inserted it into my Pi Zero W and booted it. It worked, I could establish an ssh connection. But the system was pretty unresponsive. After I put some load on it with sudo apt-get upgrade (after apt-get update), it crashed with kernel errors:

message from syslogd@raspberrypi (and so on)

Thankfully I found another thread: Thread on raspberrypi.org

So the workaround for me was:

  • install Raspbian Buster on my Pi 4
  • boot the installation on my Pi Zero W
  • edit /boot/config.txt:

    nano /boot/config.txt
    
  • add the following line:

    over_voltage=2
    
  • restart the Pi Zero W

    sudo init 6
    

After increasing the voltage, it works stable.

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.