All of
 help / color / mirror / Atom feed
From: Peter Korsgaard <>
Subject: [Buildroot] Handling delays in network interface visibility in Raspberry Pi 3
Date: Mon, 15 Feb 2021 23:01:24 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <> (Ivo Grondman's message of "Mon, 15 Feb 2021 17:34:14 +0100")

>>>>> "Ivo" == Ivo Grondman <> writes:

 > Hi all,
 > Today I?ve been trying to debug the following issue. Using Buildroot
 > 2020.11.2 and the Vagrantfile that comes with it, I tried to build a
 > ?vanilla? Buildroot image in the vagrant VM for my Raspberry Pi 3
 > Model B+ in the following way:

 > $ make raspberrypi3_defconfig
 > $ make

 > i.e. without any customisation. The image builds fine and the Pi boots
 > without errors or warnings, but the network interface eth0 (configured
 > with DHCP) will not have an IPv4 address and I manually have to
 > perform an `ifup -a` or `ifup eth0` to get it going. So I went through
 > all the initialisation files that have a part in bringing up the
 > network interface and soon came to conclude that the script in
 > /etc/network/if-pre-up.d/wait_iface has the right intentions, but
 > still doesn?t solve the slow-to-appear interface issue.

 > It looks as if that particular script still needs to wait just that
 > bit longer when it sees that /sys/class/net/eth0 exists before
 > actually exiting. Using the file as is will not make eth0 retrieve an
 > address from the DHCP server, but if I add a bit of extra sleep in the
 > if-statement where it detects the presence of /sys/class/net/eth0 then
 > it *will* work.

The script simply waits for the interface to become available (E.G. for
the USB connected interface to be detected by the kernel).

I guess your problem is that the device (and/or whatever you have
connected at the other end of the cable) is too slow to negotiate a
link, so the DHCP client send the DHCP requests too soo and gives up
before the link comes up.

You should normally see output in the kernel log and the serial console
when a link is detected.

 > Now my problem with this approach is that it feels like a
 > hack. Moreover, I?d like to know if something else could be the issue
 > here. So:

 > 1) Did anyone of you experience similar issues with a Raspberry Pi?

I haven't personally.

 > 2) Are there any alternative, better solutions to this problem?

The classical way of waiting for the network link to come up is ifplugd:

Notice: for a slow-to-be-detected-by-the-kernel interface like the USB
connected ethernet on the raspberrypi you will need to use the -M
option to be able to start ifplugd before the kernel has detected eth0:

Bye, Peter Korsgaard

  parent reply	other threads:[~2021-02-15 22:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 16:34 [Buildroot] Handling delays in network interface visibility in Raspberry Pi 3 Ivo Grondman
2021-02-15 18:26 ` Nicolas Cavallari
2021-02-15 22:01 ` Peter Korsgaard [this message]
2021-02-16 10:37   ` Ivo Grondman
2021-02-16 11:23     ` Peter Korsgaard
2021-02-15 23:33 ` Christopher McCrory
2021-02-16 20:30   ` Peter Seiderer

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:

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

  git send-email \ \ \ \

* 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.