# dhcpcd running twice on boot

## BrummieJim

Hi,

On my laptop dhcpcd runs twice during the boot, which takes ages as it has to time out as I'm using wireless mostly. I could lower the timeout but this is annoying.

I'm trying to debug what might be calling this, can anyone help?

Also on a side issue, windows can generally detect if a network cable is plugged in, even if there's no connectivity. Why can't gentoo do this and set the timeout to zero in that case. I could be misunderstanding something about that.

My rc-update show looks like;

```

              urandom |                         boot                  

                devfs |                                        sysinit

            net.wlan0 |                 default                       

                cupsd |                 default                       

             hostname |                         boot                  

                 hald |                 default                       

                 root |                         boot                  

                 sshd |                 default                       

               net.lo |                         boot                  

           vixie-cron |                 default                       

                 swap |                         boot                  

            syslog-ng |                 default                       

               sysctl |                         boot                  

                 mtab |                         boot                  

          consolefont |                         boot                  

              keymaps |                         boot                  

              modules |                         boot                  

             mount-ro |        shutdown                               

            killprocs |        shutdown                               

                dmesg |                                        sysinit

              hwclock |                         boot                  

               procfs |                         boot                  

             net.eth0 |                 default                       

            savecache |        shutdown                               

                  xdm |                 default                       

             netmount |                 default                       

         termencoding |                         boot                  

           lm_sensors |                 default                       

           localmount |                         boot                  

             bootmisc |                         boot                  

           ntp-client |                 default                       

                 fsck |                         boot                  

                 udev |                                        sysinit

                local |                 default      nonetwork        

                 dbus |                 default                       

            alsasound |                         boot                  

        device-mapper |                         boot  

```

Cheers

James

----------

## d2_racing

So you are using baselayout 2.0 and OpenRC I think.

Can you post this :

```

# cat /etc/rc.conf

```

----------

## BrummieJim

Certainly! Yes, you're right about OpenRC

```

 Global OpenRC configuration settings

# Set to "YES" if you want the rc system to try and start services

# in parallel for a slight speed improvement. When running in parallel we

# prefix the service output with it's name as the output will get

# jumbled up.

# WARNING: whilst we have improved parallel, it can still potentially lock

# the boot process. Don't file bugs about this unless you can supply

# patches that fix it without breaking other things!

rc_parallel="NO"

# Set rc_interactive to "YES" and you'll be able to press the I key during

# boot so you can choose to start specific services. Set to "NO" to disable

# this feature.

rc_interactive="YES"

# Do we allow any started service in the runlevel to satisfy the depedency

# or do we want all of them regardless of state? For example, if net.eth0

# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"

# both will be started, but services that depend on 'net' will work if either

# one comes up. With rc_depend_strict="YES" we would require them both to

# come up.

rc_depend_strict="YES"

# rc_hotplug is a list of services that we allow to be hotplugged.

# By default we do not allow hotplugging.

# A hotplugged service is one started by a dynamic dev manager when a matching

# hardware device is found.

# This service is intrinsically included in the boot runlevel.

# To disable services, prefix with a !

# Example - rc_hotplug="net.wlan !net.*"

# This allows net.wlan and any service not matching net.* to be plugged.

# Example - rc_hotplug="*"

# This allows all services to be hotplugged

#rc_hotplug="*"

# rc_logger launches a logging daemon to log the entire rc process to

# /var/log/rc.log

# NOTE: Linux systems require the devfs service to be started before

# logging can take place and as such cannot log the sysinit runlevel.

rc_logger="NO"

# By default we filter the environment for our running scripts. To allow other

# variables through, add them here. Use a * to allow all variables through.

# rc_env_allow="VAR1 VAR2"

# By default we assume that all daemons will start correctly.

# However, some do not - a classic example is that they fork and return 0 AND

# then child barfs on a configuration error. Or the daemon has a bug and the

# child crashes. You can set the number of milliseconds start-stop-daemon

# waits to check that the daemon is still running after starting here.

# The default is 0 - no checking.

# rc_start_wait=100

##############################################################################

# MISC CONFIGURATION VARIABLES

# There variables are shared between many init scripts

# Set unicode to YES to turn on unicode support for keyboards and screens.

unicode="YES"

# Network fstypes. Below is the default.

net_fs_list="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"

##############################################################################

# SERVICE CONFIGURATION VARIABLES

# These variables are documented here, but should be configured in

# /etc/conf.d/foo for service foo and NOT enabled here unless you

# really want them to work on a global basis.

# Some daemons are started and stopped via start-stop-daemon.

# We can set some things on a per service basis, like the nicelevel.

#export SSD_NICELEVEL="-19"

# Pass ulimit parameters 

#rc_ulimit="-u 30"

# It's possible to define extra dependencies for services like so

#rc_config="/etc/foo"

#rc_need="openvpn"

#rc_use="net.eth0"

#rc_after="clock"

#rc_before="local"

#rc_provide="!net"

# You can also enable the above commands here for each service. Below is an

# example for service foo.

#rc_foo_config="/etc/foo"

#rc_foo_need="openvpn"

#rc_foo_after="clock"

# You can also remove dependencies.

# This is mainly used for saying which servies do NOT provide net.

#rc_net_tap0_provide="!net"

##############################################################################

# LINUX SPECIFIC OPTIONS

# This is the number of tty's used in most of the rc-scripts (like

# consolefont, numlock, etc ...)

rc_tty_number=12

```

----------

## d2_racing

Maybe you should add  this :

```

RC_PLUG_SERVICES="!net.*"

```

----------

## UberLord

 *BrummieJim wrote:*   

> Also on a side issue, windows can generally detect if a network cable is plugged in, even if there's no connectivity. Why can't gentoo do this and set the timeout to zero in that case. I could be misunderstanding something about that.

 

You need to install either ifplugd or netplug for that.

dhcpcd-4.x does have carrier detection though, so your network driver maybe faulty.

----------

## BrummieJim

I'm using a 

 Ethernet controller: Marvell Technology Group Ltd. 88E8040 PCI-E Fast Ethernet Controller (rev 12)

and dhcpcd 4.10

but it doesn't give up if there's no cable attached.

Jim

----------

## BrummieJim

I can't run this personally as I don't have nm-tool installed but this page seems to indicate that the sky2 driver supports carrier detection.

http://forum.ubuntu-fr.org/viewtopic.php?id=289654

My kernel is:

Hawaiian ~ # uname -a

Linux Hawaiian 2.6.27-gentoo-r2 #1 SMP Wed Nov 12 17:56:43 GMT 2008 x86_64 Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz GenuineIntel GNU/Linux

----------

## BrummieJim

This is really annoying, dhcpcd running twice on boot and then not realising that there's not even a cable plugged in. Seems my scripts demand eth0 to be up even when restarting cupsd. Does anyone know of a guide for dhclient on gentoo?

----------

## d2_racing

Maybe the best is this :

```

# rc-update del net.eth0 default

```

And start manually your interface with 

```

# /etc/init.d/net.eth0 start

```

----------

## drizzt

you don't really mean that...   :Crying or Very sad: 

embarrassing that such a good os can't do that

----------

