This site is for tech Q&A. Please keep your posts focused on the subject at hand.

Ask one question at a time. Don't conflate multiple problems into a single question.

Make sure to include all relevant information in your posts. Try to avoid linking to external sites.

Links to documentation are fine, but in addition you should also quote the relevant parts in your posts.

0 votes

On system startup I get a delay when the network cable is not connected. It looks almost like the system hangs while trying to bring up eth0, but after several minutes the system boot finally continues. This is particularly annoying on a notebook that uses wired or wireless connections depending on the location. The interface is already configured with allow-hotplug, but that doesn't seem to change the behavior.

I'm running Devuan, so no systemd or network-manager.

in Sysadmin
by (100)
1 4 11
edit history

Your answer


Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
By submitting this post you agree to our Terms & Conditions.
To avoid this verification in future, please log in or register.

1 Answer

0 votes

You can use the pre-up option to run check if the interface has link (i.e. a cable is connected) and return a non-zero exit code otherwise. That will cause ifup to abort instead of trying to bring up the interface.

From man 5 interfaces:

pre-up command

Run command before bringing the interface up. If this command fails then ifup aborts, refraining from marking the interface as configured, prints an error message, and exits with status 0. This behavior may change in the future.

Something like this should work:

allow-hotplug eth0
iface eth0 inet dhcp
  pre-up ip link set eth0 up && sleep 1
  pre-up [ $(cat /sys/class/net/eth0/carrier) -eq 1 ]

The first command tries to bring up the interface. The second command checks if the interface has link. If either of the command fails (e.g. because no ethernet cable was plugged in), the interface is left unconfigured.

by (100)
1 4 11
edit history