5

I have a Raspberry Pi Zero and I am trying to setup headless mode for that pi. I followed all the steps here, but I have no luck getting a SSH connection to the Pi. The microcontroller is running Raspbian Jessie w/ PIXEL, while I am on Kali Linux rolling.

$ ssh pi@raspberrypi.local
ssh: Could not resolve hostname raspberrypi.local: Name or service not 
known

I want to tether a USB to the Pi Zero and connect in "headless" mode, and I did not setup network connectivity to the Pi, so if I use Nmap or anything like that, the Pi won't show up.

How should I fix this? I have looked everywhere. I have also setup the Pi Zero through an HDMI monitor and configured SSH so that it starts on startup, but no luck there. Is there anything I can do to fix this?

  • Do you have itunes installed on the machine you are connecting from? Using your router you can probably identify the IP address of your Pi and use that instead of raspberrypi.local. – Steve Robillard Feb 5 '17 at 17:24
  • @SteveRobillard I'm on Linux. I want to tether a USB to the Pi Zero and connect in "headless" mode, and I did not setup network connectivity to the Pi, so if I use Nmap or anything like that, the Pi won't show up. I followed all the instructions from the guide I linked. – UncleAlan Feb 5 '17 at 17:26
  • 1
    Do you have zeroconf/avahi installed on your Kali Linux? Otherwise the pseudo TLD .local. won't resolve. – TheDiveO Jun 23 '17 at 14:30
2

Here is what I had to do to make that working :

  • At the root of your micro sd card (when plugged on another computer) : create a file empty and save it with the name "ssh" with no extension. (touch ssh on unix or notepad on Windows, save and choose . in file extension and "ssh" (with quotes) as name and save.

  • Always at the root of the micro sd card, edit config.txt file and add a line at the end : dtoverlay=dwc2

  • Then edit cmdline.txt and at the end of the line after rootwait, add a space and modules-load=dwc2,g_ether

  • save all, eject your micro sd and put it in the pi zero. then plug it via usb port (not pwr but you can plug it also).

  • If you still can't ssh pi@raspberrypi.local : on Windows, go to desktop, right click manage, then if you see that your rdnis ethernet gadget is not well installed, try to update driver, select yourself to install a network device and choose Microsoft and remote rdnis adapter.

Hope it will save time for somebody.

0

Usually people can't get SSH to work because they don't create the ssh file in the boot folder, as that guide asks you to do indeed. If you are sure you did that, and also tried to do this in non-headless way by manually enabling ssh on the device using monitor and keyboard, then I'd look for your problem on your network rather than on the raspberry.

I don't know about using "raspberrypi.local" to connect, try getting the IP of your device in your modem/router control panel or any other way.

  • Another way to detect all Raspis in your local net with their IP addresses (Adapt your local network) : nmap -sP 192.168.0.0/24 &>/dev/null; arp -n | grep "b8:27:eb" – framp Apr 15 '17 at 17:45
0

I just set up SSH on my new model 3B.

  1. I used a mouse/keyboard/monitor to connect to the same wifi router as my laptop.
  2. I typed "ifconfig" into the terminal on the raspberry pi to show its IP address.
  3. I opened Terminal on my mac, typed ssh pi@192.68.0.8 (that was the pi's address) and logged in with password raspberry.
  4. You can use various tools to find the raspberry's IP address if you know what wifi it's connected to. I use an app called Net Analyzer on my iphone.
0

There can be different points why you cant connect your PI. The error message indicates that the domain can't be resolved. Try:

nslookup raspberrypi.local

does the response give the IP of the Raspberry? If not there is a DNS issue.
If you know the IP of your Raspberry try to connect using the IP:

ssh pi@192.168.1.1

If it doesn't work or if you don't know the IP of your Raspberry, use HDMI and Keyboard. Login and check your IP:

ifconfig

while being on the Raspberry try to connect ssh from there:

ssh -vvv localhost

does it work? If no, post the error. If yes try to connect from there to your IP:

ssh -vvv 192.168.1.1
0

For some reason the zeroconf/avahi/bonjour/link-local/whatever-you-call-it isn't working. I have no idea why this happens or how to fix it, but you can work around it.

Method 1:

  • Connect your raspberry pi to your computer.
  • When it is recognized as a new network connection, open your network configuration.
  • Set the IPv4 method to 'shared to other computers'.
  • Reconnect to this network
  • Run ifconfig and check for a line like (the bold number must be 1):

    inet 10.42.0.1 netmask 255.255.255.0 broadcast 10.42.0.255

  • Run tail /var/log/syslog and look for a line like (the ip should be the same as in the previous line, except for the bold part):

    dnsmasq-dhcp[489]: DHCPACK(enp0s20f0u1) 10.42.0.114 12:34:56:78:9a:bc raspberrypi

  • Use this ip to connect: ssh pi@10.42.0.114

  • If your computer has internet access, your raspberry pi should now have internet access as well.

Method 2

  • Insert the SD card into your computer and append the following lines to the etc/dhcpcd.conf on the storage partition:

    # Set a static ip for when connected to USB
    interface usb0
    static ip_address=169.254.64.64
    
  • Unmount the SD card and insert it into your raspberry pi zero.

  • Connect your raspberry pi to your computer.
  • When it is recognized as a new network connection, open your network configuration.
  • Set the IPv4 method to 'link-local'.
  • Reconnect to this network
  • You can now connect: ssh pi@169.254.64.64
  • However, this won't provide your raspberry pi with internet access.
  • Method 2 assumes that you are using either a Pi Zero or Pi Zero W: only these two hardware versions support USB gadget mode, where you turn the Pi Zero/W into an USB device, which then appears as an Ethernet USB adapter at your PC. In addition, this requires you to reconfigure your Pi Zero/W to load the proper drivers for Ethernet gadget mode. – TheDiveO Jun 23 '17 at 14:29
  • The question is about the Pi Zero, and it is pointed out that those configuration steps have been performed. – bcmpinc Jun 23 '17 at 14:50
0

go to your settings you should see an ethernet connection with RNDIS/Ethernet Gadget. Then go to your setting and set the ipv4 to "share with other computers".

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.