From owner-freebsd-stable@FreeBSD.ORG Wed Nov 30 02:21:00 2005 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5138B16A41F for ; Wed, 30 Nov 2005 02:21:00 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 435AB43D76 for ; Wed, 30 Nov 2005 02:19:49 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id jAU2JUrl025869; Tue, 29 Nov 2005 18:19:30 -0800 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id jAU2JUPF025868; Tue, 29 Nov 2005 18:19:30 -0800 Date: Tue, 29 Nov 2005 18:19:30 -0800 From: Brooks Davis To: "Ian D. Leroux" Message-ID: <20051130021930.GA24227@odin.ac.hmc.edu> References: <1133316076.522.28.camel@localhost> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: <1133316076.522.28.camel@localhost> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: freebsd-stable@freebsd.org Subject: Re: Restarting ntpd on address change X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2005 02:21:00 -0000 --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 29, 2005 at 09:01:16PM -0500, Ian D. Leroux wrote: > Greetings, >=20 > My machine's ip address is assigned by DHCP, and whenever it changes > ntpd stops functioning and must be restarted. I gather this behavior > will be changed in some future ntpd version, but in the meantime I had > added a line to my /etc/dhclient-exit-hooks to restart ntpd every time a > new address was obtained: >=20 > # [...] setup variables for ipcheck >=20 > if [ -n "$new_ip_address" ]; then > # [...] run ipcheck to update my dyndns > /etc/rc.d/ntpd restart > fi >=20 > This seemed work fine on 5.4, but on 6.0 it gives problems at boot. > Specifically, I get repeated "bad file descriptor" errors after my > network address is assigned, and running ps after the boot completes > shows that there are two ntpd processes running. Killing one of them > stops the file descriptor errors. My interpretation of this (for what > it's worth) is that an ntpd process gets started before dhclient gets a > chance to configure the address (perhaps when the interface initially > comes up) and then when the address is assigned the /etc/rc.d/ntpd > restart starts a second process, but somehow fails to stop the first > one. For now I've removed that line from dhclient-exit-hooks, which > avoids the problems at boot time. >=20 > I have the feeling that I'm not doing the Right Thing here. So is there > an accepted (or at least known-good) way of automatically managing the > restart of ntpd on address change? Have I found a bug in rc.d worth > investigating? Or should I just stick to manual restarts until ntpd > stops needing them? Hmm, this should work because the pid file should prevent ntpd from getting started twice. That happens on my -CURRENT laptop so I'm thinking there's something going on in the startup process that's tripping you up. One thought I had was that /var/run might be getting cleared, but it doesn't look like that should be the case. On a tangential note, the ntpd script won't actually support chroots due to it's broken assumption that devices can exist outside devfs file systems. --- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --4Ckj6UjgE2iN1+kY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFDjQwyXY6L6fI4GtQRAvYxAKCsY1d9YmyDK1uyG/R1QOxSrYC0vACgnXH5 f93xteMqjChuvXfrrmIK/2c= =olKt -----END PGP SIGNATURE----- --4Ckj6UjgE2iN1+kY--