From d49dc966d8bff5ca455091649d3e711cd1539036 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sun, 8 Mar 2015 21:16:27 +0100 Subject: [PATCH] allow for a 30s delay before eth0 comes up --- initscripts/pl_netinit | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/initscripts/pl_netinit b/initscripts/pl_netinit index 8dd8714..6fac990 100755 --- a/initscripts/pl_netinit +++ b/initscripts/pl_netinit @@ -283,9 +283,28 @@ if [[ -z "$ETH_DEVICE" ]]; then net_init_failed fi +# within a systemd-driven startup, we often see this stage +# triggered before the network is actually up +# although of course we have network-online.target +# as a requirement; go figure what systemd actually does.. + +# in any case, let us try to work around that by allowing some delay +# here + +TIMEOUT=30 +while true; do + /sbin/ifconfig $ETH_DEVICE >& /dev/null && continue + TIMEOUT=$(($TIMEOUT-1)) + [ $TIMEOUT -le 0 ] && net_init_failed + sleep 1 + echo $(date "+%H:%M:%S") " pl_netinit: waiting for device $ETH_DEVICE, ${TIMEOUT}s remaining " +done + # actually check to make sure ifconfig succeeds + /sbin/ifconfig $ETH_DEVICE up 2>&1 > /dev/null + if [[ $? -ne 0 ]]; then echo $(date "+%H:%M:%S") " pl_netinit: device $ETH_DEVICE does not exist, most likely" echo $(date "+%H:%M:%S") " pl_netinit: this CD does not have hardware support for your" -- 2.43.0