in 2015.05-rc2, default configuration of raspberrypi2(raspberrypi2_defconfig) network interface doesnt show up after boot, but adding a "sleep 1" in S40network(before line "/sbin/ifup -a") fixes the problem.
It is because the rpi uses a usb<>ethernet adapter, and USB initialization happens after (or rather in parallel) with the rootfs getting mounted and init running - So eth0 isn't available by the time ifup runs. Busybox ifup/ifdown isn't made to handle such dynamic setups, but perhaps we could add a wait-for-eth0 init script for the rpi that does something like: etc/init.d/S40eth0 #!/bin/sh # # Wait for (usb based) eth0 to get detected # case "$1" in start) echo -n "Waiting for eth0 ... " while [ ! -d /sys/class/net/eth0 ]; do sleep 1; done echo "done" ;; stop) ;; restart|reload) "$0" stop "$0" start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac
Was wondering if we shouldn't just (offer an option to) enable busybox's ifplugd? While the Pi is one of the few that has Ethernet through USB, I think this also affects other platforms that have their Wifi through USB.
(In reply to comment #2) > Was wondering if we shouldn't just (offer an option to) enable busybox's > ifplugd? > > While the Pi is one of the few that has Ethernet through USB, I think this also > affects other platforms that have their Wifi through USB. Ifplugd is nice, but it wouldn't fix anything here as the problem is that eth0 isn't available yet when S40network runs, so ifplugd would also fail.
>Ifplugd is nice, but it wouldn't fix anything here as the problem is that eth0 >isn't available yet when S40network runs, so ifplugd would also fail. Thought it also had an option for dealing with interfaces that do not exist yet. http://git.busybox.net/busybox/tree/networking/ifplugd.c "-M Monitor creation/destruction of interface (otherwise it must exist)" Although I haven't tested it.
(In reply to comment #4) > >Ifplugd is nice, but it wouldn't fix anything here as the problem is that eth0 > >isn't available yet when S40network runs, so ifplugd would also fail. > > Thought it also had an option for dealing with interfaces that do not exist > yet. > > > http://git.busybox.net/busybox/tree/networking/ifplugd.c > > "-M Monitor creation/destruction of interface > (otherwise it must exist)" > > Although I haven't tested it. Ahh, you're right. I've never noticed that option. Sorry!
Yann, is this something you would like to fix in the default raspberrypi2_defconfig, for improve the out of the box user experience for users?
Fixed in git by: commit 49964858f45d2243c513e6d362e992ad89ec7a45 Author: Yann E. MORIN <yann.morin.1998@free.fr> Date: Sat Oct 3 14:31:45 2015 +0100 package/initscripts: S40network: wait for network interfaces to appear On some machines, the network interface is slow to appear. For example, on the Raspberry Pi, the network interface eth0 is an ethernet-over-USB, and our standard boot process is too fast, so our network startup script is called before the USB bus is compeltely enumerated, thus it can't configure eth0. Closes #8116. [Peter: move to S40network, handle multiple interfaces] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
I had experienced the same issue, and I had fixed it using BusyBox's ifplugd with -M as suggested in comment #2. eth0 should be more "allow-hotplug" than "auto" on RPi. However, some services started quickly after S40network and configured to use eth0 might be unhappy if it is not yet up, but it is the same issue if the Ethernet cable is plugged later. So their configurations have to be adjusted anyway. At least, there is now a configurable choice between the sleeping S40network and ifplugd.
[--SNIP--] > At least, there is now a configurable choice between the sleeping S40network > and ifplugd. The sleeping solution is to make our RPi defconfig (as well as all our default configs) "just work" out-of-the-box, nothing more. Any more serious system would probably have to use something along the lines of connman (my personal favourite) or NetworkManager or ifplugd. Or even custom startup scripts.