conf/132515: ntpd_sync_on_start option in /etc/rc.conf misbehaves
Josh Paetzel
jpaetzel at FreeBSD.org
Tue Mar 10 12:10:02 PDT 2009
>Number: 132515
>Category: conf
>Synopsis: ntpd_sync_on_start option in /etc/rc.conf misbehaves
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Mar 10 19:10:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Josh Paetzel
>Release: 6.4-RELEASE
>Organization:
Prometheus Research
>Environment:
FreeBSD virt.tcbug.org 6.4-RELEASE FreeBSD 6.4-RELEASE #0: Mon Dec 22 01:35:53 UTC 2008 jpaetzel at virt.tcbug.org:/usr/obj/usr/src/sys/VIRT amd64
>Description:
Setting ntpd_sync_on_start="YES" in /etc/rc.conf is not a drop in replacement for the depricated ntpdate
In order to mimic ntpdate's functiomnality, ntpd needs to be started with the -q -x -g flags, which causes it to exit.
As the rc script stands, ntpd_sync_on_start="YES" only adds -g to ntpd's startup
>How-To-Repeat:
ntpd_enable="YES"
ntpd_sync_on_start="YES" in /etc/rc.conf
then slew your time way off
then reboot
ntpd will be started on boot, but won't have synced the time up correctly
>Fix:
As a very naive fix, and more of a proof of concept thing, I tried...
--- /etc/rc.d/ntpd 2008-11-28 11:54:08.000000000 -0600
+++ ntpd 2009-03-10 07:05:46.000000000 -0500
@@ -4,8 +4,7 @@
#
# PROVIDE: ntpd
-# REQUIRE: DAEMON ntpdate cleanvar devfs
-# BEFORE: LOGIN
+# REQUIRE: mount_gbde
# KEYWORD: nojail
. /etc/rc.subr
@@ -23,7 +22,8 @@
rc_flags="-c ${ntpd_config} ${ntpd_flags}"
if checkyesno ntpd_sync_on_start; then
- rc_flags="-g $rc_flags"
+ #rc_flags="-g $rc_flags"
+ ntpd -g -q -x
fi
if [ -z "$ntpd_chrootdir" ]; then
Ignore the REQUIRE changes, the problem and fix was verified on a stock 6.4, I just didn't have access to that box when I wrote this.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list