Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dhcpcd takes too long to provide DNS
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
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3648
Location: Hamburg

PostPosted: Thu Oct 09, 2014 8:34 pm    Post subject: dhcpcd takes too long to provide DNS Reply with quote

Both at my desktop and at a dedicated server I've a nagging issue with dhcpcd during boot phase.
The dhcpcd service needs too long to deliver a working DNS. Therefore the next services (apache, ntp-client, tor, mysql) either refuse to start or gives warnings.
At my desktop I circumvented it by putting this quick&dirty into /etc/init.d/apache:
Code:
        while [[ : ]]
        do
                host <my hostname> && break
                sleep 1
        done
into the start section.

But I dislike to put similar things into the init script at my server which currently immediately follows after dhcpdc, b/c that might change.
Isn't there any better solution ?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Oct 09, 2014 8:46 pm    Post subject: Reply with quote

Hi toralf

You may wish to look at this bug report:
https://bugs.gentoo.org/show_bug.cgi?id=522206

Basically it allows the dhcpcd service to become re-entrant.
So you could then add the -b flag to dhcpcd to enable fast backgrounding and when an interface comes up dhcpcd will then start the depending services of your liking.

Why is it so slow though? dhcpcd configures fully working DNS very fast on all my machines. Is it a slow network?
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3648
Location: Hamburg

PostPosted: Thu Oct 09, 2014 8:53 pm    Post subject: Reply with quote

Thx, I'll try that.
Well, whilst my desktop might be slow, the server gives me this in rc.log :
Code:
rc default logging started at Thu Oct  9 22:12:18 2014
...
 * Starting DHCP Client Daemon ...
 [ ok ]
 * Bringing up interface enp3s0
 *   config_enp3s0 not specified; defaulting to DHCP
 *   dhcp ...
 *     Running dhcpcd ...
dhcpcd[1752]: sending commands to master dhcpcd process
 [ ok ]
 *     received address
 [ ok ]
 * Setting clock via the NTP client 'ntpdate' ...
Exiting, name server cannot be used: Temporary failure in name resolution (-3) * Failed to set clock
 [ !! ]
 * ERROR: ntp-client failed to start
 * Starting ntpd ...
 [ ok ]
...
rc default logging stopped at Thu Oct  9 22:12:22 2014
== 4 seconds for this phase, I'm pretty sure it is too fast for dhcpcd to configure the resolv.conf, or ?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Oct 09, 2014 8:55 pm    Post subject: Reply with quote

Don't mix net.* services with the dhcpcd service, use one or the other please!

The dhcpcd service is of course better ;)
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3648
Location: Hamburg

PostPosted: Thu Oct 09, 2014 9:07 pm    Post subject: Reply with quote

Ick, I'm using Gentoo for a looong time, sometimes I do miss a bigger change...
I it no longer needed to add net.wlp3so or net.enp3s0 via "rc-update add ..." to a run level ?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Oct 09, 2014 9:14 pm    Post subject: Reply with quote

No, because dhcpcd can do it for you.
You *do* have to configure dhcpcd instead of conf.d/net though.

Click the link in my .sig for a how to guide.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3648
Location: Hamburg

PostPosted: Thu Oct 09, 2014 10:21 pm    Post subject: Reply with quote

puh, I forgot to configure dnsmasq...
Now I do get about 1000 lines like
Code:
Oct 10 00:15:17 n22 dnsmasq[2400]: DBus error: Connection ":1.0" is not allowed to own the service "uk.org.thekelleys.dnsmasq" due to security policies in the configuration file
in my syslog before I could stop dnsmasq and configure it.

Mayby dnsmasq in level boot needs policy kit too ?


Last edited by toralf on Fri Oct 10, 2014 8:45 am; edited 1 time in total
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3648
Location: Hamburg

PostPosted: Fri Oct 10, 2014 8:43 am    Post subject: Reply with quote

Hhm, neither dhcpcd in level boot nor using the net.* scripts solved my issue, but this did it :
Code:
 # cat /etc/conf.d/net
postup()
{
        if [[ "$IFACE" != "lo" ]]; then
                host $HOSTNAME
        fi
}
Both my desktop, my KVM machines and my dedicated server works now fine with this. OTOH my UML instances works fine with dhcpcd in level boot and no net.* script in any other level.

Update rc_depend_strict="YES" seems to work too
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Mon Mar 16, 2015 6:07 pm    Post subject: Reply with quote

I have same problem and nfs-mounts are also failing. rc_depend_strict="YES" and -b flag for dhcpcd didn't help. Tried with both static and dynamic ip.

I don't have dnsmasq installed in this machine, do i really need it? Name resolution is working after i login and ntp-client and netmount init scripts are also working when run manually.

Edit: Next boot after writing above and it seems to work. Cleared some log files before boot, but that shouldn't make difference.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3648
Location: Hamburg

PostPosted: Mon Mar 16, 2015 7:11 pm    Post subject: Reply with quote

It helped to put this into /etc/dhcpcd.conf:
Code:
waitip
and to add the network itnerface explicitely instead of letting dhcpcd doing it during boot himself.
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