5

I'm following Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

What I've done;

  1. flashed latest (2017-04-10) Raspbian image onto SD card,
  2. added dtoverlay=dwc2 on new line to config.txt
  3. created blank ssh file (without any extension) on ./boot partition,
  4. modified cmdline.txt file, by adding modules-load=dwc2,g_ether right after rootwait,
  5. booted Raspberry Pi Zero, waited for 90 seconds and tried to ssh pi@raspberrypi.local using ssh openssh client with Linux and PuTTY on Windows (Pi connected to PC using USB cable).

There was NO other changes made to SD card, other then what I mentioned above.

I'm able to ssh in from MacOS & Windows, but not from Linux:

$ ssh -v pi@raspberrypi.local
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /home/alexus/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
ssh: Could not resolve hostname raspberrypi.local: Name or service not known
$ 

What am I missing?

$ ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013
$ systemctl status avahi-daemon.service | grep Active
   Active: active (running) since Tue 2017-04-25 12:04:30 EDT; 2h 14min ago
$ grep ^hosts /etc/nsswitch.conf
hosts:      files mdns4_minimal [NOTFOUND=return] dns myhostname
$ avahi-browse --all --domain=local --verbose --terminate | grep -vE '(eno1|docker0|virbr0)'
Server version: avahi 0.6.31; Host name: X.local
E Ifce Prot Name                                          Type                 Domain
: Cache exhausted
: All for now
$ 

Please advise.


* UPDATE *

NSSWITCH.CONF(5):

$ grep ^hosts /etc/nsswitch.conf
hosts:      files mdns_minimal dns mdns myhostname
$ 

avahi-daemon.conf(5):

$ grep ^use-ipv /etc/avahi/avahi-daemon.conf 
use-ipv4=yes
use-ipv6=yes
$ 

use-ipv6=yes is disabled by default. I un-comment that line followed by restart of avahi-daemon.socket & avahi-daemon.service, I now sometimes able to see following:

$ avahi-browse --all --domain=local | grep -vE '(docker0|virbr0|eno1)'
+ enp0s20u8 IPv6 raspberrypi [XX:XX:XX:XX:XX:XX]               Workstation          local
- enp0s20u8 IPv6 raspberrypi [XX:XX:XX:XX:XX:XX]               Workstation          local
$

per output above, raspberrypi entry comes and goes

avahi-daemon@Linux:

May  5 10:42:10 wcmisdlin02 avahi-daemon[8336]: Joining mDNS multicast group on interface enp0s20u7.IPv6 with address fe80::150b:ff04:b4e9:692e.
May  5 10:42:10 wcmisdlin02 avahi-daemon[8336]: New relevant interface enp0s20u7.IPv6 for mDNS.
May  5 10:42:10 wcmisdlin02 avahi-daemon[8336]: Registering new address record for fe80::150b:ff04:b4e9:692e on enp0s20u7.*.
May  5 10:42:54 wcmisdlin02 avahi-daemon[8336]: Withdrawing address record for fe80::150b:ff04:b4e9:692e on enp0s20u7.
May  5 10:42:54 wcmisdlin02 avahi-daemon[8336]: Leaving mDNS multicast group on interface enp0s20u7.IPv6 with address fe80::150b:ff04:b4e9:692e.
May  5 10:42:54 wcmisdlin02 avahi-daemon[8336]: Interface enp0s20u7.IPv6 no longer relevant for mDNS.

- enp0s20u7 IPv6 raspberrypi [XX:XX:XX:XX:XX:XX] Workstation local:

$ ssh -v pi@raspberrypi.local
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /home/alexus/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
ssh: Could not resolve hostname raspberrypi.local: Name or service not known
$ 

+ enp0s20u7 IPv6 raspberrypi [XX:XX:XX:XX:XX:XX] Workstation local:

