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.
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
How-To-Repeat: I have named running as a caching name server on my system. The contents of my /etc/resolv.conf:
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.
Over to maintainers
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):
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
There is no problem with the rc order. The order you desire already
I suggest that this PR can be closed.
Mr. Marshall's analysis is correct.
I twiddle named and rc.d bits