9 Replies Latest reply on Dec 6, 2017 7:59 PM by pathfider1998

    Raspberry Pi Zero W: Can't connect to SSH no matter what

    pathfider1998

      This is a very long story, so I will try to keep it as short as possible.

       

      1. I got RPi 0 W.

      2. I installed Raspbian Stretch Lite, the one straight from official site.

      3. I realized that mini HDMI converter hasn't arrived yet, so I decided to go headless. This is going to be a server, after all.

      4. Here's where the trouble began -- no matter what I do, I couldn't get the RPi0 to connect to Wi-Fi.

      5. So I tried network interface thing (involving those two lines: dtoverlay=dwc2 on config.txt and  modules-load=dwc2,g_ether on cmdline.txt, following guide from https://gist.github.com/gbaman/975e2db164b3ca2b51ae11e45e8fd40a )

      6. Installed Bonjour Print Service as instructed

      7. When it worked, it did show up as network device under the name Network Gadget with some more words in front of it, and it required installation of generic driver from Microsoft Corporation

      8. I could ping to raspberrypi.local, but no matter what I try, it always ended up with "Connection refused" error when trying to connect to port 22 when ssh-ing.

      9. Now it doesn't work at all, the device never shows up but the ACT LED is still on and flashes away as boot process continues (each tries were done after waiting longer than 90 seconds to ensure boot process is done)

       

      Here's the content of each config files, including "wpa_supplicant.conf" file.

      config.txt

      <snip, content identical to stock file>

      dtoverlay=dwc2

       

      cmdline.txt:

      dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=37665771-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether

       

      wpa_supplicant.conf:

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

      update_config=1

       

      network={

          ssid="********"

          psk="********"

          scan_ssid=1

          key_mgmt=WPA-PSK

      }

       

      I do have "ssh" file without extension and content in the drive called root, along with config.txt and cmdline.txt as they told me to do. They were there before first boot.

      What went wrong here? Please help!

        • Re: Raspberry Pi Zero W: Can't connect to SSH no matter what
          peteroakes

          I think you may find the instructions should tell you to put these files "ssh", "config.txt" and cmdline.txt" into the /boot/... folder, not the root.

          I have just done this with my PI Zero W and it worked ok with a few exceptions

           

          If I tried to pre-setup the WIFI with wps-supplicant file in /boot/...  it will not work with stretch, I tried Jessie and it worked first time

          1 of 1 people found this helpful
            • Re: Raspberry Pi Zero W: Can't connect to SSH no matter what
              pathfider1998

              Wow, this is confusing! Even the official documentation said they should be put into the root folder of a drive called "boot", not a folder called "boot"

              (because Windows, in its stock state, cannot read ext2 partition, I can't check the log until the setup has been done and I have to wipe it clean and start over again anyway)

              Does wpa_supplicant.conf file have anything to do with this? When I did not include this file, RPi didn't even show up on my computer as a USB client/slave.

              I'm also confused by the full version (including the region code) of the config file. Some say it's okay not to include that line, some say it's critical, and so on...

              This is going to be a tough fight, because I can't see the live log of things happening inside this teeny tiny board yet.

              Anyway, I will try your method, followed by a combination of all the solutions given by the community (on root, /boot/, ext2 partition, /boot/ on ext2 partition, etc.)

               

              Note: if your path looks like "/dev/sda/boot/", your tutorial may not be compatible with Windows. Windows uses single alphabet drive letters instead of 3 letters or more. Again, the only partition the user on Windows will see is a small 40mb partition named "boot". 1.37GB partition will not be visible.

                • Re: Raspberry Pi Zero W: Can't connect to SSH no matter what
                  peteroakes

                  The boot folder is the one that windows will see when you put the SD card into a windows machine, yes you will also get some windows errors because of the other partitions on the SD card, dont follow the windows advice and format them, that would be bad.

                  Just navigate into the boot folder using windows explorer or something, then create the files there

                   

                  My /boot/wpa_supplicant.conf contains only this (This is from perspactive of the windows view, not under linux, the content is the same, just the location will change under linux

                   

                  network={

                      ssid="********"

                      psk="********"

                      key_mgmt=WPA-PSK

                  }

                   

                  create an empty file in the /boot/ folder called nothing but "ssh" without the quotes of course, this will instruct linux to enable ssh at startup

                   

                  these are the only two files I found I needed to add before booting, but as I said earlier, this did not work for Stretch, just pixel or earlier

                  note when you boot up, the filwpa... is moved to /etc/wpa_supplicant folder under linx and will dissapear from the boot folder. the ssh named file will just dissapear once ssh is turned on

                   

                  that's all there is to it.

                   

                  ewhy were you adding the other files ??

                  1 of 1 people found this helpful
              • Re: Raspberry Pi Zero W: Can't connect to SSH no matter what
                peteroakes

                Also those instructions on github are for a pi zero, not a pi zero W and is attempting to get the PI to connect via the USB port by having it pretend it is an ethernet port. you dont need to do that with the PI Zero W, just do what I suggested with Raspian, not Stretch and it should work

                1 of 1 people found this helpful
                  • Re: Raspberry Pi Zero W: Can't connect to SSH no matter what
                    pathfider1998

                    I'm currently not at the workshop so that would have to wait for few hours, but thanks for helping!  I will try your solution once I go there. Everything sounds so similar to each other it's confusing my rusty brain. Also, that thing which sounds like a separate drive but is technically a folder and so on... whew.

                    (Silly me, I could have brought RPi here and used the good 3 hours I have between the class starts to fix this issue for good!)

                     

                    p.s. Windows simply does not detect ext2 partition so even if you try to format it, you can't do that directly, nor Windows will ever warn you of unknown partition type ("You need to format this disk" dialog). You have to use partition manager to erase the partition manually if you want to reuse your card for something else!

                     

                    EDIT: Used composite output to see the log, it seems like that whatever happens after it tries to copy "wpa_supplicant.conf" file throws everything off the sequence and it's trying to unmount /boot/ but it fails miserably.

                    EDIT: It seems like Raspberry Pi decided to throw pies at SD card instead of writing data normally, thus corrupting ext4 partition beyond repair, wrecking the entire boot process.

                    • Re: Raspberry Pi Zero W: Can't connect to SSH no matter what
                      pathfider1998

                      Unfortunately Raspberry Pi refuses to copy the file, thus it cannot connect to any network nor it can boot up normally.

                    • Re: Raspberry Pi Zero W: Can't connect to SSH no matter what
                      pathfider1998

                      Okay, after some experimentation, here's the result:

                       

                      1. RPi fails to copy wpa_supplicant.conf to its internal storage (ext4 partition on SD card)

                      2. SSH enabler script runs but does not detect the file, thus it terminates on its own

                      3. Kernel panic occurs

                      4. SD card data is corrupted beyond repair, thus system enters panic mode

                      5. It tries to dismount /boot/ and miserably fails

                      6. System halts

                       

                       

                      I'm starting to suspect my Pi is cursed and does not want to cooperate at all.

                      I'm now trying my final solution, PIbakery. If this fails too, then... I don't know anymore.