1

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?

Aurora0001
  • 6,198
  • 3
  • 21
  • 37
  • Have you enabled the ssh server? (`sudo raspi-config` -> `interfacing options` -> `ssh`) – Benjamin Ashbaugh Apr 08 '18 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 08 '18 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 08 '18 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 08 '18 at 22:05
  • Do you have a static IP configured on the PC? Do you have a DHCP server configured on the PC? To enable ssh without needing to get into the Pi, you can create an empty file named `ssh` in the first partion of the SD card. Also, you can create a wpa supplicant file on the boot (first) partition of the SD card which will be used to configure wifi without even needing ssh - see https://raspberrypi.stackexchange.com/a/57023/33057 – Jaromanda X Apr 08 '18 at 23:26
  • `ethernet cable is not connecting to my PC` ... this has nothing to do with a RPi, why are you asking about it here? – jsotola Apr 08 '18 at 23:40
  • Your using a router, right? you can't just connect the pc and rpi with a Ethernet cable. they have to both be connected to a router. @dabberson567 You have to enable the ssh server on your _pi_. if you downloaded the ordinary stretch lite from the raspberry pi downloads page, then it's not enabled by default. I think you can enable the ssh without a monitor [like this](https://hackernoon.com/raspberry-pi-headless-install-462ccabd75d0). Basically, just add a file called `ssh` to the `boot` partition on the sd card. – Benjamin Ashbaugh Apr 09 '18 at 00:02
  • 1
    `they have to both be connected to a router` - not necessarily – Jaromanda X Apr 09 '18 at 00:55
  • Just a guess, but it sounds as if you may not have a functional network connection between your RPi and your PC/Mac - just connecting the two over an ethernet cable won't do it! You've mentioned WiFi; try getting your RPi on your WiFi network first - see Answer below. – Seamus Apr 09 '18 at 13:38

3 Answers3

1

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.

dlu
  • 439
  • 3
  • 19
  • 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 09 '18 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 '18 at 16:05
1

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!

Seamus
  • 18,728
  • 2
  • 27
  • 57
0

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 09 '18 at 13:40