[Buildroot] Recommended way to auto-reconnect wifi?

Jeremy Fleischman jeremyfleischman at gmail.com
Mon Sep 27 09:49:11 UTC 2021


Thanks! I've gone ahead with Nicolas's suggestion to create a
custom busybox configuration with CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS
tweaked to include the -b option.

On Wed, Sep 22, 2021 at 10:40 AM Peter Seiderer <ps.report at gmx.net> wrote:

> Hello Jeremy, Nicolas,
>
> On Wed, 22 Sep 2021 10:19:27 +0200, Nicolas Cavallari <
> nicolas.cavallari at green-communications.fr> wrote:
>
> > On 22/09/2021 02:16, Jeremy Fleischman wrote:
> > > I've been happily using buildroot for a growing number of Raspberry
> PIs at
> > > home. However, I've noticed that whenever our wifi cuts out, they do
> not
> > > reconnect when it comes back.
> > >
> > > I've got them configured using BusyBox init + mdev + ifupdown +
> > > wpa_supplicant. I've skimmed through /etc/inittab, and I think I
> understand
> > > how everything is wired together:
> > >
> > >    - /etc/init.d/S10mdev: mdev starts up, and asynchronously starts
> > > discovering devices.
> > >    - /etc/init.d/S40network: This runs /sbin/ifup -a. I think this runs
> > > while mdev is still discovering devices, which is fine, because
> there's a
> > > wait-delay configured in /etc/network/interfaces:
> > >
> > > # cat /etc/network/interfaces
> > > auto lo
> > > iface lo inet loopback
> > >
> > > auto wlan0
> > > iface wlan0 inet dhcp
> > >      hostname thermometer
> > >      pre-up wpa_supplicant -D nl80211 -i wlan0 -c
> /etc/wpa_supplicant.conf -B
> > >      post-down killall -q wpa_supplicant
> > >      *wait-delay 15*
> > >
> > > iface default inet dhcp
> > >
> > > As far as I can tell, this all only ever happens at startup, and there
> > > isn't any mechanism that would attempt to reconnect to a wifi network
> after
> > > a disconnect. I've done some googling, and here's what I've learned:
> > >
> > >    - I'm pretty sure that wpa_supplicant is not supposed to handle
> this.
> > >    - It looks like some people write scripts to handle this for
> themselves.
> > > See this SO answer <https://raspberrypi.stackexchange.com/a/5121> and
> > > this dweeber/WiFi_Check
> > > repo <https://github.com/dweeber/WiFi_Check>.
> > >
> > > Am I correct that this is something I should fix by adding some sort of
> > > background/cron process to do something like the WiFi_Check script
> above?
> > > Or is this something buildroot does have baked in support for, and I
> just
> > > haven't found it yet?
> >
> > Buildroot has nothing out of the box for this, short of
> > NetworkManager/connman or the likes.
> >
> > In your case, wpasupplicant should reconnect automatically if it is
> > disconnected, but the busybox DHCP client, udhcpc  won't retry
> > indefinitely by default. If you use a custom busybox configuration, you
> > can modify CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS to make udhcpc go into
> > background and retry indefinitely.
>
> Alternatively use the following patch [1] to change the
> ifupdown-scripts...,
> or do a complete change away from wpasupplicant and use iwd (see [2])
> providing AutoConnect and DHCP...
>
> Regards,
> Peter
>
> [1]
> https://patchwork.ozlabs.org/project/buildroot/patch/20210216202022.27264-1-ps.report@gmx.net/
> [2] https://iwd.wiki.kernel.org/start
>
>
> >
> > Also, note that you can copy the Debian ifupdown scripts into your image
> > and then use the Debian's wpa-* options in /etc/network/interface. You
> > will have to tweak them a bit because buildroot install wpasupplicant in
> > /usr/sbin instead of /sbin.
> > _______________________________________________
> > buildroot mailing list
> > buildroot at lists.buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildroot.org/pipermail/buildroot/attachments/20210927/ba166114/attachment.html>


More information about the buildroot mailing list