1

I have this freshly bought Raspberry Pi 0 W. I created a USB connection between the rpi and my laptop (ubuntu 20.04) and I ssh-ed into the rpi.

The OS on the pi is Raspberry OS Lite. Using a microSDHC 32GB from SanDisk.

I power the pi from my Galaxy S7 phone charger, has 5V and 2A, it's pretty old. But in this case it also gets power from laptop's USB.

The issue is that I cannot see any wi fi networks when scanning, but my router is 1 meter (3ft) away from my rpi (i do have a 2.4 Ghz network)

Should I consider sending the RPI back to the seller? Or do you see any fix to this?

Here is the output of some commands from which you could get an idea of the situation:

pi@raspberrypi:~ $ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.42.0.164 netmask 255.255.255.0 broadcast 10.42.0.255 inet6 fe80::791:86e2:3cb7:26c7 prefixlen 64 scopeid 0x20<link> ether e2:c9:a6:a8:02:37 txqueuelen 1000 (Ethernet) RX packets 148 bytes 17566 (17.1 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 109 bytes 15174 (14.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether b8:27:eb:f3:6a:c2 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

pi@raspberrypi:~ $ uname -a Linux raspberrypi 5.10.17+ #1414 Fri Apr 30 13:16:27 BST 2021 armv6l GNU/Linux pi@raspberrypi:~ $ cat /etc/debian_version 10.9 pi@raspberrypi:~ $ cat /proc/cpuinfo processor : 0 model name : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 697.95 Features : half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7

Hardware : BCM2835 Revision : 9000c1 Serial : 0000000014a63f97 Model : Raspberry Pi Zero W Rev 1.1

pi@raspberrypi:~ $ ip a s 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether e2:c9:a6:a8:02:37 brd ff:ff:ff:ff:ff:ff inet 10.42.0.164/24 brd 10.42.0.255 scope global dynamic noprefixroute usb0 valid_lft 3118sec preferred_lft 2668sec

And here you can see the no results found:

pi@raspberrypi:~ $ sudo iw dev wlan0 scan
pi@raspberrypi:~ $ sudo iwlist scan
lo        Interface doesn't support scanning.

usb0 Interface doesn't support scanning.

wlan0 No scan results

pi@raspberrypi:~ $ sudo iwlist wlan0 scan wlan0 No scan results

I tried using the wpa_supplicant.conf file but to no success. I even tried to do a headless wi-fi start but it wouldn't connect to my network. (i couldn't ping it or see it on my router's devices' list)

My router type is a TP Link Archer C64. It is just an acces point, connected to another router which is the gateway to the internet.

I honestly do not know what to do anymore. Tomorrow I'll receive an OTG adapter and I will connect my keyboard to the pi. But I think I should have been able to see some networks even when ssh-ed through USB cable.

UPDATE:

Here is the wpa_supplicant.conf that I tried to use before booting up the pi. Password has been changed in order to post here.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=RO
update_config=1
network={
 ssid="Camera2"
 psk="66354632A"
}

After booting up, I ssh-ed through USB then I did a wifi scan and no results. Then I did

sudo raspi-config

And I set the wi-fi location as Romania. After that I had to reboot. Then I would no longer be able to ssh through USB and I see on the pi monitor (i have an HDMI plugged into it) "my ip address is 169.254.34.95"

A quick google says this ip is gotten at a failed dhcp. But the pi is still not on my router's device list.

Probably it tried to get an address from the usb connection once it rebooted.

EDIT 2: I eventually managed to ssh in it using the USB. Here is some output. Still not seeing any wi-fi. (Remember that this time the location wifi has been set through raspi-config to Romania) and it rebooted.

pi@raspberrypi:~ $ cat /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=RO

network={ ssid="Camera2" psk="246563563A" } pi@raspberrypi:~ $ sudo iwlist scan lo Interface doesn't support scanning.

usb0 Interface doesn't support scanning.

wlan0 No scan results

pi@raspberrypi:~ $ sudo iw dev wlan0 scan

Mihai
  • 11
  • 3
  • 2
    Did you try in raspi-config under 4 Localisation Options and then under I4 Change Wi-fi Country setting a country? Otherwise rfkill will disable your WiFi. – Ljm Dullaart Aug 12 '21 at 15:44
  • At some point I did that too, but I was trying to connect through wpa_supplicant and I did not do so much scanning. I will try again. So I will ssh into it, do the localisation thing, then scan. Is this order ok? – Mihai Aug 12 '21 at 17:39
  • Post the contents of /etc/wpa_supplicant/wpa_supplicant.conf (with the SSID and password redacted). There's some stuff that must be in that file. Undo any changes you've made to /etc/network/interfaces as that breaks networking. – Dougie Aug 12 '21 at 17:41
  • Do you want me to write the wpa_supplicant.conf before booting up the pi? Or after I ssh into it through usb? – Mihai Aug 12 '21 at 17:50
  • Updated the main topic. – Mihai Aug 12 '21 at 18:22
  • I wonder if your difficulties are due to using your Pi 0W as a *USB OTG* device? – Seamus Feb 11 '23 at 22:05

1 Answers1

2

Have you checked this?:

ifconfig says wlan0 is present, but not RUNNING, so perhaps check that wpa-supplicant.conf was actually created:

$ less /etc/wpa_supplicant/wpa_supplicant.conf 

The file should be present, and roughly structured like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=UK

network={
ssid="YourWiFiSSID"
psk="YourWiFiPassword"
}

You can also use wpa_cli to verify that wpa_supplicant is actually running:

$ wpa_cli list_networks

which should yield something like this iaw my system, where Mesh01 is the SSID of my wifi:

Selected interface 'p2p-dev-wlan0' network id / ssid / bssid / flags 0 Mesh01 any


Epilog: However it now occurs to me, 18 months later, that the issue you may be facing is that by connecting your Pi 0W to your Ubuntu via USB you are using it as a USB On-the-Go device. This changes everything! This answer speaks to that difference, and may help sort the issues associated with using the wifi interface as you seem to be trying to do.

Seamus
  • 21,900
  • 3
  • 33
  • 70
  • In the main post, down at EDIT 2, I have managed to ssh in pi while having a supplicant. There I did a cat command and I showed it in a code snippet. Unfortunatelly, I got no results from scanning. Perhaps I should have checked the output of ifconfig again? As you can see, the supplicant is there. – Mihai Aug 13 '21 at 05:49
  • So how do we make sure it gets RUNNING? – Gauthier Feb 11 '23 at 11:10
  • @Gauthier: That's actually a good question. I've addressed it with an edit to my answer, but I wish you'd post it as a new question. I thought I knew the definitive answer, but when I checked an earlier Q&A that I've relied upon, it seems that things have been changed! – Seamus Feb 11 '23 at 20:41