Rpi zero 2 w headless

Hi all,
I have just unpacked my new RPi zero w 2 and am trying to get it running headless.

Following CE tutorials is difficult as some of the features seem outdated i.e. Why am I instructed to install Jessie when the SD card comes with noobs already installed?
More importantly, PuTTY says, as before stated by others, “raspberrypi - host does not exist”

  1. I have checked the SD card root directory, SSH is there and wpa_supplicant.conf has changed to wpa_supplicant.conf.bak
  2. I have read SSH Troubleshooting and done ipconfig /flushdns
  3. tried using “raspberrypi.local”
    but still "host does not exist.
    Please help.

Also I would like to access via GUI remotely, have you developed a procedure to make that possible?

Kind regards,
Stephen

Further to the above:
I was able to find the IP Address of the Pi Zero and entered it to PuTTY.
The black edit screen came up BUT
“PuTTY Fatal Error
Network Error - Connection Refused”
message came up

Where to from here?

Stephen.

3 Likes

Hi Stephen,

I had a little trouble setting up my Pi Zero 2 also.
the best way i have found to set it up is within the Pi imager
hit “ctrl+shift+x” whist in pi imager to open the advanced setup. you can enable ssh and setup you wifi whilst there also.

its easier then messing around with adding a file named ssh and wpa config to your boot file, which is the standard way i guess.

I usually set up the host name at the same time (which you can do in Pi imager).

Good luck!

Jack

4 Likes

Hi Stephen and Jack,

Welcome to the forums and thanks for making a post! I’ve just checked our Zero Headless setup guide and it is definitely due for an update, so I’ll get on that today.

NOOBS cards contain installation files for several OS’s. They now install Raspberry Pi OS (formerly Raspbian) by default, but you used to have to pick an OS.

It’s important to note that PuTTY searches on the local network. You’ll need to check that the computer you’re using to connect to your Pi, and your Pi, are both on the same network (ie. the first three numbers of the IP address are the same, eg. 192.168.1.X). Note that this might not be the case if your PC is connected via ethernet, or via 5GHz Wifi, and not the 2.4GHz wifi the Pi is on (depending on how your router is configured).

You can check the IPv4 address of your windows machine by opening a command prompt (Win+R => cmd, hit ‘Run’) And then enter ipconfig (with no commandline arguments). This will give you something like this:
image

Also, note this section from the guide. You probably want to enable SSH permanently, rather than just once off. Else it will disable when you reboot your Pi (which might be why you’re now hitting a wall):

If you want permanent SSH access, but it’s disabled after you reboot the Pi and you have to recreate the “ssh” file again to get it back:

  • Create the “ssh” file again as described above
  • Run the command sudo raspi-config
  • Go to 5 Interfacing Options and press enter
  • Select and press enter
  • Select and press enter
  • Reboot your Pi to ensure it worked

You’ll need to look into using VNC. There’s some excellent detail in the official Pi docs and this MagPi article:

:+1: The hidden menu in Raspberry Pi Imager makes it super easy these days - just note that this menu was only added in the v1.6 Release in March last year, so if you happen to have an old version of Pi imager, it won’t exist in your version - so make sure you download the latest release.

Hope this helps!

2 Likes

Thanks Jack and Oliver.
I purchased a new SD card and will do what you suggested Jack. Others have said the same but I can’t follow some of the US posts, too much slang!.

Oliver,

  1. Last night I checked the IP addresses and they are all on the same wifi network.
  2. I am puzzled as to how I can run the “sudo raspi-config” etc if I cannot get into the board in the first place?
    also, I checked the SD card and the SSH line was still in the root directory.
    **Interestingly - The SD card in the kit from Element14 came up with two drives, Removable Disk (E:) and RECOVERY (F:)
  • E:\ is not accessible.
  • F:\ showed all the files I was told to expect in the root directory, so that’s where I put the SSH and the wpa config.
    This is also puzzling??
3 Likes

Ahh, troubleshooting network issues via a network is always very difficult. I’d strongly recommend connecting a keyboard, mouse, and display so you can configure it locally.

All you need is any old USB mouse + keyboard, a HDMI cable and a HDMI display (including a TV), and these two:

It will save you many a headache.

This is normal. A ‘drive’ in windows is a filesystem. A physical storage device can be partitioned into separate blocks, each with its own file system. Raspberry Pi’s have several ‘drives’ but being a Linux system it uses a filesystem that Windows is unable to read for its main ones.

If you press Win+X and open Disk Management, then insert your SD card you’ll see that it is divided up into a few different blocks. For example, here’s a screenshot of disk management on my PC, with a Raspberry Pi SD card inserted.

Note that my Pi SD Card doesn’t have a recovery partition, as it’s not a NOOBS card. Also note that the blocks aren’t displayed to scale in terms of their storage size.

3 Likes

Get an OTG USB hub, that way you can connect the Rpi to perpherals, apart from the mini HDMI to HDMI.

If the RPi is connected to the PC (Windows I am guessing), try the rasperrypi.local on Putty. The .local should work with a connected SSH shell or putty. Another you can try using an Android tablet is RaspController. It is like VNC, but it can access the shell and run commands. I tried and then bought the paid version, removes ads. Very useful. Can be installed on multiple andoid devices under the same google play account.

