I'm trying to connect to a Raspberry Pi using the command ssh pi@raspberrypi.local (using Raspbian Stretch Lite) over Ethernet so I can configure Wifi on the Pi. However I keep on running into this error. ssh: Could not resolve hostname raspberrypi.local: Name or service not known

I'm also not seeing any activity on the Ethernet – normally I'd expect to see a "connecting" message.

How can I fix this problem?

  • Have you enabled the ssh server? (sudo raspi-config -> interfacing options -> ssh) – scitronboy Apr 8 at 19:49
  • @scitronboy would that be on my computer I configure it? I can't enable the ssh server on the Pi if I can't connect to it. – dabberson567 Apr 8 at 20:52
  • 1
    "the ethernet cable is not connecting to my PC". Don`t understand this. Where is your ethernet cable connected? – Ingo Apr 8 at 21:48
  • Sorry. Meant that the ethernet cable is connected to my PC but my PC fails to register the ethernet cable. I would usually get a "connecting" message, then it would fail. I don't know what the problem is? – dabberson567 Apr 8 at 22:05
  • 1
    they have to both be connected to a router - not necessarily – Jaromanda X Apr 9 at 0:55

The problem is that Stretch does not run Bonjour out of the box, so the name of your Pi is unknown. You should be able to connect if you:

  1. Create an empty file named ssh in the root of your SD card, and
  2. Figure out the IP address of the Pi (see here if you don't know how), and finally
  3. ssh pi@<the IP address>

Note also that if you are connecting directly from you Linux machine to the Pi there is a slim chance that something is failing in the auto-crossover negotiation and the network isn't up, you can check this by looking for flashing lights at the Ethernet plugs and also by running ifconfig on the Linux machine to see if the network is up.

  • 1
    @dabberson: In case this does not make it clear, the problem is that the hostname raspberrypi.local is not being resolved on the network. Hostname resolution is what translates that into an actual IP address. Getting a hostname resolved generally happens on of three ways: 1) Your DNS server does it, 2) You have some mappings on your local system, 3) A local network service such as Bonjour, mentioned above, is in use on both computers. – goldilocks Apr 9 at 13:45
  • Hello @dabberson... Have you gotten this working? If not, we need more details to help. It's not clear how your PC is connected to your RPi; i.e. do you have an ethernet cable from PC to RPi? If so, that ain't gonna' work (easily). – Seamus Apr 10 at 16:05

that is because you are trying to do a connection end to end between your pi and your computer but there is nothing on the pi to respond to the computer request

start by enabling ssh on the, on the /boot partition add a file called ssh connect the pi through ethernet to your router, it will get an IP, then on your pc execute

sudo apt-get install -y nmap
hostname -I #this will return something like 192.168.x.x

now look for your pi with

  sudo nmap -sn 192.168.x.0/24

you will get something like

Nmap scan report for 192.168.15.1
Host is up (0.018s latency).
MAC Address: 4A:02:71:67:4B:E6 (Unknown)
Nmap scan report for 192.168.1x.2
Host is up (0.070s latency).
MAC Address: 88:78:73:84:26:5A (raspberrypi)
Nmap scan report for 192.168.x.3
...

now simply ssh to your pi with

ssh pi@192.168.x.3 #pass raspberry

once inside, configure the wifi

sudo raspi-config

you can also use /etc/wpa_supplicant/wpa_supplicant.conf to set the network

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

network={
    ssid="YOUR_SSID_HERE"
    psk="YOUR_SECRET_PASSPHRASE_HERE"
    id_str="SOME_DESCRIPTIVE_NAME"
}
  • Although this all might help, that "there is nothing on the pi to respond to the computer request" is not really true -- the problem is the request is not even being sent to the Pi, because raspberrypi.local is not being resolved. – goldilocks Apr 9 at 13:40

I feel the easiest way to configure wifi on your RPi is to edit the /boot/wpa_supplicant.conf file on your microSD card. In your case, you'll remove the microSD card from your RPi, put it in a suitable card reader, plug that into your Windoze/Mac/Linux laptop/desktop, and edit the file in your favorite text editor (see NOTE below).

Once you've made the necessary edits, re-insert the microSD card in your RPi, and you'll have wifi when you boot up. There are some instructions on what entries are appropriate for the wpa_supplicant file here, but don't be confused by the fact that this guide references /etc/wpa_supplicant.conf. It's the same file that's in /boot.

NOTE: /boot on current versions of Raspbian is an SMB partition, and so is accessible from any OS and editor!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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