# dhcpcd fails radomly

## Witos

Hi,

I have following problem: dhcpcd fails at always boot but it usually works fine when the boot ends. I need it working from the begging since I mount some nfs resources. I tried various versions of dhcp clients but the problem remains. I would be grateful for any tips. These might help:

```

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[13996]: version 5.5.6 starting

dhcpcd[13996]: all: not configured to accept IPv6 RAs

dhcpcd[13996]: eth0: waiting for carrier

dhcpcd[13996]: eth0: carrier acquired

dhcpcd[13996]: eth0: rebinding lease of 10.42.1.130

dhcpcd[13996]: eth0: broadcasting for a lease

dhcpcd[13996]: timed out

dhcpcd[13996]: allowing 8 seconds for IPv4LL timeout

dhcpcd[13996]: eth0: probing for an IPv4LL address

dhcpcd[13996]: eth0: checking for 169.254.203.111

dhcpcd[13996]: timed out

 [ !! ]

 [ !! ]

 * ERROR: net.eth0 failed to start

```

When it works:

```

dhcpcd[15449]: version 5.5.6 starting

dhcpcd[15449]: all: not configured to accept IPv6 RAs

dhcpcd[15449]: eth0: rebinding lease of 10.42.1.130

dhcpcd[15449]: eth0: acknowledged 10.42.1.130 from 10.42.0.6

dhcpcd[15449]: eth0: checking for 10.42.1.130

dhcpcd[15449]: eth0: leased 10.42.1.130 for 3600 seconds

dhcpcd[15449]: forked to background, child pid 15487                      [ ok ]

 *     received address 10.42.1.130/17                                    [ ok ]

```

My /etc/conf.d/net file contains only:

```

config_eth0="dhcp"

```

/etc/init.d/dhcpcd

```

#!/sbin/runscript

# Copyright 2007-2008 Roy Marples <roy@marples.name>

# All rights reserved. Released under the 2-clause BSD license.

command=/sbin/dhcpcd

pidfile=/varrot/run/dhcpcd.pid

command_args=-q

name="DHCP Client Daemon"

depend()

{

   provide net

   need localmount

   use logger network

   after bootmisc modules

   before dns

}

```

ifconfig:

```

eth0      Link encap:Ethernet  HWaddr 08:2e:5f:23:b1:1f  

          inet addr:10.42.1.130  Bcast:10.42.127.255  Mask:255.255.128.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:6648 errors:0 dropped:2 overruns:0 frame:0

          TX packets:4112 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:4486652 (4.2 MiB)  TX bytes:721606 (704.6 KiB)

          Interrupt:20 Memory:fe700000-fe720000 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:156 errors:0 dropped:0 overruns:0 frame:0

          TX packets:156 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:12032 (11.7 KiB)  TX bytes:12032 (11.7 KiB)

```

```

emerge --info

Portage 2.1.10.49 (default/linux/amd64/10.0/desktop/gnome, gcc-4.5.3, glibc-2.14.1-r3, 3.2.12-gentoo x86_64)

=================================================================

System uname: Linux-3.2.12-gentoo-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.0.3

Timestamp of tree: Tue, 24 Apr 2012 19:15:01 +0000

app-shells/bash:          4.2_p20

dev-lang/python:          2.7.2-r3, 3.2.2

dev-util/cmake:           2.8.6-r4

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.0.3

sys-apps/openrc:          0.9.8.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.13, 2.68

sys-devel/automake:       1.10.3, 1.11.1

sys-devel/binutils:       2.21.1-r1

sys-devel/gcc:            4.5.3-r2

sys-devel/gcc-config:     1.5-r2

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r1

sys-kernel/linux-headers: 3.1 (virtual/os-headers)

sys-libs/glibc:           2.14.1-r3

Repositories: gentoo

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=core2 -mtune=generic -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=core2 -mtune=generic -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="http://gentoo.mirror.pw.edu.pl/"

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en pl"

MAKEOPTS="-j5"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync6.pl.gentoo.org/gentoo-portage"

USE="3dnow X a52 aac acl acpi aim alsa amd64 apache2 avahi bash-completion berkdb bluetooth branding bzip2 cairo cdb cdda cddb cdparanoia cdr cli colord consolekit cracklib crypt cscope cups cxx dbus directfb dri dts dvb dvd dvdr eds emboss encode evo exif fam ffmpeg firefox flac flax fortran ftp gdbm gdu gif gnome gnome-keyring gnome-online-accounts gstreamer gtk hal iconv ipv6 jabber jpeg lame lcms ldap libnotify lm_sensors mad mmx mng modules mp3 mp4 mpeg mudflap multilib mysql nautilus ncurser ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf png policykit ppds pppd python qt3support qt4 quicktime readline samba session socialweb spell sse sse2 ssl startup-notification svg sysfs tcpd theora tiff tk truetype udev unicode usb v4l vorbis wxwidgets x264 xcb xcomposite xine xml xorg xulrunner xv xvid zlib zsh-completion" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en pl" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

----------

## audiodef

Is this a 100% wired path? Is there wireless involved anywhere?

----------

## Witos

Yes, no wireless.

----------

## PaulBredbury

I would suggest:  --noarp

From:  man dhcpcd

----------

## Witos

Unfortunately it didn't help:

```

 *     Running dhcpcd ...

