raspberrypi / bookworm-feedback

13 stars 1 forks source link

Cannot ssh into headless Pi Zero W #82

Open RaduAvramescu opened 1 year ago

RaduAvramescu commented 1 year ago

Hardware: Pi Zero W, USB OTG Cable, 16 GB microSD Card OS: Raspberry Pi OS Bookworm Lite (32-bit)

Issue

ssh pi@raspberrypi.local returns ssh: Could not resolve hostname raspberrypi.local: No such host is known. when Pi Zero W is connected as an Ethernet gadget (only the port labeled USB is used on the Pi) to a Windows 11 PC/Debian Bookworm laptop.

Additional information

The image is burned to the microSD card, and the required modifications to config.txt and cmdline.txt are made, and ssh file is created in /bootfs. For config.txt, dtoverlay=dwc2 is added at the end, and for cmdline.txt, modules-load=dwc2,g_ether is added after rootwait.

The image was burned to the microSD card using the snap version of rpi-imager on the Debian Bookworm laptop. Additionally, in some attempts, the advanced options were used and SSH was enabled from them, as well as setting the hostname, and username and password.

To note, the issue cannot be reproduced with the Bullseye Raspberry Pi OS release (the one currently labeled Legacy).

These are some references to what I've looked at for this:

Steps to reproduce

  1. Run rpi-imager on Debian Bookworm
  2. Burn the latest Raspberry Pi OS Bookworm Lite (32-bit) image to a microSD card without ticking any of the advanced options
  3. Reinsert the SD card so that /media/{PC Name}/bootfs and /media/{PC Name}/rootfs are mounted
  4. Edit /bootfs/config.txt and add dtoverlay=dwc2 at the end
  5. Edit /bootfs/cmdline.txt and add modules-load=dwc2,g_ether after rootwait
  6. Create empty ssh file (no extensions) in /bootfs
  7. Unmount the partitions
  8. Insert the microSD card in the Pi Zero W
  9. Use an USB OTG cable to connect the USB labeled port on the Pi Zero W to a Debian Bookworm/Windows 11 machine
  10. Attempt to run ssh pi@raspberrypi.local or ping pi@raspberrypi.local in a terminal
  11. Observe the error
6by9 commented 1 year ago

Sounds like a duplicate of #50

RaduAvramescu commented 1 year ago

@6by9 I don't think so because I can't ssh nor ping, which seems to be possible in that issue. But do correct me if I'm wrong of course, I don't have much knowledge in this topic.

aallan commented 1 year ago

You don't mention creating a userconf.txt, see https://www.raspberrypi.com/documentation/computers/configuration.html#remote-access, which makes me think you may not have created a user account. There is no default user on a Raspberry Pi any more.

RaduAvramescu commented 1 year ago

@aallan In the normal steps I have not, which is a mistake on my part, but I did attempt a few times to create the username and password in the advanced settings which did not work unfortunately.

Thanks for looking into it, I'll try the manual approach with userconf.txt as well and report back how that goes.

EDIT: Unfortunately, that didn't work either.

6by9 commented 1 year ago

Attempt to run ssh pi@raspberrypi.local or ping pi@raspberrypi.local in a terminal

Ping never takes a username, so I assume that's a typo.

Has the host machine issued an IP address to the USB gadget?

RaduAvramescu commented 1 year ago

Ping never takes a username, so I assume that's a typo.

Has the host machine issued an IP address to the USB gadget?

My bad, I copy pasted and didn't edit - the command I used was ping raspberrypi.local

Regarding the host issuing an IP address, I don't think so. On the Win 11 machine, using ipconfig /all, for USB Ethernet/RNDIS Gadget, there's only a physical address, DHCP enabled, and autoconfig enabled. For media state, it does say Media disconnected - this seems wrong.

Thank you as well for looking into it!

MLSci commented 7 months ago

Did you figure out a solution?

rodrigolange commented 5 months ago

I know that the topic is old, but just to register.

I had the same problem with a Pi W (not the W2), Pi imager 1.8.5 with settings such as ssh and username defined and Bookworm.

After some tries I almost downgraded to a previous Rasbperry Pi OS version. but at the end I left the Pi with a new image unattended for some 5~10 minutes, and when I come back ssh was working fine.

Previously I was trying to ssh to the Pi immediately after powering it on (as I do when rebooting or powering on an existing installation). I think the issue was that the Zero with Bookworm is simply slow to boot and configure itself for the first time.