buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
To: Jeremy Fleischman <jeremyfleischman@gmail.com>, buildroot@busybox.net
Subject: Re: [Buildroot] Recommended way to auto-reconnect wifi?
Date: Wed, 22 Sep 2021 10:19:27 +0200	[thread overview]
Message-ID: <76537c4d-163e-7947-5956-69969420e083@green-communications.fr> (raw)
In-Reply-To: <CAHpv4cOfQv_PoRU0YN3NANLjcK9tooxUM-zFcQm-t2Xc0zP5xQ@mail.gmail.com>

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.

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@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2021-09-22  8:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22  0:16 [Buildroot] Recommended way to auto-reconnect wifi? Jeremy Fleischman
2021-09-22  8:19 ` Nicolas Cavallari [this message]
2021-09-22 17:40   ` Peter Seiderer
2021-09-27  9:49     ` Jeremy Fleischman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76537c4d-163e-7947-5956-69969420e083@green-communications.fr \
    --to=nicolas.cavallari@green-communications.fr \
    --cc=buildroot@busybox.net \
    --cc=jeremyfleischman@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).