$ ssh -v pi@raspberrypi.local
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /home/alexus/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to raspberrypi.local [fe80::e0e0:f91:8e3:73b3] port 22.
debug1: connect to address fe80::e0e0:f91:8e3:73b3 port 22: Invalid argument
ssh: connect to host raspberrypi.local port 22: Invalid argument
$ ssh -6 pi@fe80::e0e0:f91:8e3:73b3%enp0s20u7 uname -a
Linux raspberrypi 4.4.50+ #970 Mon Feb 20 19:12:50 GMT 2017 armv6l GNU/Linux
$ 
  • What exactly is your question? advise on what? – Steve Robillard Apr 21 '17 at 21:23
  • 1
    How is the pI connected to the network or PC? What SSH software are you using? What if any error message are you getting? Did you wait long enough for the Pi to boot fully? How did you create the SSH file? Are you sure it does not have a file extension? Do not answer the above questions in the comments, edit your question instead. – Steve Robillard Apr 21 '17 at 21:36
  • 2
    @SteveRobillard I'd presume /PATH/ indicates the card is mounted in another system. – goldilocks Apr 22 '17 at 11:27
  • 1
    @SteveRobillard I created ssh inside of /boot (relative to SD card) – alexus Apr 22 '17 at 12:52
  • 1
    @Jacobm001 pinging you since you weren't mentioned properly above. – Steve Robillard Apr 24 '17 at 20:31
3

I understand this question is quite old, and perhaps resolved in some way other than posted. However, I've posted an answer to a similar question on the Unix and Linux StackExchange.

The short answer is that the GNU/Linux host Pc's Ethernet port needs to be setup with a network bridge through Network Manager's commandline tool nmcli. And then the Pi's OTG Network interface needs to be added to that bridge. Your DHCP server should then give your Pi an IP address through the GNU/Linux host PC bridged ethernet port.

Here's the longer answer:

How to setup Networking via Network Manager's nmcli for a Raspberry Pi connected to a host PC via the USB port running in OTG mode.

Hopefully this helps, if you still need help.

0

When using RNDIS to connect to a Linux host machine, the biggest pitfall (compared to the procedure with Mac/Windows) may be that you need to switch the connection method under IPv4 Settings to Link-Local Only instead of Automatic.

There's some mention of that in this other question and here too.

Otherwise, this works out of the box for me connecting a Raspbian 8 device with g_ether to an Ubuntu 16.04 desktop.

Well, it works for connecting one time. Another pitfall specific to Linux is that NetworkManager creates a new connection entry each time.

Could you confirm if you've already attempted configuring Link-Local Only? If the problem persists, please specify your host Linux distro (apparently it's something older with OpenSSH 6) to help narrow down. There is probably a lot else that could go wrong depending on interplay between Avahi, NetworkManager, and all things USB/ethernet.

-1

To me the "Could not resolve host name raspberrypi.local" would indicate that there is not any ip address connected to that hostname. You could try to use the ip address. If the ip address is static, that would be easy. If it changes, you could try a ping script to locate it. See question/answer Unable to resolve IP address for RPi connected through ethernet.

pi@RPi3:~ $ for x in $(seq 2 20); do ping -rc1 -W1 192.168.0.$x | grep 'from'; done
  • 1
    kind of defeats zeroconf altogether, not to mention it works for some platforms such as MacOS and Windows, just not Linux. – alexus Apr 27 '17 at 21:29
  • You are right. I'm not up on zeroconf, but if you just want to ssh from Linux system, you could try using ipv6, see stackoverflow.com/documentation/raspberry-pi/5701/…. – bstipe Apr 29 '17 at 12:15
  • 1
    I believe you're missing the whole point of zeroconf, as in order for me to get ipv6, I still have to hook it up to hdmi with keyboard and then login to get ip address. I'd like to understand what I can do on my Linux so I can connect to rpi without connecting it to anything other then USB OTG. – alexus May 1 '17 at 15:19
  • Is the 'avahi-daemon' running (ps -ef | grep avahi) on the Linux box? From Linux, will it ping -c1 raspberrypi.local and ping -c1 raspberrypi, how about ping -rc1 -I eth0 raspberrypi.local? Does host raspberrypi.local gives IP address (very bad! See #11 at linuxquestions.org/questions/linux-networking-3/…). I am just learning about zeroconf. – bstipe May 1 '17 at 15:47
  • 1
    as I stated in my original question avahi-daemon.service IS active (running), I'm unable to ping or host against raspberrypi.local. – alexus May 1 '17 at 16:07

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.