Raspberry Pi 4 Wifi Connectivity Issues

Hi team,

My Raspberry Pi 4 is not picking up on the WiFi connection I specified when adding the device to my project. On top of that, the Wifi-Connect container does not function. When I SSH into the Host OS, the wifi credentials file (resin-wifi-01) is not present, even after I put it there manually. Ethernet works perfectly.

This issue is not present in any of my Pi 3s. Any thoughts?

Hi,
That’s strange indeed.
Is the RPi4 on a pre-existing application?
Can you try creating a new RPi4 application, setting your wifi settings in the download image modal and try provisioning a fresh device, so that we can be sure that all steps were done correctly?

Could you provide some extra info about the steps that you followed.
Could you also grant us support access to that application from the actions page of the dashboard, and send us the application or device url with the issue so that we can take a closer look?

Sure thing! The RPi4 is running a pre-existing application, so I can try building the project on a new application and see if that works. I’ll be able to check that in a couple hours.

I was able to get the Pi to connect over WiFi again after starting the device while plugged in to Ethernet, then unplugging Ethernet after a few minutes. Because of this symptom, I’m beginning to think that the issue may be my own WiFi connection, but the problem is seen across three separate networks.

In order to replicate the issue, I simply went to my Application, clicked Add Device, selected Pi 4 64-bit BETA, and flashed the image via Etcher.

Here is a link to the device, with Support Access granted for 1 week: proud-forest

EDIT: More info on WiFi-Connect. The container launches just fine, but will not create a wireless connection. Because of this, I can’t connect to it and specify a new WiFi network to connect to.

Hi @thgreasi

I was able to confirm issues when building a new Application. I am using the official Balena Electron project.

Error Log
[Error]         Some services failed to build:
[Error]           Service: electron
[Error]             Error: The command '/bin/sh -c install_packages   apt-utils   clang   libxcb-image0   libxcb-util0   xdg-utils   libdbus-1-dev   libgtk2.0-dev   libnotify-dev   libgnome-keyring-dev   libgconf2-dev   libasound2-dev   libcap-dev   libcups2-dev   libxtst-dev   libxss1   libnss3-dev   libsmbclient   libssh-4   libexpat-dev' returned a non-zero code: 100
[Info]          Built on arm01
[Error]         Not deploying release.

Another error that pops up a few times says this:
E: Unable to locate package libgnome-keyring-dev

Any ideas on where to start?

Hi @cpollock ,

So the reason for the electron project build failures are twofold:

  1. The current balenalib/raspberrypi4-node:10-build tag is based on Debian Buster. Unfortunately, the libgnome-keyring-dev package isn’t available on Buster. You could go use 10-stretch-build instead (and 10-stretch-run) in the Dockerfile, but this runs into:
  2. The version of electron used in the project is v1.6.18 and unfortunately there isn’t an aarch64 release for this version. You could, technically, specify to use the armv7 version by using --arch=armv7l in the npm install line, but the issue here is that everything else is aarch64, so the project would be extremely limited (and would not have the right bindings)

The best way of getting the project to run currently is to actually use the Arm7 version of the project, by using the Pi3 version, ie. replacing:

%%BALENA_MACHINE_NAME%%

with

raspberrypi3

This should run happily on your Pi4, but obviously will run as 32bit and not 64bit.

