From owner-freebsd-questions@FreeBSD.ORG Wed Dec 3 23:29:53 2008 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3417A106564A for ; Wed, 3 Dec 2008 23:29:53 +0000 (UTC) (envelope-from nlandys@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.184]) by mx1.freebsd.org (Postfix) with ESMTP id AD5A48FC14 for ; Wed, 3 Dec 2008 23:29:52 +0000 (UTC) (envelope-from nlandys@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so3354628fkk.11 for ; Wed, 03 Dec 2008 15:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=R5gKQAWRf+OZEd3a2DFd7hjJn9+ajqddfmRNHJvh0dw=; b=w9fw44FJcfoSM5DcFxbrljOHRJMmSYtwbGX9GvLgou3Q8HiE25c6Wpkpig/cbjazPL I5/QgZRE/Ysrjp8ORutR5P9BaxijdjhWl1xpcDmBHOLQrkUBwjh5Geamqm7ooS15dvOE gLSWLkz668bb+PyuuTeYkCn+/BOunCS3IN6Co= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=V3gXP/DCKNkw52hOAODp5HRrzpCqMCyf+q8i3ED5mK5AAl1Ws/XwMb6rdVuERWSZgW Ro2nDQNzsG64Cer46pFp/JUypQf/FlIYkkqypgDY84MMxfpOq/IX/txBPh2hJSHxms/o 84vzbTJe9+Wx/RTw/XT/KZZSqF5KrXG3bYjTc= Received: by 10.180.213.14 with SMTP id l14mr4835615bkg.107.1228346991143; Wed, 03 Dec 2008 15:29:51 -0800 (PST) Received: by 10.180.240.16 with HTTP; Wed, 3 Dec 2008 15:29:51 -0800 (PST) Message-ID: <560f92640812031529n5406e1c4s81a211ead06cb009@mail.gmail.com> Date: Wed, 3 Dec 2008 15:29:51 -0800 From: "Nerius Landys" To: questions@freebsd.org In-Reply-To: <560f92640812031301m5f51d2c7ia3bcf44454a47820@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <560f92640811211647q551daccnaec4e8085bb8e042@mail.gmail.com> <560f92640812031301m5f51d2c7ia3bcf44454a47820@mail.gmail.com> Cc: Subject: Re: named and ntpd start order in rc.d X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2008 23:29:53 -0000 >> FreeBSD 7.0. 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, 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 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 >> >> 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 > > Modifying /etc/rc.d/ntpd in this manner did not fix the problem. I > still have 2 ntpd processes running indefinitely after bootup of the > system, until I manually issue a "/etc/rc.d/ntpd restart", after which > the ntpd runs fine. As a separate test, I tried adjusting my > resolv.conf to point to an external name server, and I disabled named > at startup, and used the original /etc/rc.d/ntpd. I still got the > same problem - 2 ntpd processes running indefinitely. > > Does anyone know why I'm getting 2 ntpd processes running after bootup > (and ntpd fails to adjust the clock as a result)? Any suggested fix > would be appreciated. > I figured out a fix for this problem! I add ntpdate_enable="YES" to my /etc/rc.conf. As a result, after bootup ntpd is running only one process and the clock gets adjusted gradually after I set it back 30 seconds. So why does running ntpdate at bootup fix the ntpd 2 process hanging problem? Well I had a look at /etc/rc.d/ntpdate: # REQUIRE: NETWORKING syslogd named And, ntpd requires ntpdate. So maybe NETWORKING is the answer to this problem. Without NETWORKING DNS lookups cannot happen and the ntpd process that does the DNS lookups hangs. So it sounds like if you are gonna run ntpd at startup you'd better run ntpdate as well.