Yet Another Cycling Forum
General Category => The Knowledge => Ctrl-Alt-Del => Topic started by: Tim Hall on 10 December, 2023, 07:54:00 pm
-
I have an old Raspberry Pi (Model B, 512MB ) which, as mentioned elsewhere I'm planning to use as a trailcam. There's no built in WiFi, but I do have a PiHut USB WiFi dongle. This doesn't seem to work. No connection to me homewifi. I've found a step by step troubleshooter here https://forums.raspberrypi.com/viewtopic.php?t=44044 (https://forums.raspberrypi.com/viewtopic.php?t=44044)
Steps 1-3 all check out OK:
lsusb
Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
lsmod
rt2800usb 18171 0
rt2800lib 139752 1 rt2800usb
rt2x00usb 14609 1 rt2800usb
rt2x00lib 53280 3 rt2800lib,rt2800usb,rt2x00usb
mac80211 880872 3 rt2800lib,rt2x00lib,rt2x00usb
ifconfig -a
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:0f:60:04:e1:6b 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
/etc/network/interfaces just has this in it:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
Does that mean the interfaces file is looking for what ever is in /interfaces.d ?
interfaces.d is an empty directory.
Reading further down the guide, it says By default, Raspbian has in /etc/network/interfaces this line:
Code: Select all
wpa-roam /etc/wpa-supplicant/wpa_supplicant.conf
Well mine didn't, possibly because it's Raspberry Pi OS, the new name for Raspian , indicating that the guide is a bit out of date. Anyway, I modified /etc/network/interfaces to read as follows
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
auto wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
wpa_supplicant.conf has
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
ssid="<redacted SSID>"
psk="<redacted passkey>"
key_mgmt=WPA-PSK
}
And it still doesn't work. Any clues?
A wired connection works just fine.
-
Tim,
Network manager setup guide for Debian Bookworm (latest Rpi OS) should help:
https://www.abelectronics.co.uk/kb/article/31/set-a-static-ip-address-on-raspberry-pi-os-bookworm#:~:text=With%20the%20release%20of%20Raspberry,report%20on%20the%20network%20status. (https://www.abelectronics.co.uk/kb/article/31/set-a-static-ip-address-on-raspberry-pi-os-bookworm#:~:text=With%20the%20release%20of%20Raspberry,report%20on%20the%20network%20status.)
Are you using an adapter as below?
(https://thepihut.com/cdn/shop/products/raspberry-pi-dual-band-5ghz-2-4ghz-usb-wifi-adapter-with-antenna-the-pi-hut-102986-15696398352446_1000x.jpg?v=1646240762)
IME even with a token external antenna they don't work very well over distance.
As I expect you are intending SSH over a flaky connection Mosh will be useful. https://mosh.org/ (https://mosh.org/)
I spent far too long trying to get a Pi, albeit running MoodeOS, to connect using one.
Eventually gave up. £80 for a NOS Draytek mesh AP with four LAN ports that 'just works' with my router was money well spent.
-
Another tip... when you plug the adapter in run:
sudo dmesg
Also tail the system logs as you plug the adapter in.
In a terminal run sudo journalctl -f
Then plug adapter in
-
Sorry, been away, so only just round to trying these.
aidan, my adaptor is a tiny usb adaptor with no external antenna. At present I'm just trying to connect it to the network while it sits in the room next to the router. Following your link I ran
timsoldpi@raspberrypi:~ $ nmcli -p
Error: NetworkManager is not running.
A spot of googling suggested I run
timsoldpi@raspberrypi:~ $ sudo systemctl start NetworkManager
This then got the following result
eth0: connecting (configuring) to Wired connection 1
"Microchip SMSC9512/9514"
ethernet (smsc95xx), B8:27:EB:26:B5:4A, hw, mtu 1500
lo: unmanaged
"lo"
loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
wlan0: unmanaged
"Ralink RT5370"
wifi (rt2800usb), 00:0F:60:04:E1:6B, hw, mtu 1500
Which I think is because the wlan0 adaptor is in /etc/network/interfaces
I'll look into that a bit more.
Meanwhile Scum, sudo dmesg says
[255624.188716] wlan0: authenticate with c8:99:b2:04:42:58
[255624.188866] wlan0: 80 MHz not supported, disabling VHT
[255624.249492] wlan0: send auth to c8:99:b2:04:42:58 (try 1/3)
[255624.307047] wlan0: send auth to c8:99:b2:04:42:58 (try 2/3)
[255624.348078] wlan0: send auth to c8:99:b2:04:42:58 (try 3/3)
[255624.403633] wlan0: authentication with c8:99:b2:04:42:58 timed out
Many many times. Off to look that up.
-
This post lists the nmcli commands to connect to a wifi network
https://yacf.co.uk/forum/index.php?topic=122318.msg2701605#msg2701605
although in your case use wlan0 rather than wlp2s0
-
If you are going to use network manager I think you should probably remove the auto wlan0 stuff from /etc/network/interfaces, but I'm not really sure.
-
jamie@raspberrypi:~ $ more /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
ssid="FRITZ!Box 7530 HL"
scan_ssid=1
psk="supersecretlongnumberhere"
key_mgmt=WPA-PSK
}
jamie@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
I also altered something at boot up but as you already get mac addresses out of the wifi stuff that should be ok
-
I *think* it's not authenticating when it submits the passkey.
Because of some old bit of kit (Buffalo Airstation) attached to the network, the router is set to WPA/WPA2 (TKIP). I've been reading up on the "proto" argument in wpa_supplicant.conf. If that's not defined it defaults to WPA RSN
So, progress of sorts.
I've edited wpa_supplicant_conf so it reads:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
ssid="redacted SSID"
psk="redacted PSK"
proto=WPA
key_mgmt=WPA-PSK
}
But it still doesn't go. I get the impression that the wpa_supplicant.conf isn't being read on booting the Pi. There's a wifi GUI built in to the Raspberry Pi OS which has all the fields empty.
-
copy the wpa_supplicant.conf to the boot partition, then reboot maybe?
dunno, think you are right and there is some weirdness required in the wpa_supplicant.conf file to make it work
-
also, does
iwlist wlan0 scanning
tell you anything?
-
Sorry, been busy. Christmas, stuff like that.
The desktop on the pi (running Raspberry PI OS) shows the available wifi networks. Similarly "iwlist wlan0 scanning" brings up a list (with loads of other information) of available networks. This suggests the usb wifi dongle is working.
From the desktop I can select my home network and type in the password. It then fails to connect, failing to authenticate.
I went through the steps here https://gist.github.com/chatchavan/3c58511e3d48f478b0c2 (https://gist.github.com/chatchavan/3c58511e3d48f478b0c2) as it relates to an old style Pi B, which is what I have.
I then edited /etc/wpa_supplicant/wpa_supplicant.conf as follows, as I'm using TKIP.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="PLUSNET-WKC2FS"
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="REDACTED"
}
I then went to /etc/network/interfaces (not "interface" as it says in the referenced guide. where the guide says "Find the section about wlan0 and replace it with one of the following configuration (again, depending on your authentication type)." /etc/network/interfaces only had this in it
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
To my mind that says go and look in interfaces.d for configuration information. There was nothing in interfaces.d so I created a file called wlan0 in which I put
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
which is what the guide says should be added to /etc/network/interfaces.
Then I ran
sudo ifdown wlan0
with the response
ifdown: interface wlan0 not configured
Which doesn't look good.
sudo ifup wlan0
Says
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
ifup: failed to bring up wlan0
(You might get the impression I know bugger all about what I'm doing. You would be right)
-
i guess you have buggered up the config of wpa_supplicant so it won't start
-
If you just put all the text config files back to default does it not work using the GUI ?
That should be able to do WPA2 with PSK.
Just click the WiFi icon on the desktop task bar