On 7/2/22 19:21, Didier Kryn wrote:
> If you
> remove the "allow-hotplug" and "auto" stanzas, ifup -a will just do
> nothing, hence no wait. Therefore the solution is to install ifplugd or
> netplug, configure it, and eliminate the "allow-hotplug" stanzas from
> /etc/network/interfaces.
I've found a workaround replacing in the init script:
if ifup -a $exclusions $verbose && ifup_hotplug $exclusions $verbose
then
log_action_end_msg $?
else
log_action_end_msg $?
fi
with this:
if [ $(runlevel) != "unknown" ] || ! [ -z $(grep '^id:1:initdefault:$' /etc/inittab) ]; then
if ifup -a $exclusions $verbose && ifup_hotplug $exclusions $verbose
then
log_action_end_msg $?
else
log_action_end_msg $?
fi
fi
which means: "skip these lines if the boot process still has not switched to the default runlevel,
unless it is single user". The following script located in /etc/boot.d:
#!/bin/sh -e
#
# networking-restart
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
if test -x /etc/init.d/networking ; then
service networking restart
fi
will restart the service and from this moment, both "auto <device>" and "allow-hotplug <device>" will take effect.
This way, the delay will occur only in the case of a single user default runlevel, which is often not the case.