persistent wifi configuration

464 views
Skip to first unread message

aeob...@gmail.com

unread,
Mar 15, 2020, 10:37:40 AM3/15/20
to BeagleBoard
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

Hans Leeuw

unread,
Mar 15, 2020, 11:39:14 AM3/15/20
to BeagleBoard
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:

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.


Op zondag 15 maart 2020 15:37:40 UTC+1 schreef aeo...@gmail.com:

Hans Leeuw

unread,
Mar 15, 2020, 11:42:52 AM3/15/20
to BeagleBoard
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.



Op zondag 15 maart 2020 16:39:14 UTC+1 schreef Hans Leeuw:

Llew Roberts

unread,
Mar 15, 2020, 3:15:23 PM3/15/20
to beagl...@googlegroups.com

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:

-----------------------

sleep 30

connmanctl connect wifi_*_managed_psk

----------------------

 

and

 

/lib/systemd/system/wifi-reset.service

This is what’s in that file:

-------------------

[Unit]

Description=Wireless Network Reset

 

[Service]

Type=oneshot

RemainAfterExit=true

ExecStart=/bin/bash /opt/wifi-reset/wifi-reset.sh

 

[Install]

WantedBy=multi-user.target

--------------------------------

 

If you manually connected to wifi using connmanctl before rebooting, wifi should be connected after reboot now. As mentioned in that article, the ethernet port must be disconnected for wifi to connect at boot time.

 

A couple of notes:

 

  • ‘ifup wlan0’ and ‘ipdown wlan0’ do not work for some reason. The new commands are (supposedly) ‘ip link set wlan0 up/down’.
  • wpasupplicant isn’t used for controlling wifi in the latest images (as of March 2020, at least)

 

Thanks again for the response and help, Hans!

 

Llew

 

 

Op zondag 15 maart 2020 16:40:62 UTC+1 schreef Hans Leeuw:

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/1o9h87ijuuA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/fb159725-c761-452b-a85d-40f3c30b58b8%40googlegroups.com.

jins...@gmail.com

unread,
Apr 2, 2021, 7:57:20 PM4/2/21
to BeagleBoard
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.


Reply all
Reply to author
Forward
0 new messages