Debugging WiFi connection problem

Hi @Nigel, let me ask couple of more clarification questions.

Is the network you are trying to connect is 2.4GHz?
RPi Zero W can not connect to 5GHz wifi networks (though as you say RPi 3B+ can). So I wonder if you did any changes to your router that would impact the frequency.

Next, so does the same RPi Zero still able to connect to the same wifi network running Raspbian?
If that’s the case, there is either a configuration issue or a bug on balenaOS.

Could you run the command cat /mnt/boot/system-connections/resin-wifi-01 and verify that wifi credentials are correct?
Just to rule out potential typos there.

Next, could you send us the output of NetworkManager’s logs via the following command?
journalctl -a -u NetworkManager --no-pager
So we see if there are any issues there. It’d also help the logs from journalctl -a -u resin-supervisor --no-pager.

Cheers…

Yes, 2.4 GHz. I didn’t make any changes to my router apart from adding ipaddress assignment to MAC addresses. I had tried before adding those entries.

Yes, the RPi Zero connects OK when running Raspian.

I checked the resin-wifi-01 file and it looks correct, it’s the same as I posted earlier.

I ran the commands you requested. They ran off the screen so used the pager and have hopefully captured the appropriate sections, see attached.

Hi @Nigel

I’ve consulted one of our network experts on this matter, and he recommends that you use wifi-connect to dynamically set the WiFi configuration. You can find the repository, with associated instructions, here: https://github.com/balena-io/wifi-connect .

Please let us know whether this solves the problem!

Kind regards
Alida

That looks complicated. Surely it should work as is?

Hi there, so once you run WiFi Connect in a container, it will create a network connection profile in /etc/NetworkManager/system-connections. The idea is more like to try to connect with WiFi Connect to your network, since it uses some automatics to configure the connection profile for you. You do not have to use it on the long run, it will be useful to verify it is able to connect to your router, and afterwards you may just use the connection profile generated by it.
Thanks,
Zahari

That looks very long winded. It must be possible to add something to the connection profile which may give more information.

Is there something I can glean from the working Raspbian installation?

How do I disable ipv6? Can I just delete that entry?

hi @Nigel I agree the suggested methods are probably too long winded. Do you have a keyboard and screen connected to the pi, or possibly the ability to setup a serial cable to console into the device? Then as long as you are running a .dev variant of the device you should be able to test the network connection using:

List all wifi networks the device can see:

nmcli d wifi list

pick your network name and then run the following to try connect.

nmcli d wifi connect my_wifi password <password>

obviously replacing my_wifi and <password> appropriately. If that fails to get you a connection, then I would ask that you grab the logs of NetworkManager using the following:

journalctl -u NetworkManager --no-pager

Let me know how that works out for you!

Hi @shaunmulligan,
Thanks for your comments.
Now, this is odd. When I use the command ‘nmcli d wifi list’ I can see my neighbours’ WiFis but not my own! If I run WiFi analyser on my phone, it can see my WiFi. This is all on 2.4GHz. So, I can’t understand why that is, especially when running Raspbian on the same board does see it. Just tried using my phone as a WiFi hotspot and that can be seen, so must be something odd with my router, even though all my other WiFi devices see it OK.

That is very interesting. I wonder if perhaps your router is not using all the bands and your neighbours is, that would explain why it would get seen and not yours. I remember there was some previous issue from a user with n and ac bands on the router AP, but I can’t remember exactly. I will try dig out that issue if i can.

the other thing to try is to pass the nmcli d wifi list --rescan option so that it forces NM to do a proper full scan of network. It also might be worth just trying to connect to your network with the nmcli d wifi connect ... command and then seeing what the logs say.

Tried the first suggested command and it still only reports other networks. I tried the connect but, unsurprisingly, it says it can’t find that SSID.

I just tried Raspbian again on the same board and that worked fine. It appears in my router with the correctly assigned ip address.

The balena version keeps saying ‘IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready’ implying it is trying to use IPv6. No mention of IPv4 anywhere.

Finally solved! My WiFi router’s channel number was set to ‘auto’ and I noticed it had allocated quite a high channel (11 I think). So I manually set the channel to 9 and my Pi Zero W saw it at last and the app now works fine.

What is strange is that the same board running Raspbian was able to see the router when it was running at the higher channel number. Does balena put a narrower number of WiFi channels in it’s driver compared with Raspbian?

Many thanks to all that have helped in tracking down my problem.

That should most probably be related to the WiFi regulatory domain/country setting: https://github.com/balena-os/meta-balena#country

There was a recent issue with the country setting and if you try setting this, please use balenaOS version 2.48.0+rev1 or higher.

I can only see V2.46.1+rev1 as an option.

Hello,
2.48.0+rev1 has not been released to production yet.
You can try it on staging in the meantime if you want https://dashboard.balena-staging.com