# Forking dhcpcd

## Letharion

An (IMO) obscene % of my time grub => kdm is taken up by dhcpcd. As unfortunately it currently isn't an option to set a static ip and see if that helps, I wanted to try forking dhcpcd.

I don't care if sshd isn't started by the time I've logged in to the desktop for example.

I opened up conf.d/net.eth0 and was just overwhelmed by it's complexity, so I failed at "just adding a &".

What's the easiest way to NOT wait around for dhcpcd to acquire a lease?

What complications can I expect from this?

----------

## alex.blackbit

try rc_parallel="YES" in /etc/rc.conf

----------

## Letharion

 *alex.blackbit wrote:*   

> try rc_parallel="YES" in /etc/rc.conf

 

Thanks  :Smile: 

I should have thought about mentioning that. I already have set it to yes.

----------

## beandog

I like using pump for my DHCP client.  Very snappy.  :Smile:   (Sorry, Roy).

----------

## Letharion

 *beandog wrote:*   

> I like using pump for my DHCP client.  Very snappy.   (Sorry, Roy).

 

Hey beandog  :Smile:  Interesting suggestion, thank you. I dropped dhcpcd and emerged pump. Only problem now is that my init doesn't automatically run pump.

However, I can happily report that without waiting for dhcp (since I don't run one at all) my boot time dropped by 20%  :Very Happy: 

----------

## beandog

It will use dhcpcd by default if it is installed..  Just put modules="pump" in /etc/conf.d/net and it'll prefer pump over dhcpcd.  For the older baselayout, it might be a bit different.

You might want to look at the DHCP section in net.example as well.  Might be something in there that doesnt apply to your network setup that could speed things up.

```
# GENERIC DHCP OPTIONS

# Set generic DHCP options like so

#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"

# This tells the dhcp client to release it's lease when it stops, not to

# overwrite dns, ntp and nis settings, not to set a default route and not to

# send the current hostname to the dhcp server and when it starts.

# You can use any combination of the above options - the default is not to

# use any of them.

```

----------

## UberLord

You can make dhcpcd faster by disabling ARP checking by adding this to /etc/conf.d/net

dhcpcd_eth0="-A"

But if you want maximum speed you should use dhcpcd-4.99 with this init script

http://roy.marples.name/downloads/dhcpcd/dhcpcd.initd

This works outside the net.xxx scripts which I aim to start phasing out in OpenRC-0.5 (they will still exist and work, just proper init scripts will now be prefered).

http://roy.marples.name/node/466

But the simplest solution by the sounds of it is just to install ifplugd  :Wink: 

----------

## UberLord

 *beandog wrote:*   

> I like using pump for my DHCP client.  Very snappy.   (Sorry, Roy).

 

pump is slower than dhcpcd-4·99 on a multihomed system  :Razz: 

----------

## Letharion

Hmmm, since you suggest that, I'm guessing it works. I see it's hardmasked because "Mainly intended for BSD world". Doesn't sound like it will eat my children I suppose, but then why is it hardmasked? Your init-script does look very simple  :Wink: 

Unfortunately, with pump starting properly with modules="pump", I'm back at square one. Didn't gain any speed. Takes about 25-26 seconds grub=>kdm depending if you ask my stopwatch or bootchart.

----------

## UberLord

 *Letharion wrote:*   

> Hmmm, since you suggest that, I'm guessing it works. I see it's hardmasked because "Mainly intended for BSD world". Doesn't sound like it will eat my children I suppose, but then why is it hardmasked? Your init-script does look very simple 

 

It's hard masked so new dhcpcd-4.0.x can be introduced and then go stable

dhcpcd-4.99 is very usable and will become dhcpcd-5 in the next week or so after I finish off one new feature.

 *Quote:*   

> Unfortunately, with pump starting properly with modules="pump", I'm back at square one. Didn't gain any speed. Takes about 25-26 seconds grub=>kdm depending if you ask my stopwatch or bootchart.

 

You should read the last sentance I wrote and just install ifplugd  :Wink: 

----------

## Letharion

 *UberLord wrote:*   

>  *Letharion wrote:*   Hmmm, since you suggest that, I'm guessing it works. I see it's hardmasked because "Mainly intended for BSD world". Doesn't sound like it will eat my children I suppose, but then why is it hardmasked? Your init-script does look very simple  
> 
> It's hard masked so new dhcpcd-4.0.x can be introduced and then go stable
> 
> dhcpcd-4.99 is very usable and will become dhcpcd-5 in the next week or so after I finish off one new feature.
> ...

 

Oh, right, about that. I don't quite get it. ifplugd "Brings up/down ethernet ports automatically with cable detection". Ok, but I don't see how that benefits me. That sound like something I'd want if I regulary moved my computer, and more suitable for a laptop than my desktop, which is "always" online. Anyway, I'll install it, poke it and see what happens  :Wink: 

----------

## beandog

 *UberLord wrote:*   

> You can make dhcpcd faster by disabling ARP checking by adding this to /etc/conf.d/net
> 
> dhcpcd_eth0="-A"

 

Ah yes, that was it ... I remember you mentioning it once before but I forgot to make a note of it.  I will now.

And I forgot about ifplugd.  That will background the DHCP process automatically and let the init scripts that depend on net.eth0 just wait as well, but still boot everything.

Also, how long does just running dhcp on your client take by itself?

----------

## Letharion

Sounds like ifplugd is just what I want then  :Smile: 

Like I said I'm gonna install it and see what happens later today.

----------

## UberLord

 *beandog wrote:*   

> Also, how long does just running dhcp on your client take by itself?

 

Using dhcpcd-4.99.13, it's pretty much instant

dhcpcd starts

dhcpcd detects interfaces

dhcpcd backgrounds

Time taken, practically instant. Configuration required - the dhcpcd init script  :Smile: 

The beauty of this means dhcpcd can ensure IP validation by carrying out its ARP check in the background - you don't notice it.

dhcpcd-4.99 has inbuilt link detection support (no need for ifplugd or wpa_cli)

dhcpcd-4.x can run hooks, so you would hook any IP needed services like ntp-date into dhcpcd. All other desktop services shouldn't need to bind to a specific IP so can also start immediately.

----------

## Letharion

 *UberLord wrote:*   

>  *beandog wrote:*   Also, how long does just running dhcp on your client take by itself? 
> 
> Using dhcpcd-4.99.13, it's pretty much instant
> 
> dhcpcd starts
> ...

 

You've got med convinced, I'm trying  :Smile: 

Upgrade went smooth.

Took your init, dropped in /etc/init.d/dhcpcd, chmod +x, add to rc, dropped net.eth0 from rc, and rebooted.

Success!  :Very Happy:  Bootchart again shows kickass startup time  :Very Happy: 

Gonna try again with a timer, and hope the change is "real" too  :Wink: 

Edit: Unfortunately, grub to kdm isn't a millisecond faster :/ But your new version + script still kicks ass Roy. Atleast I got a veeery pretty bootchart. So now I need to force KDM to start earlier...Last edited by Letharion on Thu Feb 12, 2009 9:29 pm; edited 1 time in total

----------

## beandog

Have you ever looked into using hibernate?  I hate powering up, period.

----------

## Letharion

 *beandog wrote:*   

> Have you ever looked into using hibernate?  I hate powering up, period.

 

Hmmm, no, not really. Any interesting pointers for me?  :Smile: 

I really wanna get down to Arjans 5 sec boot, and I wouldn't care about hibernate though  :Razz: 

And on my previous note on kdm. Putting it in boot doesn't help one bit, putting it in sysinit makes it fail to start, and replacing nvidia-driver while giving me 1 sec isn't really desirable.

----------

## beandog

 *Letharion wrote:*   

>  *beandog wrote:*   Have you ever looked into using hibernate?  I hate powering up, period. 
> 
> Hmmm, no, not really. Any interesting pointers for me? 

 

sys-kernel/tuxonice-sources

sys-apps/tuxonice-userui

sys-power/hibernate-script

and do some reading.  :Smile: 

Might not work with nvidia blobs though.

----------

## Letharion

 *beandog wrote:*   

>  *Letharion wrote:*    *beandog wrote:*   Have you ever looked into using hibernate?  I hate powering up, period. 
> 
> Hmmm, no, not really. Any interesting pointers for me?  
> 
> sys-kernel/tuxonice-sources
> ...

 

Maybe I'll try it  :Smile: 

To bad that the nouveau driver can't do any 3d graphics. I'd gladly dump the blob, but I do want 3d graphics now and then.

----------

