I have the old Raspberry Pi B. I flashed the latest Raspbian Buster (headless version) using balenaEtcher (macOS). After that, I've connected the SD card again and created a ssh empty file on the boot partition (in the same directory where cmdline.txt and config.txt files are present).

After inserted the SD card to Raspberry and plugged the power, it started, printed some output, restarted and printed some more output ending in the login prompt.

Along the way, there were a few errors:

[FAILED] Failed to start dphys-swapfile - set up, mount/unmount, and delete a swap file.


[FAILED] Failed to start LSB: Resize the root filesystem to fill partition.


[FAILED] Failed to start Regenerate SSH host keys.

Later on, the log says that Raspberry is using (which I reserved for Raspberry on my router by mac address).

Now, I'm trying to connect to SSH by IP and this happens:

$ ssh -vvv
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: resolve_canonicalize: hostname is address
debug2: ssh_connect_direct
debug1: Connecting to [] port 22.
debug1: connect to address port 22: Connection refused
ssh: connect to host port 22: Connection refused

No luck. But weird thing: when using the raspberrypi.local (or pi.local) hostname, the connection hangs. It never connects but also never replies with a connection refused.

$ ssh raspberrypi.local -vvv
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to raspberrypi.local port 22.

I have no keyboard to connect directly to my Raspberry.

Also, the ssh file does not get deleted from the SD card. When I read it on my MacBook later, I still see this file. I've read on the Internet that Raspberry should delete it right after enabling SSH.

  • 3
    ssh probably isn't working because Failed to start Regenerate SSH host keys - the first two errors suggest something is wrong with the installation from the start - have you tried starting from the beginning, download and flash the image again – Jaromanda X Oct 5 '19 at 21:45
  • 1
    First you must correct the [FAILED] boot up errors. There is something essential wrong with your image. It doesn't even expand the root filesystem so you may lack of "disk" storage. It doesn't make sense to try other things before fixing it. – Ingo Oct 6 '19 at 19:51
  • After a few failed redownload+reflash scenarios but still inspired by @JaromandaX's advice, I've downloaded older versions of Raspbian and had partial success with installing a version from April 2019. The SSH started working. – Najki Oct 7 '19 at 7:58
  • But why partial success? Because later, after installing InfluxDB and during installation of Grafana something caused the SSH to fail again (the connection was dropped, while trying to reconnect a timeout occurred and after restarting Raspberry SSH wasn't working anymore). But this seems to be an unrelated problem. – Najki Oct 7 '19 at 8:11
  • 1
    If the image isn't expanded from its stripped down size to whole 8 GB you only have maybe 100 or 200 MB available. The "unexpanded" space is spare. – Ingo Oct 7 '19 at 21:52

Your Answer

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

Browse other questions tagged or ask your own question.