Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
DHCPCD while in background
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
GSnake
Tux's lil' helper
Tux's lil' helper


Joined: 10 Sep 2012
Posts: 100
Location: Italy

PostPosted: Tue Sep 11, 2012 2:07 pm    Post subject: DHCPCD while in background Reply with quote

Hello guys! I've finally managed to get everything work but my boot time is compromised by dhcpcd trying to link my ethernet card to the net. What can I do to make it execute in background so my PC can boot faster? Thanks!
Back to top
View user's profile Send private message
oquol
n00b
n00b


Joined: 23 Apr 2011
Posts: 12

PostPosted: Tue Sep 11, 2012 8:55 pm    Post subject: Reply with quote

Try removing dhcpcd from rc-update and installing ifplugd. If you haven't done it yet it might help.
_________________
Dell N5010, ATI HD5650 1GiB, HDD 500GiB, Core i3 370 2,4GHz
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2248

PostPosted: Tue Sep 11, 2012 9:11 pm    Post subject: Reply with quote

GSnake ...

Something is in the runlevel that requires 'net' (what I can't say) this in turn causes dhcpcd to run and provide 'net' (unless of course you've added to to the 'default' runlevel).

You can have dhcpcd not provide net by adding: rc_dhcpcd_provide="!net" to /etc/rc.conf, this will stop dhcpcd from running at boot but you will still have that service (whatever it might be) requiring 'net'. So, you should see what you have added to the runlevel that is the cause of this, as these services require 'net' in order to function correctly.

The following will provide a list of all services set to start at the 'default' runlevel ...
Code:
rc-config list default

You can then remove the service from the runlevel with the following:

Code:
rc-update del <service> default

Thats it basically, there are additional things I could suggest (like creating additional runlevels for 'online' and what-have-you) but as I'm not entirely sure of whats happening, and what your trying to achieve, I'll leave that for you to query.

best ... khay
Back to top
View user's profile Send private message
Ant P.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 2524
Location: UK

PostPosted: Tue Sep 11, 2012 11:25 pm    Post subject: Reply with quote

If you already have xdm in the default runlevel, just use a script in /etc/local.d to start dhcpcd; that way it'll only start while your login screen is visible.
Back to top
View user's profile Send private message
GSnake
Tux's lil' helper
Tux's lil' helper


Joined: 10 Sep 2012
Posts: 100
Location: Italy

PostPosted: Wed Sep 12, 2012 12:21 pm    Post subject: Reply with quote

khayyam wrote:
GSnake ...

Something is in the runlevel that requires 'net' (what I can't say) this in turn causes dhcpcd to run and provide 'net' (unless of course you've added to to the 'default' runlevel).

You can have dhcpcd not provide net by adding: rc_dhcpcd_provide="!net" to /etc/rc.conf, this will stop dhcpcd from running at boot but you will still have that service (whatever it might be) requiring 'net'. So, you should see what you have added to the runlevel that is the cause of this, as these services require 'net' in order to function correctly.

The following will provide a list of all services set to start at the 'default' runlevel ...
Code:
rc-config list default

You can then remove the service from the runlevel with the following:

Code:
rc-update del <service> default

Thats it basically, there are additional things I could suggest (like creating additional runlevels for 'online' and what-have-you) but as I'm not entirely sure of whats happening, and what your trying to achieve, I'll leave that for you to query.

best ... khay


I'm sorry but I'm here to learn so can I ask you what is a run-level? I started a lot of service under the "default" runlevel but I can't truly understand what it is..
How can I make something "start" at boot? (like apps and so on)
Currently I'm following the suggestion of Ant. P since it seems to be the best-fitting for me. [I made a file named 00dhcpcd.start with "exec dhcpcd" in it. Have I done it right?]

Thank you guys!
Back to top
View user's profile Send private message
Ant P.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 2524
Location: UK

PostPosted: Wed Sep 12, 2012 2:28 pm    Post subject: Reply with quote

A better way would be "rc-service dhcpcd start", but I guess yours works too.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2248

PostPosted: Wed Sep 12, 2012 8:04 pm    Post subject: Reply with quote

GSnake wrote:
I'm sorry but I'm here to learn so can I ask you what is a run-level? I started a lot of service under the "default" runlevel but I can't truly understand what it is. How can I make something "start" at boot? (like apps and so on). Currently I'm following the suggestion of Ant. P since it seems to be the best-fitting for me.

GSnake ... runlevels are covered in part 2, chapter 4 of the handbook. All, you need understand it that its not simply a matter of starting something at boot, but the dependencies of the services you start. So, for instance, if you start ntpd it will need 'net' in order to function correctly.

The initscripts will state something like the following:

Code:
depend() {
    provide net
    before dns
}

This service if started at the 'default' run-level will 'provide net' ... other services will 'use net', eg:

Code:
depend() {
    use net dns
}

This lays out a dependency stucture for how services are started, and what must be 'provided' before they start.

In your case, as I explaned, something is in the 'default' runlevel that uses 'net', but nothing is providing it and so dhcpcd is started to meet that dependency. Normally 'net' would be provided by 'net.eth0' or 'net.wlan0', or not provided at all if, for example, something like wicd is used to manage the network interfaces.

So, not knowing what services your starting, or what your trying to achieve, I can't really suggest how this should be configured. In my case I have, besides the standard run-levels of 'boot', 'sysinit' and 'default', a runlevel called 'online', this run-level is started only when explicitly called, otherwise no services that require 'net' are started.

GSnake wrote:
[I made a file named00dhcpcd.start with "exec dhcpcd" in it. Have I done it right?]

I would say no, it will work (perhaps even when you don't want it to), but by putting it in local you are not really taking advantage of run-levels. I would suggest you not have dhcpcd provide 'net' (see above) and have the actual service net.${IFACE} provide this, or have seperate run-levels for 'default' and 'online', but all this is speculative as I can only guess as how the setup is currently configured, and what your trying to do.

best ... khay
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32334
Location: 56N 3W

PostPosted: Wed Sep 12, 2012 9:28 pm    Post subject: Reply with quote

dhcpcd should not be in any runlevel. It will be started by the first interface that needs it.
Its possible to set a timeout for dhcpcd. Too low and your network will never get set up but the 60 second default is too high.
7 seconds or so should be adequate for wired interfaces.

If you don't mince race conditions and possible lock ups during boot you can set an option in /etc/rc.conf to start things in parallel. See
Code:
# 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!

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum