6

I'm trying to set up a Raspberry Pi Zero W as a headless device on my local network, and am performing the initial setup with a fresh copy of Raspbian Stretch

I've tried installing both the latest Raspbian Stretch lite and the latest Raspbian Stretch with desktop, and was able to get it set up for SSH by configuring the wpa_supplicant.conf file with WiFi credentials and creating an empty ssh file.

I've tried SSH'ing in from multiple different computers, and the problem is the same every time. I log in with pi@192.168.0.102, which I've confirmed to be the devices' IP Address. It asks for the password, so I type raspberry, as per the online guides. It does not accept it. It will repeat the password: field 3 times, then ask for pi@192.168.0.102's password:.

At this point, I get "Permission denied, please try again". I get the same password query again, and upon entering it:

Received disconnect from 192.168.0.102 port 22:2: Too many authentication failures. 
Authentication failed

Adding -v for debug just shows it trying all my local private keys in my .ssh folder, which are for something else (so they don't work of course) and eventually falling back to publickey,password,keyboard-interactive, where it asks for the password again.

I am absolutely certain that raspberry is the correct password, as multiple online sources have confirmed it, and I am certain I've type it correctly (I even had a friend type it for me to no avail).

What's going on here?


Edit: I've tried from MacOS, Windows, and Android (Termux with OpenSSH installed), and I've tried connecting over USB instead of WiFi. The issue persists. Maybe there is some way to generate an SSH key for the pi? (I don't have a Mini HDMI converter so the GUI is not accessible)

Edit2: I was able to get into the terminal via USB OTG, and the default password worked. I changed the password. After some tinkering around (I'm not entirely sure what changed), I was able to SSH in via an emulated Ethernet over USB as pi@raspberrypi.local. That means my real issue is with connecting to the WiFi - something I've already spent 2 hours trying to get work while connected with g_serial.

Edit3: I decided my best course of action was to try and set up a VNC server on the Pi. I was able to successfully share my internet from my work MacBook and SSH in. However, I'm getting errors while running sudo apt-get install tightvncserver:

Err:41 http://mirrordirector.raspbian.org/raspbian stretch/main armhf tightvncserver armhf 1:1.3.9-9
Cannot initiate the connection to mirrordirector.raspbian.org:80 (2a00:1098:0:80:1000:75:0:3). - connect (101: Network is unreachable) [IP: 2a00:1098:0:80:1000:75:0:3 80]

ifconfig for the USB ethernet connection returns this:

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 192.168.2.3  netmask 255.255.255.0  broadcast 192.168.2.255
inet6 fe80::f87c:94fd:7b3e:454d  prefixlen 64  scopeid 0x20<link>
ether 4e:38:f5:71:6e:74  txqueuelen 1000  (Ethernet)
RX packets 2080  bytes 214353 (209.3 KiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 1935  bytes 348268 (340.1 KiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Pinging mirrordirector.raspbian.org

ping mirrordirector.raspbian.org
PING mirrordirector.raspbian.org (93.93.128.193) 56(84) bytes of data.
^C 
--- mirrordirector.raspbian.org ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4151ms
Matt
  • 107
  • 4
Arlo
  • 211
  • 1
  • 2
  • 10
  • Not sure, but maybe it's just the wrong keyboard layout. Germans have to type raspberrz because y and z are switched on GB and DE keyboards. – framp Dec 18 '17 at 18:03
  • I'm using U.S. Keyboard layout – Arlo Dec 18 '17 at 18:18
  • What OS is your client computer? ... GNU/Linux distro? Windows? Mac? – RubberStamp Dec 18 '17 at 18:29
  • I've tried using Mac (iTerm), Windows (Putty), and Android (Termux with openssh installed). Same result on every machine. – Arlo Dec 18 '17 at 18:42
  • Did you try to use the normal terminal on Mac? Maybe also try a reinstall of the image onto the SD card? – Darkest N2O Dec 18 '17 at 19:20
  • Normal terminal doesn't work. I redownloaded both Raspbian and the Lite version from raspberrypi.org/downloads and both installations are doing it – Arlo Dec 18 '17 at 20:18
  • Check out my guide on how to debug SSH problems on the server side here. Doesn't mean that there is an SSH problem, but my guess is that password authentication is blocked by default (which is good!) or similar. You may also simply try to add one or more of your existing public keys to the RPi pi account under ~/.ssh/authorized_keys. – 0xC0000022L Dec 18 '17 at 20:53
  • Other users in this situation have later realized that the IP address is actually a device other than the Pi Zero. You can confirm whether it is (please edit your post) by using zeroconf i.e. ssh pi@raspberrypi.local or confirming that 192.168.0.102 goes offline the moment you depower the Pi. Another way to log in headless, assuming you don't have a three-pin serial cable, is g_serial. See https://raspberrypi.stackexchange.com/questions/67907/debugging-usb-otg-serial-on-the-pi-zero-w/75551 and yes you can generate an ssh key and place it under /home/pi/.ssh/ with Linux and an SD card reader. – jdonald Dec 18 '17 at 22:15
  • 1
    I connected the Pi directly to my Mac and connected to pi@raspberrypi.local and got the same result. I also tried installing Raspbian using PiBakery and telling it to set up with an SSH key, but it wouldn't take accept it (May have done that part wrong.) I will try debugging with USB OTG and see if that helps – Arlo Dec 18 '17 at 22:22
  • Thanks for clarifying that the IP address is correct. You also mentioned that you've reinstalled Raspbian twice so that mostly rules out being botnet-compromised (on top of its IP never being visible to the outside world). As g_serial still requires a login and password it seems that may not help at this point. For directly editing /home/pi/.ssh/authorized_keys and examining /var/log/auth.log, I realize you have every OS except for desktop Linux. If your Mac has an SD card reader you can install Paragon ExtFS for Mac. Very curious as to what the eventual answer turns out to be. – jdonald Dec 19 '17 at 17:19
  • I have Parallels desktop for my Mac, installed Ubuntu on it, and was able to log in via USB OTG. The correct password was indeed raspberry, and I successfully changed the password. However, even after changing the password, I am still unable to SSH into the pi. I am getting the same issue as before. I know I am trying to connect to the correct device because it gets far enough to ask for the password for the user 'pi'. – Arlo Dec 19 '17 at 19:02
  • Awesome! Now you can do some deeper troubleshooting via ssh pi@localhost from within the serial console. You may tail -f /var/log/auth.log when doing such tests too. If you need to test ssh from outside while still logged in from serial, use g_multi instead of g_serial. (Note the usual caveat of options g_multi file=/dev/mmcblk0p1 so that it doesn't complain about an invalid argument to mass storage.) Well, if your wireless is now confirmed working you might as well just use that and stick with g_serial. When you have more logs please edit your post accordingly to include them. – jdonald Dec 19 '17 at 20:38

5 Answers5

4

I've figured out the issues and got in, here's how I did it.

The Raspberry Pi can only connect to 2.4GHz networks. I had properly configured the wpa_supplicant.conf file, but I specified a 5GHz network instead of 2.4GHz.

I do not know why it was asking for pi@192.168.0.102's password when that user did not exist on that device, but don't let it fool you, just because it shows the user does not mean that the user exists on the machine you're connecting to.

I connected to my Windows machine with g_ether, and was able to SSH into the pi from raspberrypi.local over USB. From there, I eventually decided to attempt to Remote desktop in. Since I didn't have internet on the Pi, I couldn't use apt-get. Therefore, I manually installed RealVNC Server with dpkg from here (You need the Full version of Raspbian, not Lite). Using MobXTerm, I was able to transfer the .deb package to the Pi over SSH

After the server was installed on Raspbian Full, I connected to raspberrypi.local from the RealVNC client. From there, I could see a list of WiFi networks. Or the 2.4GHz networks, at least. I simply connected to my other network, used ifconfig to get the IPv4 address, and was able to SSH into the Pi over WiFi. Problem solved!

Arlo
  • 211
  • 1
  • 2
  • 10
  • 1
    So it sounds like 192.168.0.102 turned out to be the IP address of something other than the Pi Zero. This tends to be a first culprit when troubleshooing most headless scenarios (see the part buried in that question's comments that says "Hello @jdonald. So I don't think I have the right IP address for the raspberry pi". One thing that wasn't resolved is why internet connection sharing never worked via g_ether, but glad this piece wasn't necessary in the end. – jdonald Dec 28 '17 at 01:29
  • Hi, Arlo, I connected the PI with an ethernet cable to my iMac. To know the IP address of PI I checked the Ethernet connection in Network in System Preferences.So I typed ssh pi@EthernetIPAddress, I encountered the same problem like you but I don't want to install RealVNC Server like.Can you suggest something that suits my situation? – Divya Galla Mar 10 '18 at 11:09
0

Trying to SSH in with raspberrypi@ip.address will fail as there is no default user name called raspberrypi.

SSH with pi@ip.address will work

Pi Documentation here: https://www.raspberrypi.org/documentation/remote-access/ssh/windows10.md

  • There is no command like that in the question to begin with. Did you post your answer in the wrong place? – Dmitry Grigoryev Jan 04 '21 at 12:08
  • This looks like you may have mis-read the question. (I considered that possibly the original question was edited and did check the edit history). The OP writes that they are attempting to use the 'pi@...' user, which should exist as a default account unless it was disabled or removed. – Tim Campbell Jan 05 '21 at 14:33
  • Apologies, I misread the original question. :-( – CIL - ELECTRONICS Jan 05 '21 at 15:55
0

For me it was quite simple: I always tried to ssh using pi@<ip-address> not realizing pi being the user I am trying to log in as. Since this user did not exist, all password attempts were futile.

The command is:

ssh <username>@<ip-address>
Ben
  • 1
0

I found myself puzzled with the password too most of the times. The issue was that my keyboard layout was wrong, so I tried typing "raspberry" while I really typed "raspberrz". Maybe check your keyboard layout. Also double check if SSH really is enabled in the "sudo raspi-config" menu. Edit: Oh sorry, I really overread the part where you wrote that you found the solution.

MeebusJaximus
  • 101
  • 2
  • 2
  • 8
-1

In my experience, trying to headless is a pain the (insert preferred body part here), and you would be better off just using HDMI or similar to set up the Pi, change the password, and then try SSH-ing into it.

Lucas Thelen
  • 95
  • 1
  • 5
  • I don't have a Mini HDMI adapter – Arlo Dec 18 '17 at 18:58
  • Elaborating on the comment above, raspberrian does not like using U.S. keyboard in the terminal. – Lucas Thelen Dec 18 '17 at 19:02
  • I switched the Mac to Britain layout, authentication still fails – Arlo Dec 18 '17 at 19:07
  • Did you try reinstalling raspberrian – Lucas Thelen Dec 18 '17 at 19:09
  • 1
    I've reinstalled Rasbian twice – Arlo Dec 18 '17 at 20:14
  • 1
    Raspbian has no problem whatsoever with a US keyboard layout on the terminal, provided you configure it to use that instead of the preconfigured UK (IIRC) layout. – 0xC0000022L Dec 18 '17 at 20:50
  • 1
    Now that the password has worked (at least via g_serial/g_ether/g_multi) and it's back to WiFi troubleshooting, Lucas's answer may not be so far off. Generally users have more trouble troubleshooting wpa_supplicant.conf with the command line compared to the Pixel GUI. Similar to using HDMI, @Chuck Fecht can you try connecting to WiFi from within VNC? I'm assuming by this point you got internet connection sharing working over USB and hopefully have no trouble running apt-get. – jdonald Dec 20 '17 at 17:18
  • Brilliant idea. I was able to finally share Internet to the Pi via my Mac (Ubuntu gave me an odd error message and wouldn't share), while also successfully SSH'ing into the Pi. However, during installation of tightvncserver, I got the error Err:41 http://mirrordirector.raspbian.org/raspbian stretch/main armhf tightvncserver armhf 1:1.3.9-9. \n Cannot initiate the connection to mirrordirector.raspbian.org:80 ([mac address]) - connect (101: Network is unreachable). It told me what new packages needed to be installed, how much space it would take, etc, so I assume it didn't completely fail? – Arlo Dec 20 '17 at 21:14
  • Can you even ping mirrordirector.raspbian.org or other sites from the Pi? The fact that you can ssh in may just mean it's locally connected but not sharing internet. Yes, Linux has trouble other than "Link-Local Only" (see other questions here on Pi Exchange), but Mac and Windows are solid. On your Mac, does your sharing setup match the screenshot on this question? If you have connectivity but it's a DNS issue, you troubleshoot by using IP numbers or manually setting your DNS server. – jdonald Dec 20 '17 at 21:41
  • I've updated the question to return Ping results (got no response). I do have it properly set up for Internet Sharing, but further looking into it, the Router, DNS Server, Search Domains fields are all blank. How would I properly configure the DNS for the pi? – Arlo Dec 22 '17 at 02:30
  • It appears able to DNS-resolve even if unreachable, otherwise it would have said ping: unknown host mirrordirector.raspbian.org so I don't think DNS is your issue (if it were you could add a nameserver field to /etc/resolv.conf). If you're positive that both Internet Sharing + RNDIS/Ethernet Gadget are checked and you've selected the correct Share from WiFi vs Ethernet, not sure what's failing. Could next try Windows (Note Windows is more troublesome on g_ether, sometimes requiring explicit RNDIS driver install and careful network right-click -> Sharing -> Allow, Select private...) – jdonald Dec 22 '17 at 18:45
  • I added nameserver (Using Google's DNS server) to /etc/resolve.conf, that didn't do much. I've tried sharing from Windows as well now (using instructions found on the majority of websites) and that gave the same result (But it did install the RNDIS driver on its own, and I was able to SSH in using Putty and reinstalling Raspbian stretch lite again). Could it be something to do with the network Gateway? (I assume the gateway acts as a proxy between the Pi and the host computer?) – Arlo Dec 22 '17 at 20:01
  • I stumbled across this: https://www.realvnc.com/en/connect/download/vnc/raspberrypi/, so I SHOULD be able to place the file on the SD card and install using dpkg from an SSH session. I'll update whether this worked or not after I get back from Christmas vacation. – Arlo Dec 22 '17 at 20:14
  • 2
    Success!!! I've gotten my Pi set up and working. I had to install Raspbian Stretch full (not light) to install RDP, and it turns out the issue was that the Pi Zero W cannot connect to 5GHz networks, only 2.4gz. I connected it to my 2.4 network and it was smooth sailing from there. Thanks for everyone's help! I'll add an answer detailing my problem and solution later – Arlo Dec 25 '17 at 19:52