Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It turns out raspberry pi doesn't try very hard to get an IP address with dhcp, during a power failure, my rpi booted faster than the dhcp server, and never got an IP address. In such a situation, the rpi seems to be booted, but it doesn't get an IP address, and I never see a dhcp request from it until I reboot it again.

dhclient is run as such:

dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0

I can't find any way to alter the arguments to dhclient, the -1 argument might be the culprt. How can I make my raspberrypi retry dhcp requests until it gets a reply ?

Edit: this is concerning the Raspbian “wheezy” distro.

share|improve this question
Same problem with wifi. If Wifi Router is on at startup everything goes ok, even with router restart. But if the router is off when raspberry start it never gets an IP. Regards – user3127 Nov 1 '12 at 16:03

Remove the -1 from your command line arguments, then edit the timeout and retry values in /etc/dhclient.conf to your liking. You can look at the man page (man dhclient.conf) for more details.

share|improve this answer
The problem is, as said, I can't find any way to alter the command line of dhclient, it seems to magically somehow be started on boot by something in the ifupdown .deb package as something parses the /etc/network/interfaces – nos Oct 24 '12 at 20:42
@nos You need to find the network init script. I can't remember where it is off hand. – Alex Chamberlain Oct 24 '12 at 20:49
@Alex Chamberlain Turns out the command line for starting dhclient is hard coded in the /sbin/ifup binary. So I'm looking for alternative solutions at this point. – nos Oct 24 '12 at 21:27
Sorry about that. Anyway, what distro is that? Strange they'd hard code stuff into a binary. Solution-wise, you could just add a few lines to rc.local to kill the existing dhclient process and then start your own with custom args etc. – Munkeh Oct 24 '12 at 22:02
Editet the post - I'm using rasbpian – nos Oct 25 '12 at 17:54

What is the content of your /etc/network/interfaces?

I am assuming there is auto eth0 since it does query DHCP on boot.

What if you change that to allow_hotplug eth0? That should react to changes to the interface (cable inserted/removed), if i understand it correctly.

(All this is just my educated guess).

share|improve this answer
This tip works very well for me: it allows for hot-plugging, and speeds up boot-time. But it must be written as "allow-hotplug eth0". – user27164 Feb 24 '14 at 20:53

There's a workaround given here by Jeroen: https://bugs.launchpad.net/raspbian/+bug/1125066

I have setup the workaround and rebooted - seems ok at the moment. Will confirm if problem resolved in an update after testing for a while.

Here's the workaround:

A workaround is to create a wrapper script by renaming /sbin/dhclient to /sbin/dhclient-bin and but the text below in /sbin/dhclient and afterwards chmod it to 777:

/sbin/dhclient-bin -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.