From nobody@FreeBSD.org  Mon Mar 18 21:42:27 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id AE92AD2E
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Mar 2013 21:42:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id A0C07DC1
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Mar 2013 21:42:27 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r2ILgR1w026575
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Mar 2013 21:42:27 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r2ILgRJv026574;
	Mon, 18 Mar 2013 21:42:27 GMT
	(envelope-from nobody)
Message-Id: <201303182142.r2ILgRJv026574@red.freebsd.org>
Date: Mon, 18 Mar 2013 21:42:27 GMT
From: Maurizio Giunti <giunti@mgshareware.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ntpd startup script does not work well
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         177089
>Category:       conf
>Synopsis:       ntpd startup script does not work well
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-rc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 18 21:50:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Mon Mar 25 20:40:00 UTC 2013
>Originator:     Maurizio Giunti
>Release:        9.1 amd64
>Organization:
MGShareware
>Environment:
FreeBSD deathstar.homegiunti 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
Calling /etc/rc.d/ntpd stop issue an error "ntpd not running? (check /var/run/ntpd.pid)." but ntpd is active!


# /etc/rc.d/ntpd start
Starting ntpd.
# ps auxww | grep ntpd
root     2577   0.5  0.1 22196 4052 ??  Ss   10:37PM   0:00.04 /usr/sbin/ntpd -c /etc/ntp.conf -L
# cat /var/run/ntpd.pid
cat: /var/run/ntpd.pid: No such file or directory
# /etc/rc.d/ntpd stop
ntpd not running? (check /var/run/ntpd.pid).

But ntpd is actually running:
# ps auxww | grep ntpd
root     2577   0.0  0.1 22196 4064 ??  Ss   10:37PM   0:00.06 /usr/sbin/ntpd -c /etc/ntp.conf -L


>How-To-Repeat:
Enable ntpd in your /etc/rc.conf file with
echo "ntpd_enable='YES'" >> /etc/rc.conf

Start ntpd with
/etc/rc.d/ntpd start

Than stop it with
/etc/rc.d/ntpd stop

You get the error "ntpd not running? (check /var/run/ntpd.pid)."

Use 
ps auxww | grep ntpd

to check that NTPD is actually running.




>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Mar 24 01:14:01 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=177089 

From: John Marshall <john.marshall@riverwillow.com.au>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/177089: ntpd startup script does not work well
Date: Mon, 25 Mar 2013 13:28:19 +1100

 [fowarded message - forgot to add bug-followup@ to the Cc: list]
 
 Date: Mon, 25 Mar 2013 12:27:41 +1100
 From: John Marshall <john.marshall@riverwillow.com.au>
 To: Maurizio Giunti <giunti@mgshareware.com>
 Cc: freebsd-bugs@FreeBSD.org, freebsd-rc@FreeBSD.org
 Subject: Re: conf/177089: ntpd startup script does not work well
 User-Agent: Mutt/1.5.21 (2010-09-15)
 
 > Calling /etc/rc.d/ntpd stop issue an error "ntpd not running? (check /var/run/ntpd.pid)." but ntpd is active!
 
 Please check to see if you have set ntpd_flags in your /etc/rc.conf.
 Note the default contents of this variable in /etc/defaults/rc.conf
 
   ntpd_flags="-p /var/run/ntpd.pid -f /var/db/ntpd.drift"
 
 If you define ntpd_flags in your /etc/rc.conf, you override the default
 ntpd_flags.  In order to retain the expected behaviour of the rc script,
 you need to include the default ntpd_flags in your modified variable.
 So, if you want to pass other flags to ntpd, then you would put this in
 your /etc/rc.conf
 
   ntpd_flags="<other flags> -p /var/run/ntpd.pid -f /var/db/ntpd.drift"
 
 Please let us know if this solves your problem so that the PR can be
 closed.
 
 -- 
 John Marshall

From: John Marshall <john.marshall@riverwillow.com.au>
To: Maurizio Giunti <giunti@mgshareware.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: conf/177089: ntpd startup script does not work well
Date: Tue, 26 Mar 2013 07:37:47 +1100

 On Mon, 25 Mar 2013, 18:12 +0100, Maurizio Giunti wrote:
 > John,
 > 
 > you are absolutely right!
 > I added the flags you suggested and now ntpd starts and stops as expected.
 > Thank you!
 
 Good.  I suggest that this PR may now be closed.
 
 > Just in case, I still can't get -L flag work, exactly as described here: 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/128886
 > Have you any idea about it? :)
 
 I chased this years ago and discovered that the ntpd '-L' option only
 ever worked on Linux (but I can't locate an authoritative reference
 right now).  This section of the ntpd code has been reworked in recent
 years and current versions use a configuration file 'interface'
 directive instead, which works on FreeBSD.  In order to select specific
 ntpd service addresses you will need to upgrade to a current version of
 ntpd (e.g. via ports net/ntp) and use the 'interface listen' directive
 in ntp.conf.
 
 -- 
 John Marshall
>Unformatted:
