From nobody@FreeBSD.org Mon Nov 24 19:53:09 2008 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B3941065670 for ; Mon, 24 Nov 2008 19:53:09 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 7DC058FC1A for ; Mon, 24 Nov 2008 19:53:09 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOJr9m5002374 for ; Mon, 24 Nov 2008 19:53:09 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id mAOJr9qj002373; Mon, 24 Nov 2008 19:53:09 GMT (envelope-from nobody) Message-Id: <200811241953.mAOJr9qj002373@www.freebsd.org> Date: Mon, 24 Nov 2008 19:53:09 GMT From: Nerius Landys To: freebsd-gnats-submit@FreeBSD.org Subject: named and ntpd start order in rc.d X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 129146 >Category: conf >Synopsis: [rc.d] named and ntpd start order in rc.d >Confidential: no >Severity: non-critical >Priority: medium >Responsible: dougb >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Nov 24 20:00:19 UTC 2008 >Closed-Date: Sat Jan 10 04:09:20 UTC 2009 >Last-Modified: Sat Jan 10 04:09:20 UTC 2009 >Originator: Nerius Landys >Release: 7.0-RELEASE >Organization: (hobby) >Environment: FreeBSD daffy.nerius.com 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Fri Feb 29 18:56:41 PST 2008 root@daffy.nerius.com:/usr/obj/usr/src/sys/DAFFY i386 >Description: I am having a problem when ntpd starts at bootup. It continues to have 2 processes running, the process which does the DNS lookup fails to exit (I believe), and ntpd fails to adjust the clock even after days of running. Immediately after bootup and several hours or days later this is what I get: # ps -U root | grep ntpd 87837 ?? Ss 0:00.03 /usr/sbin/ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid 87838 ?? S 0:00.00 /usr/sbin/ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid If I do a "/etc/rc.d/ntpd restart" on a running system it fixes the problem, and only one of the ntpd processes remains, and the clock gets adjusted. >How-To-Repeat: I have named running as a caching name server on my system. The contents of my /etc/resolv.conf: domain nerius.com nameserver 127.0.0.1 My /etc/rc.conf: .. named_enable="YES" ntpd_enable="YES" .. I believe that the problem with ntpd is that named is started AFTER ntpd. Trying to reproduce problem. On a running system. I shut down named. Then I restart ntpd, then I start named. I can reproduce the problem that happens on bootup - ntpd has 2 processes and does not adjust the clock. Restarting ntpd while named is running fixes the problem. >Fix: I don't have a 100% fix for this problem, and I am unable to test my suggested fix below because it's too dangerous to do on my running server. An expert will know the elegant fix to this problem; below is only a guess/suggestion. I believe that the fix for this is to add a dependency to /etc/rc.d/ntpd script, adding "named" to "REQUIRE" section in comments. In your opinion, is this a robust fix? For example the line in my /etc/rc.d/ntpd script that looks like so: # REQUIRE: DAEMON ntpdate cleanvar devfs would be changed to this: # REQUIRE: DAEMON ntpdate cleanvar devfs named >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->freebsd-rc Responsible-Changed-By: gavin Responsible-Changed-When: Thu Nov 27 22:27:03 UTC 2008 Responsible-Changed-Why: Over to maintainers http://www.freebsd.org/cgi/query-pr.cgi?pr=129146 From: John Marshall To: bug-followup@FreeBSD.org, nlandys@gmail.com Cc: Subject: Re: conf/129146: [rc.d] named and ntpd start order in rc.d Date: Fri, 28 Nov 2008 11:35:14 +1100 --cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Nerius, Thank you for your report. The startup (rc) ordering of the named and ntpd components is correct. You have looked at the REQUIRE line in the ntpd script. If you look at the REQUIRE line in the ntpdate script you will see that it requires named. The way this works is that ntpd requires ntpdate which requires named. You need to follow the chain back to get the picture. Dependencies in 7.0-RELEASE result in the following startup (rc) order (of pertinent components): /etc/rc.d/named /etc/rc.d/ntpdate /etc/rc.d/ntpd Perhaps you have a situation where the Internet is not available until after your system has started, so named is unable to resolve the hostnames for ntpd in time? In such a case you are probably best either using IP addresses for servers in ntp.conf or re-starting ntpd later on (as you are doing). In any case, your problem is not rc order but the inability of your named to resolve queries (for whatever reason) during startup. There is no problem with the rc order. The order you desire already exists. I suggest that this PR can be closed. --=20 John Marshall --cNdxnHkX5QqsyA0e Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkkvPMIACgkQw/tAaKKahKL5KQCffiKiNHyDMp6U/z3TNd002Ghq DgoAn32liwCRzcvakhxnXL2oYngmwVAY =ktSi -----END PGP SIGNATURE----- --cNdxnHkX5QqsyA0e-- State-Changed-From-To: open->closed State-Changed-By: dougb State-Changed-When: Sat Jan 10 04:08:30 UTC 2009 State-Changed-Why: Mr. Marshall's analysis is correct. Responsible-Changed-From-To: freebsd-rc->dougb Responsible-Changed-By: dougb Responsible-Changed-When: Sat Jan 10 04:08:30 UTC 2009 Responsible-Changed-Why: I twiddle named and rc.d bits http://www.freebsd.org/cgi/query-pr.cgi?pr=129146 >Unformatted: