Is there a workaround for Debian Bug #838871?
Problem: I want to have a network configuration on Debian with the following properties:
- Automatically ifup network interface when a cable is plugged in
- boots without blocking for a long time when no cable is connected on boot
- not switching my init system
The standard way to do this would be the following snippet in /etc/network/interfaces
:
allow-hotplug eth0
iface eth0 inet dhcp
However, this leads to the problem described in the linked bug report: The boot process blocks for >1min when no network cable is plugged in with the following message:
configuring network interfaces... ifup: waiting for lock on /run/network/ifstate.eth0
A workaround given in this question seems to be changing allow-hotplug
to auto
:
auto eth0
iface eth0 inet dhcp
This effectively makes the boot blocking message disappear, however, the system now blocks right before a login prompt is shown at tty1. This time dhclient is blocking because it tries to get a dhcp reply on eth0, which is not connected, and waits for several attempts to timeout. The login prompt only appears after the dhclient timeouts.
For users with a graphical DE, this might not be a problem, as they don't need to log in on tty1, instead their DE boots and they never see the dhclient message.
Another workaround would probably be to use network-manager
. Ideally, I would prefer to not use networkmanager, but as a last resort, I tried that. However, on Debian buster, network-manager's dependency chain conflicts with sysvinit-core
, which is my init system.
The last alternative which comes to my mind is to not configure eth0 in interfaces(5). This makes all boot blocks go away, however, I need to manually ifup eth0
after plugging in an ethernet cable.
Any better ideas?
UPDATE: To address the quote from @sourcejedi, "allow-hotplug" is specified to "start interface when the kernel detects a hotplug event from the interface" in the Debian docs under Debian networking. Related questions: Good detailed explanation of /etc/network/interfaces syntax? and What is a hotplug event from the interface?