dhcpcd[13994]: version 5.5.6 starting

dhcpcd[13994]: all: not configured to accept IPv6 RAs

dhcpcd[13994]: eth0: waiting for carrier

dhcpcd[13994]: eth0: carrier acquired

dhcpcd[13994]: eth0: rebinding lease of 10.42.1.130

dhcpcd[13994]: eth0: broadcasting for a lease

dhcpcd[13994]: timed out

dhcpcd[13994]: allowing 8 seconds for IPv4LL timeout

dhcpcd[13994]: eth0: probing for an IPv4LL address

dhcpcd[13994]: eth0: checking for 169.254.245.238

dhcpcd[13994]: timed out

```

----------

## Tsubashi

Necro-post, I know, but I am having the exact same issue as the OP, but on my entire subnet. At my office, we have a single DHCP server which hosts multiple subnets. When I connect any of my Gentoo boxes to subnet A, they have no problem rebinding a lease, but when they are connected to subnet B, I get the same weird error as the OP. As you can imagine, this wreaks havoc with many of the web services I need to start at boot. Having to manually restart all of these services each time I reboot is a pain, and a real problem if the server were to go down at a time when I could not access it locally.

Any ideas on what could be causing this, or where I could look for more info?

Thanks!

----------

## tpereira

I've got a similar problem:

 * Bringing up interface enp0s4

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[1211]: version 6.2.0 starting

dhcpcd[1211]: DUID 00:01:00:01:1a:82:40:83:00:0e:a6:39:c9:50

dhcpcd[1211]: enp0s4: IAID a6:39:c9:50

dhcpcd[1211]: enp0s4: rebinding lease of 10.136.229.237

dhcpcd[1211]: enp0s4: DHCP lease expired

dhcpcd[1211]: enp0s4: soliciting a DHCP lease

dhcpcd[1211]: timed out

dhcpcd[1211]: allowing 8 seconds for IPv4LL timeout

dhcpcd[1211]: enp0s4: probing for an IPv4LL address

dhcpcd[1211]: enp0s4: offered 10.136.229.237 from AAA.BBB.CCC.DDD

dhcpcd[1211]: timed out

dhcpcd[1211]: exited

 [ !! ]

 [ !! ]

 * ERROR: net.enp0s4 failed to start

Already emerged dhcpcd with -ipv6 and already tried adding a delay of 3 seconds in the preup.

Problem persists. Anyone got any ideas?

----------

## niick

I was having this exact issue with dhcpcd timing out on boot.  I 'fixed' it by switching the driver to be a module instead of compiled in.

I realise this is odd and subjective so YMMV.  For me the problem was random but seemed to happen more often then not.  Since I switched it hasn't happened once, this was two weeks ago with a power cycle at least once a day.  Don't know if it's a coincidence but it's an easy thing to try.

Edit: btw the driver was e1000e

----------

## tpereira

 *niick wrote:*   

> I was having this exact issue with dhcpcd timing out on boot.  I 'fixed' it by switching the driver to be a module instead of compiled in.
> 
> I realise this is odd and subjective so YMMV.  For me the problem was random but seemed to happen more often then not.  Since I switched it hasn't happened once, this was two weeks ago with a power cycle at least once a day.  Don't know if it's a coincidence but it's an easy thing to try.
> 
> Edit: btw the driver was e1000e

 

My driver for the net card is already loaded as a module (sis900 in my case). The problem must be something else.

I concluded that if I remove the file /var/lib/dhcpcd/netXXX.leases before starting the dhcpcd service, it always succeeds at getting an address, although it takes something like 20 or 30 seconds.

----------

