Bug 449750

Summary: ntpd -q does not exit when no servers are defined in /etc/ntpd.conf
Product: Red Hat Enterprise Linux 4 Reporter: Martin Poole <mpoole>
Component: ntpAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.6CC: azelinka, mcermak, ovasik, rdoty, tao, thoger
Target Milestone: rcKeywords: Reopened
Target Release: 4.9   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ntp-4.2.0.a.20040617-12.el4 Doc Type: Bug Fix
Doc Text:
The "-q" switch causes ntpd to exit immediately after setting the clock but this action only occurs if there are configured servers for ntpd to set a clock against. The man page did not note this latter point. This ambiguity meant it was possible to conclude ntpd was misbehaving when it did not quit if run with the "-q" switch but with no configured servers. With this update, the ntpd man page now notes that "ntpd -q" only exits if used to set the clock with configured servers.
Story Points: ---
Clone Of:
: 591837 591838 (view as bug list) Environment:
Last Closed: 2011-02-16 14:03:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 447953, 494835, 591837, 591838, 626414    

Description Martin Poole 2008-06-03 11:25:44 UTC
ntpdate has been deprecated and the functionality provided by it is now
available in ntpd using the -q parameter.

From man ntpd
--
In some cases it may not be practical for ntpd  to run continuously. A common
workaround has been to run the ntpdate  program from a cron   job  at designated
 times.   However,  this  program does not have the crafted signal processing,
error checking and mitigation algorithms of ntpd . The -q option is intended for
this purpose. Setting this option will cause ntpd  to exit just after setting
the clock for the first  time.  The  procedure for  initially  setting  the 
clock is the same as in continuous mode; most applications will probably want to
specify the iburst  keyword with the server  configuration command. With this
keyword a volley of messages are exchanged to groom the data and the clock is
set in about  a  minute.  If nothing  is  heard  after  a  couple  of  minutes,
the daemon times out and exits. After a suitable period of mourning, the ntpdate
 program may be retired
--

When no servers configured in ntp.conf (misconfiguration) - ntpd -q never exits.


--

Comment 1 Martin Poole 2008-06-03 11:29:50 UTC
Debugged run with simple config file.

# more /etc/ntp.conf
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
server 172.16.52.228

# /usr/sbin/ntpd -q  -d -g -x
ntpd 4.2.0a Thu Oct  5 04:11:32 EDT 2006 (1)
addto_syslog: ntpd 4.2.0a Thu Oct  5 04:11:32 EDT 2006 (1)
addto_syslog: precision = 3.000 usec
create_sockets(123)
bind() fd 4, family 2, port 123, addr 0.0.0.0, flags=8
addto_syslog: Listening on interface wildcard, 0.0.0.0#123
bind() fd 5, family 10, port 123, addr ::, flags=0
addto_syslog: Listening on interface wildcard, ::#123
bind() fd 6, family 2, port 123, addr 127.0.0.1, flags=0
addto_syslog: Listening on interface lo, 127.0.0.1#123
bind() fd 7, family 2, port 123, addr 10.33.1.120, flags=8
addto_syslog: Listening on interface eth0, 10.33.1.120#123
bind() fd 8, family 2, port 123, addr 172.16.19.1, flags=8
addto_syslog: Listening on interface vmnet1, 172.16.19.1#123
bind() fd 9, family 2, port 123, addr 172.16.102.1, flags=8
addto_syslog: Listening on interface vmnet8, 172.16.102.1#123
init_io: maxactivefd 9
local_clock: time 0 clock 0.000000 offset 0.000000 freq 0.000 state 0
addto_syslog: frequency initialized -5.208 PPM from /var/lib/ntp/drift
local_clock: time 0 clock 0.000000 offset 0.000000 freq -5.208 state 1
key_expire: at 0
peer_clear: at 0 assoc ID 27268 refid INIT
newpeer: 10.33.1.120->172.16.52.228 mode 3 vers 4 poll 6 10 flags 0x201 0x1 ttl
 key 00000000