From my experience, get a microSD card of sandisk or samsung evo. Preferably, Class 10 (or UHS 1). Class 30 (UHS 3) does not play well with RPi. It would work initially and then just disappear from the network (Pi Zero W).

As of late, Raspberry Pi Foundation does not recommend Noobs. Just download Balena Etcher for Windows and use it for writing the Pi image, if you’re using a Windows PC.

3 Likes

The WPA and SSH file should be placed in the boot directory, which is the top level of the SD card you are using. If the Pi doesnt see an SSH file in that top directory on bootup it will keep SSH connectivity disabled.

I would try and reflash the sd card using the Pi imager and see what happens.

3 Likes

Hi Jack,
Done what you said, used Imager with Step 2.5 to burn new Toshiba Class10 SD.
zero booted ok and am now updating some some packages, because it wanted to.

Next step, I gather, is to retry Getting on with PuTTY - X fingers!

4 Likes

Hi G177630, Will check out your advice.
The kit included an OTG adapter so I am now using my wife’s wireless keyboard and mouse + monitor to get Zero going.
I will source a hub as well, it will be useful elsewhere .
Android control is where I want to end up with this project.
Thanks heaps.

4 Likes

Hi Oliver, good explanation, thanks, there’s no mention of that inaccessible E:\ so I guess it doesn’t concern me.

Am I correct that my next step is to boot Zero by itself, power only, and see if PuTTY can access it?

5 Likes

Hi all, A progress report.
SUCCESS !!!

  • Burnt RPi OS to new SD with hidden parameters as per Jacks notes.
  • Booted Zero as non-headless and it started Desktop and logged onto my Network, all OK
  • I started Terminal and enabled SSH then exited, all OK
  • Rebooted Zero headless and when the excited LED settled…
  • Opened PuTTY on Windows PC - entered host name “raspberrypi” - doesn’t exist - #$%^&@*
  •   entered host name "raspberrypi.local" - SUCCESS - terminal started - great!!
    
  •   ran some commands - all OK
    
  • Shut down Zero using sudo halt and exited PuTTY
  • Rebooted Zero & tried to access via PuTTY on another Win PC - doesn’t exist - again.
  • Re-installed SSH to SD root directory and Re-booted Zero headless.
  • PuTTY again said “raspberrypi.local” doesn’t exist.
  • Tried again using IP Address instead of Host Name - SUCCESS
  • Have logged in a few times successfully since BUT only using IP Address - no luck with Host Name

Thanks heaps, all of you.
The saga will continue t’mora.

Stephen

4 Likes

Did you change the hostname during the advanced setup in pi imager?
If you did thats your new host. Or you could reflash and change the host to something else and see if you can then connect with SSH.

image

If that doesn’t work then all the best to you im out of ideas XD

3 Likes

I have had similar experience with my Pi Zero W with Putty. I was using my RPi 4. Then, I SSH-ed directly from RPi 4 to the Zero using the terminal. I would have to use the IP address, most of the time. Sometimes the computer name will work.

While setting up the Zero for Xmas lights at a different location (not my home), I just modified the WPA supplicant file with the new network ID and password using an external card reader on the RPi 4. Once the Zero booted up, I just used the Raspcontroller app on my Android tablet.

Regarding the SD card issue I mentioned earlier, once I do any update, the SD card will not work to boot the Zero. I do not have any experience with Toshiba UHS 1 cards though.

3 Likes

This is a common problem, host names need to be resolved to IP addresses and if there are no applications or servers on the network to resolve names then it will fail. I use MS Windows and I found in all instances, drive mapping, SSH, etc, using the IP address it the best option. But this leads to another problem if the router assigns a different address.

So, I set the router to map the MAC address of the Pi to a particular IP address, that way the router never changes the address.

Regards
Jim

3 Likes

Hey Stephen,

To setup the GUI interface I use VNC, depending on your image it might be already installed.
If not run

sudo apt-get install realvnc-vnc-server

And make sure VNC is enabled under Interfaces in RaspiConfig, while you’re here set a default resolution under ‘Display Options’ - this is the resolution at startup, with or without a monitor plugged in.

To get setup with a cloud connection(You’ll need an account) open VNC in the top left (A restart may be required)
Click the Hamburger menu, licensing, then sign in.

Open up VNC Viewer on your PC and a new client should pop up.

2 Likes

Mornin G,
I will burn another SD to an alternate network I have access to with revised ‘supplicant’ file and see how it works.
Will also have to experiment with ‘port forwarding rules’ etc. - I think!

3 Likes

Hi James, good to hear from you.
I’m not sure whether I’m game to fiddle with my router yet. Wife would get very upset if I stuffed it up. We live in the bush and everything comes via interweb.
BUT i’ll investigate - thanks

3 Likes

Liam, good morning.
This is where I’ll probably be heading next.
My main aim is to control motors and camera via network.
Should I be using VNC or maybe RaspController?

  • reviewed by Tim in August last year - looks interesting ??
3 Likes

Hey Stephen,

Ahh I had forgot about RaspController, if you’re just looking to do Camera and GPIO that should work perfectly.from the looks of it!
I’m not 100% certain how you would setup the motors, keen to see how you do it though!

VNC lets you basically be wired into the Pi, emulating a keyboard and mouse much like it was plugged into the monitor infront of you.

2 Likes