persistent wifi configuration

I’ve been trying for several days and I can’t find any resources that definitively tell you how to configure wifi that persists after a reboot. What are the proper configuration files are and what needs to be in those files?

AdaFruit says to change the /etc/network/interfaces file. That doesn’t work. https://learn.adafruit.com/setting-up-wifi-with-beaglebone-black

There are several references to “supplicant” but that doesn’t seem to be current. Or is it?

This tutorial is a tease but it doesn’t work either. It does mention that wifi won’t connect if Ethernet is connected at boot, but I’m not sure if it’s for this specific adapter or for BeagleBone Blacks in general. https://docs.google.com/document/d/1-CIGQYdk8ZhU3D3UCNn70jc7C9HdXvEZAsiNW71fGIE/edit#heading=h.ftleo32gu3jr

I’ve seen dozens of pages tell you how to use connmanctl to manually get a connection to work. That works flawlessly.

But I have found nothing that tells you how to configure connman so that wifi is connected at boot time.

I am using the Debian 9.9 2019-08-03 4GB SD IoT image. Unfortunately, repeated attempts to update the board with the LXQT image failed.

Can someone please help?

Thanks,

Llew Roberts

Hi Llew,

I am using connman to connect. It remembers the last network it was connected to and you can set it to auto connect.

A simple connection example:
https://www.ev3dev.org/docs/tutorials/setting-up-wifi-using-the-command-line/

You can also configure it to have a fixed ip and other configurations, eg:

connmanctl config wifi_xxxxx_xxxxx_managed_psk --ipv4 manual 192.168.2.x 255.255.255.0 192.168.2.1

connmanctl config wifi_xxxxx_xxxxx_managed_psk --nameservers 192.168.2.1

connmanctl config wifi_xxxxx_xxxxx_managed_psk --ipv6 off

Or even set it to connect to a hidden SSID by going directly into the configurations file. /var/lib/connman/

cd /var/lib/connman/

sudo su

cd wifi_xxxxx_xxxxx_managed_psk#

And add Hidden=true to the settings file using your favorite text editor.

Hope that helps.

Best Hans.

Oh and what also helps to make it persistent is to remove all other directories with other wifi connections from the /var/lib/connman/ directory and only leave the one that you want to use.

Hans,

Many thanks for the response. It gave me a couple of important clues.

It turns out that the problem isn’t the configuration files. As you say, they are actually created automatically when you connect manually with connmanctl. However, wlan0 still wasn’t connecting at boot time after rebooting. I saw in the logs: “wlan0: link is not ready”.

It looks like creating a script/service to connect at boot time with connmanctl is the fix for this. You can read about that here:

https://groups.google.com/d/msg/beagleboard/jFJ_cOdh0Zk/JTImXUYWCQAJ

The end result of what is described there (and in the wildly/criminally out of date Adafruit github repo) is that two files are created:

/opt/wifi-reset/wifi-reset.sh

This is what is in that file:

I, too, have just spent many hours looking into this and wondering how it could be so difficult. I didn’t have any issues getting wifi connected, but only if I unplugged the ethernet cable would it would come up on boot.

I finally came across this in the connman.conf(5) manual:

SingleConnectedTechnology=true | false
Keep only a single connected technology at any time. When a new service is connected by the user
or a better one is found according to PreferredTechnologies, the new service is kept connected
and all the other previously connected services are disconnected. With this setting it does not
matter whether the previously connected services are in ‘online’ or ‘ready’ states, the newly
connected service is the only one that will be kept connected. A service connected by the user
will be used until going out of network coverage. With this setting enabled applications will no‐
tice more network breaks than normal. Default value is false.

I thought PreferredTechnologies was just to choose which connection got the default route, but I read this to mean that if a preferred technology is connected, it won’t even try to connect something lower on the preference list. The default order in /etc/connman/main.conf is ethernet,wifi, and eth0 is found and configured well before my USB dongle is loaded. This explains the problems with connecting both at once.

The man page also gives us:

AlwaysConnectedTechnologies=technology[,…]
List of technoolgies which are always connected regardless of PreferredTechnologies setting (Au‐
toConnect = true). The default value is empty and this feature is disabled unless explicitly en‐
abled in the config file.

So adding “AlwaysConnectedTechnologies=ethernet,wifi” to main.conf fixes the issue without the need for delayed manual startup scripts. I just tested it and it works for me.