1

I have a Raspberry Pi 2 here that's running the latest Minibian image, plus a few needed items - vsftpd, wpasupplicant, firmware for the Edimax Wi-Fi Adapter, mono-runtime, and a few others. However, I've noticed that during boot, it tries to configure the network interface to get onto the network. I'm alright with that, however it seems to block up the boot process, not letting anything else go while it sits there and gets a DHCPOFFER from the router.

Is there any way I could have the network configuration occur in the background while the rest of the system boots?


EDIT after @goldilocks helped pinpoint - Seems like ifup is calling for dhclient to start. ifup -v confirmed it. Is there any way I can have ifup pass -nw to dhclient?

sctjkc01
  • 316
  • 1
  • 3
  • 10

1 Answers1

1

From the looks of this, you have to custom compile ifup in order to change the hardcoded switches it supplies to dhclient in various circumstances. But that isn't going to make it anymore flexible if for some reason you change your mind because, e.g., this ends up having unintended consequences.

Another choice would be to wrap dhclient so that it ends up called with the -nw switch added. To do that first find out where the executable is with which dhclient. It is most likely /sbin/dhclient.

Now check echo $PATH. /sbin is probably not the first thing in the list, which is checked in order. So if there's another dhclient in a one of the earlier directories, it will get used. This is going to be the wrapper:

#!/bin/sh

echo "Starting dhclient..."
exec /sbin/dhclient -nw $@

The echo you can remove once you are sure this works -- it will just help to confirm at boot this is being used. $@ is whatever argument list is passed to the script.

Call that script dhclient (no .sh at the end) and put it in one of the first directories from $PATH (hopefully /usr/local/bin is first so you can just use that). Make sure to:

sudo chown root.root dhclient
sudo chmod 755 dhclient

Which leaves it owned root and world executable.

If that doesn't work, i.e., it seems to call the dhclient in /sbin anyway:

sudo mv /sbin/dhclient /sbin/dhclient-real

Modify the script to call /sbin/dhclient-real $@, and move it into /sbin. This method is foolproof, since /sbin/dhclient is now yours.

goldilocks
  • 60,325
  • 17
  • 117
  • 234