
Please be more exact and show the content of operstate, carrier files. Let's see what exactly goes wrong. If it's only docker0 and veth*, we may skip it like how we skip lo:
[ "${i#*/lo/}" != "$i" ] && continue
got it. Thanks, Yinsi
Thanks, Fengguang
one qemu may have serial net interfaces in /sys/class/net, just one is 'up' or '1' means network is ok, it will not sleep and directly run function export_ip_mac(), but actually eth0 not ready, it can't get mac and ip, so use ping can ensure save enough time for eth0.
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- lib/bootstrap.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index b04ea3dd4..df25e99e0 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -87,13 +87,7 @@ net_devices_link()
network_ok() { - local i - for i in /sys/class/net/*/ - do - [ "${i#*/lo/}" != "$i" ] && continue - [ "$(cat $i/operstate)" = 'up' ] && return 0 - [ "$(cat $i/carrier 2>/dev/null)" = '1' ] && return 0 - done + ping -c 3 $LKP_SERVER > /dev/null && return 0
is_clearlinux && { net_devices_link up -- 2.23.0