report_event: system event 'event_restart' (0x01) status 'sync_alarm,
sync_unspec, 1 event, event_unspec' (0xc010)
transmit: at 1 10.33.1.120->172.16.52.228 mode 3
auth_agekeys: at 1 keys 1 expired 0
timer: refresh ts 0
receive: at 1 10.33.1.120<-172.16.52.228 mode 4 code 1
peer 172.16.52.228 event 'event_reach' (0x84) status 'unreach, conf, 1 event,
event_reach' (0x8014)
clock_filter: popcorn 0.001465 0.000015
transmit: at 3 10.33.1.120->172.16.52.228 mode 3
receive: at 3 10.33.1.120<-172.16.52.228 mode 4 code 1
clock_filter: n 2 off -0.001465 del 0.100089 dsp 3.937520 jit 0.000684, age 3
transmit: at 5 10.33.1.120->172.16.52.228 mode 3
receive: at 5 10.33.1.120<-172.16.52.228 mode 4 code 1
clock_filter: n 3 off -0.001822 del 0.099910 dsp 1.937524 jit 0.000779, age 2
transmit: at 7 10.33.1.120->172.16.52.228 mode 3
receive: at 7 10.33.1.120<-172.16.52.228 mode 4 code 1
clock_filter: n 4 off -0.001822 del 0.099910 dsp 0.937551 jit 0.005624, age 4
transmit: at 9 10.33.1.120->172.16.52.228 mode 3
receive: at 9 10.33.1.120<-172.16.52.228 mode 4 code 1
clock_filter: n 5 off -0.001822 del 0.099910 dsp 0.437573 jit 0.004872, age 6
report_event: system event 'event_peer/strat_chg' (0x04) status 'sync_alarm,
sync_ntp, 2 events, event_restart' (0xc621)
addto_syslog: synchronized to 172.16.52.228, stratum 2
clock_update: at 9 assoc 1 
local_clock: assocID 27268 offset -0.001822253 freq -5.208 state 1
addto_syslog: time slew -0.001822 s
ntpd: time slew -0.001822s

#

Comment 2 Martin Poole 2008-06-03 11:31:43 UTC
Debugged run with faulty simple config file.

# more /etc/ntp.conf
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys

# /usr/sbin/ntpd -q  -d -g -x
ntpd 4.2.0a Thu Oct  5 04:11:32 EDT 2006 (1)
addto_syslog: ntpd 4.2.0a Thu Oct  5 04:11:32 EDT 2006 (1)
addto_syslog: precision = 3.000 usec
create_sockets(123)
bind() fd 4, family 2, port 123, addr 0.0.0.0, flags=8
addto_syslog: Listening on interface wildcard, 0.0.0.0#123
bind() fd 5, family 10, port 123, addr ::, flags=0
addto_syslog: Listening on interface wildcard, ::#123
bind() fd 6, family 2, port 123, addr 127.0.0.1, flags=0
addto_syslog: Listening on interface lo, 127.0.0.1#123
bind() fd 7, family 2, port 123, addr 10.33.1.120, flags=8
addto_syslog: Listening on interface eth0, 10.33.1.120#123
bind() fd 8, family 2, port 123, addr 172.16.19.1, flags=8
addto_syslog: Listening on interface vmnet1, 172.16.19.1#123
bind() fd 9, family 2, port 123, addr 172.16.102.1, flags=8
addto_syslog: Listening on interface vmnet8, 172.16.102.1#123
init_io: maxactivefd 9
local_clock: time 0 clock 0.000000 offset 0.000000 freq 0.000 state 0
addto_syslog: frequency initialized -5.208 PPM from /var/lib/ntp/drift
local_clock: time 0 clock 0.000000 offset 0.000000 freq -5.208 state 1
report_event: system event 'event_restart' (0x01) status 'sync_alarm,
sync_unspec, 1 event, event_unspec' (0xc010)
auth_agekeys: at 1 keys 1 expired 0
timer: refresh ts 0
auth_agekeys: at 60 keys 1 expired 0
auth_agekeys: at 120 keys 1 expired 0
auth_agekeys: at 180 keys 1 expired 0
auth_agekeys: at 240 keys 1 expired 0
auth_agekeys: at 300 keys 1 expired 0
auth_agekeys: at 360 keys 1 expired 0
auth_agekeys: at 420 keys 1 expired 0
auth_agekeys: at 480 keys 1 expired 0
auth_agekeys: at 540 keys 1 expired 0
auth_agekeys: at 600 keys 1 expired 0
auth_agekeys: at 660 keys 1 expired 0
auth_agekeys: at 720 keys 1 expired 0
addto_syslog: ntpd exiting on signal 2

#


Comment 3 Miroslav Lichvar 2008-06-12 12:02:28 UTC
Upstream bug report:
https://support.ntp.org/bugs/show_bug.cgi?id=1034

Comment 4 RHEL Program Management 2008-10-31 16:41:01 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 6 Miroslav Lichvar 2010-03-19 09:57:26 UTC
As RHEL-4.9 is the last update for RHEL-4, which should address only security, performance and critical issues, I'm closing this bug as WONTFIX. If you 
are still experiencing this issue with RHEL-5, please reopen it against RHEL-5.

If this issue is critical for you, please contact Red Hat support.

Comment 22 errata-xmlrpc 2011-02-16 14:03:14 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0222.html

Comment 23 Eva Kopalova 2011-06-24 15:23:37 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The "-q" switch causes ntpd to exit immediately after setting the clock but this action only occurs if there are configured servers for ntpd to set a clock against. The man page did not note this latter point. This ambiguity meant it was possible to conclude ntpd was misbehaving when it did not quit if run with the "-q" switch but with no configured servers. With this update, the ntpd man page now notes that "ntpd -q" only exits if used to set the clock with configured servers.