For the WifiConnect issue, I believe the default startup conditions for it is to not start if it detects a wifi network connection already exists (see this start script: https://github.com/balena-io/wifi-connect/blob/master/scripts/start.sh#L23 ). What’s curious is if your Wifi connection you’ve already installed isn’t working, Wificonnect should start up.

I’ve just had a brief look at your device, and it does appear that currently, the settings you’ve created are present in the system-connections directory (/mnt/boot/system-connections/resin-wifi-01 does exist and is filled in). I’m a little confused by the ethernet discussion. Am I correct in saying wifi wasn’t connecting when ethernet was unplugged, but you had to plug ethernet in, wait, then disconnect it and wait again for wifi to start working?

Best regards,

Heds

Hi @hedss

Thanks for the quick response. I made a new project and replaced %%BALENA_MACHINE_NAME%% with raspberrypi3 but the issue persists. This is while utilizing the Pi 4 64-bit image-- should I switch to the 32-bit Pi 3 image beforehand?

More detail about the Ethernet:
Consistently, the initial cold boot will result in a white page. The device will stay here, not connect to the designated WiFi, and also not utilize the Wifi-Connect container to try establishing a connection. The only way to get it out of this state is to connect the device to my laptop via Ethernet (with internet sharing on) and restart the Electron container. Once I do that, the device comes online and will correctly connect to wifi. Restarting the containers will not break the connection, but unplugging power will.

Thanks for your time,
-CJ-

Hi, so these are likely two issues:

  • Debian Buster not having that image, and thus will need to update the project (or downgrade to Stretch)
  • Pi4 being 64-bit ARM device, might not have the same packages available, so switching to 32-bit raspberrypi3 image, balenalib/raspberrypi3-node:10-stretch-build and similar might unblock you.

For the Wifi, the Pi4 that we have at hand we could connect successfully all the time. Can you share what exact project are you deploying? Because https://github.com/balena-io/resin-electronjs does not have any wifi connect so it’s harder to check your particular use case.

But it definitely feels like both the electronjs project needs a refresh, and wifi-connect needs more looking into for 64-bit ARM (in case).

Hi @imrehg
Sorry for the delay. The Wifi-Connect container I am adding to this project can be found here.

Hi @cpollock it looks like we are discussing 3 problems here that might or might not be connected.
The usual strategy would be divide & conquer meaning to separate the problems and see if they exist individually. If so look at them one by one and see if we can solve them.
So my suggestion would be to install the RPI4 into an empty application (no release) with the wifi credentials set and give it ample time to connect.
If it does not connect, it would be interesting to connect it via your ethernet and let us take a look at it.

Hi @samothx
I followed a fork in the Electron project for Debian Buster, and that seems to be working without issue now. The Pi4 will also now connect to the WiFi network first try and load everything perfectly.

The only remaining issue is that Balena’s WiFi-Connect container does not create a wifi connection on the Pi4 when a wireless network is not found.

I apologize for jumping around these three issues, but I was having difficulty isolating the problem. I have granted remote support for the new application with the new Buster Pi4 Electron container.

Hi,

I’ve raised the issue with our Wifi-Connect maintainer, we will get back to you as soon as we have any updates.

Hi @cpollock,

The maintainer of WiFi Connect here. I am a bit confused by the symptom you described - “when a wireless network is not found”. Once you enter the WiFi Connect captive portal through your cell phone, is the network listed in the drop-down box? For WiFi Connect to work, it needs NetworkManager to be seeing the network nearby.

Thanks,
Zahari

Hi @majorz nice to meet you,
To clarify, when the trusted network (the one designated on initial setup) is no longer found, WiFi-Connect should create a new WiFi connection for my phone or any other device to connect to.

While this works on a Pi3, the Pi4 will not create a new WiFi connection if the initial network is not found. For example in the Balena Dash project, the Pi should create a network called “balenaDash”. This is the function that is not working on the Pi4.

@cpollock I suspect this is something to do with your wifi-connect Dockerfile. If you’re pulling the wifi-connect folder from the balenaDash project and adding it to your own Pi 4 project it’s not going to work. The reason for this is that it’s using the balenalib/raspberrypi3 image but then further down on line 10 you can see it’s using the %%BALENA_ARCH%% template variable, which in the case of the Pi 4 is going to be aarch64. This ultimately means you’re going to end up trying to run a 64-bit binary on a 32-bit image.

To fix this, change the base image to balenalib/raspberrypi4-64, or balenalib/%%BALENA_MACHINE_NAME%%. It’s almost the opposite to what you had to do above to get Electron working! This is because Wifi connect is compiled for aarch64 and will work fine, we just need to use the correct base image for the correct architecture.

I hope this makes sense and let me know how you get on!

So as a test, I made a new application called WiFi, then added the basic WiFi Connect code from Github on a base Pi 4 64-bit BETA build-- not using the Balena Dash script and dockerfile. I didn’t change any of the code, and the service is still not creating a wifi connection on my Pi 4.

I noticed in Balena’s Pi 4 documentation that a change in the NVRAM broke a WiFi driver. Do you think that is related to this issue in any way?

Hi @cpollock, I just ordered a RPi 4 as I personally do not have one yet. I will follow up with my findings once I receive the package.
Thanks,
Zahari

1 Like

Hi @cpollock,

I did not had any issues with WiFi Connect on balenaOS 2.41.0+rev4 and RPi 4.

What I did is:

  1. Cloned the WiFi Connect repo
  2. Created a new application called wifi-connect-test on the balena dashboard
  3. Using our balena CLI I did balena push wifi-connect-test from inside the cloned wifi-connect folder
  4. After the image was downloaded on the RPi 4 device, I used WiFi Connect to successfully connect to a network
1 Like

Glad to hear that worked-- I’ll troubleshoot on my end to see what the issue is. Thanks for taking the time to look into this.

Thanks, please let me know how that worked for you and if you still have any issues with it.