Covid lockdown has meant clearing out drawers and finding an old Raspberry Pi and having a bit of a tinker. After dusting off some fairly ancient command line skills, I ran into, what seems to be a common problem.
How do I get my super-cheap and nasty Wifi USB dongle to work so I can liberate the Pi from Ethernet cables?
Steps:
- Check the chipset on the cheap’n’nasty USB dongle: Ralink 5370
- Ask Dr Google for some helpful installation instructions, thanks Pi Hut
- Follow instructions for untethered networking bliss 😇️
Easy, right? No so fast.
pi@spy:~ $ sudo wpa_action wlan0 stop
wpa_action: ifdown wlan0
ifdown: reading directory /etc/network/interfaces.d
ifdown: unknown interface wlan0
wpa_action: removing sendsigs omission pidfile: /run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.wlan0.pid
pi@spy:~ $ sudo ifup wlan0
ifup: unknown interface wlan0
pi@spy:~ $ sudo wpa_cli status
Failed to connect to non-global ctrl_ifname: (nil) error: No such file or directory
pi@spy:~ $
And it was going so well.
I thought it might be down to having the Ethernet cable and the wifi dongle plugged in at the same time, but nope. The telltale blue LED on the dongle didn’t come on when I unplugged the Ethernet.
The network interface appeared to be alive and kicking, but without an IP address. Hmmm. 🤔️
pi@spy:~ $ ifconfig wlan0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 1c:bf:ce:dd:66:d2 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
Working hardware but no IP. Maybe a DHCP issue?
pi@spy:~ $ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.16 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::ce0d:279:6b89:7c28 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:e6:36:bc txqueuelen 1000 (Ethernet)
RX packets 623 bytes 97961 (95.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 267 bytes 44763 (43.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Nope, the Ethernet cable is working fine.
After more Googling and some experimentation, it adding a new config to the /etc/network/interfaces.d directory did the trick:
pi@spy:/etc/network/interfaces.d $ sudo cat wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "ssid"
wpa-psk "password"
A quick reboot later and the little blue light of Wifi loveliness appears on the USB dongle and sure enough both interfaces are alive and well. Hurrah!
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.103 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::f94f:42f:f2f3:d0b6 prefixlen 64 scopeid 0x20<link>
ether 1c:bf:ce:dd:66:d2 txqueuelen 1000 (Ethernet)
RX packets 377 bytes 108175 (105.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 78 bytes 11043 (10.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Security
Most of the instructions I found have the Wifi password in plain text. Probably fine, unless maybe your Raspberry Pi falls into nefarious hands or somehow gets compromised.
It’s dead easy to create a passphrase instead, which gives a little extra protection, the wpa_passphrase command line utility does the magic:
pi@spy:~ $ wpa_passphrase ssid superSecretPW
network={
ssid="ssid"
#psk="superSecretPW"
psk=436c6f1f659afe36a23f0a7e2f771a7dca58a91c2a71d66588174c909eb4fdda
}
Add the above code to your /etc/wpa_supplicant/wpa_supplicant.conf file, you’ll also need to adjust the /etc/network/interfaces.d/wlan0 file:
pi@spy:/etc/network/interfaces.d $ sudo cat wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "ssid"
wpa-psk 436c6f1f659afe36a23f0a7e2f771a7dca58a91c2a71d66588174c909eb4fdda
Obviously, you’ll need to change the ssid and password for your own network.
Thanks
Thanks to everyone who has contributed to the forums below, really appreciate the help.
I couldn’t find the same specific problem (which also makes me think there’s a simpler solution), but just in case have written it up here as much as anything so I’ve got a reference. Hope it’s useful.
And… if you’ve got a better solution, I’ve missed anything or got anything wrong, lemme know.
References
- “sudo ifup wlan0” shows “unknown interface wlan0”
- wpa-psk or wpa-passphrase?
- Re: Issue with known working WIFI
- Raspbian Stretch – ifconfig wlan0 up not getting IP
- Wifi and Ethernet simultaneously RPi3
- Setup simultanous Ethernet and Wifi access for the Raspberry Pi 3
- Multiple IP addresses being assigned
I’m using:
- Raspberry Pi Model B Rev 2
- Os is Raspbian 10 (buster)
- Dongle unbranded 802.11N Ralink 5370 chipset