Bug 177089 - ntpd startup script does not work well
Summary: ntpd startup script does not work well
Status: Closed DUPLICATE of bug 199127
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2013-03-18 21:50 UTC by Maurizio Giunti
Modified: 2018-06-28 22:18 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Maurizio Giunti 2013-03-18 21:50:00 UTC
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)."

ps auxww | grep ntpd

to check that NTPD is actually running.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-03-24 01:14:01 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 2 John Marshall 2013-03-25 02:28:19 UTC
[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

John Marshall
Comment 3 John Marshall 2013-03-25 20:37:47 UTC
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
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:35 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 5 Ian Lepore freebsd_committer 2018-06-28 22:18:24 UTC

*** This bug has been marked as a duplicate of bug 199127 ***