RPi 4 Wi-Fi disconnect after long time


We have RPi4 based units deployed with our customers. For some customers, after a few days the unit loose connectivity. Restarting the unit solves the issue. We have added logs and can see that the device (nmcli) can see the SSID but it does not connect to it. We suspect the unit and the APs get “out of sync” and believe we can reset the RPi4 Wi-Fi to resolve the issue (as it’s fixed with a reboot).

Can you recommend the best way to reset the RPi4 Wi-Fi from a container?
nmcli radio wifi off?
“nmcli networking off” then “nmcli networking on”?
I assume it’s not possible to restart the network manager service from a container?! or is there?
Any other options?

Thank you :wink:

I also have this problem. I have multiple UniFi WiFis.

I tested this recently after hearing a similar complaint, but could not duplicate this issue. I ended up needing to use my Pi for another task, so I had to eventually pull the plug, but I was still going strong at about 15 days when I finally shut it down. The last screenshot I grabbed was at 12 days, though I made it a few more past this:

I am wondering if some Pi4’s are starting to have failing onboard WiFi modules, or, if it’s not able to recover when network blips and packet drops occur.

Yes, the PiFi has many issues… but most of them can be resolved by resetting the chip… just wondering what is the best way to do so. I was able to do it in Raspbian, but with Balena I don’t have “physical” access to the interface/chip.

Would have been great if there was a way to force it on 2.4Ghz as the 5Ghz is very unreliable. Unfortunately, it seems like the driver always scan both bands and even if you try to force it to 2.4Ghz (by configuring network manager) it will still go to 5Ghz. Also, since it scans both bands, some APs will try to band steer the PiFi to 5Ghz. The combination of unreliable 5Ghz and band steering is lethal to PiFi.

I’ve done driver development and would be happy to work with Balena team and provide a PiFi driver which allows configuration of 2.4Ghz only mode.

@dtischler Can anyone in Balena provide feedback as to the best way to reset the Wi-Fi chip? (assuming only access is from a container using network-manager)

@n42 Interesting thoughts regarding the 5Ghz unreliability, and the role of the access point in the situation as well. You mention you can “reset” the chip in Raspbian, but not in balena. What is the method to accomplish that in Raspbian? We could then determine how to perform the same tasks from in a container, I hope.

With most drivers, if you issue an ifconfig down, then up, on a wifi interface, the driver will reset the chip as part of the process. I have not tested this specifically with the PiFi (Raspberry Pi 4 wifi) but have implemented Wi-Fi drivers in the past as well as worked with a bunch of them and a vast majority will do so.

I have not tested it on a large dataset, but I’ve seen RPi4 with Raspbian recover after ifconfig down/up several times. I’m just not sure what does the same function using network-manager.

Doing some quick searching, it looks like the syntax is nmcli connection down networkName as described here: nmcli: NetworkManager Reference Manual

Although, I do also see thee is a device command that might also be appropriate.

There are some samples here as well: https://www.2daygeek.com/enable-disable-up-down-nic-network-interface-port-linux/

1 Like