[ntp:questions] Finding out where ntpd gets its ntp.conf file

Unruh unruh-spam at physics.ubc.ca
Thu Sep 4 19:08:55 UTC 2008

Joseph Gwinn <joegwinn at comcast.net> writes:

>In article <30s4p5-as9.ln1 at gateway.py.meinberg.de>,
> Martin Burnicki <martin.burnicki at meinberg.de> wrote:

>> Joe,
>> Joseph Gwinn wrote:
>> > In article <48bf5d9c$0$21355$c30e37c6 at pit-reader.telstra.net>,
>> >  "Peter J. Cherny" <peterc at luddite.com.au> wrote:
>> > 
>> >> Joseph Gwinn wrote:
>> >> >...
>> >> > Which brings me to a question:  How does one get NTP to tell you
>> >> > exactly where it is getting such things as the ntp.conf file from, all
>> >> > without
>> >>  >...
>> >> [peterc at tantalus ~]$ strings /usr/sbin/ntpd|grep ntp.conf
>> >> /etc/ntp.conf
>> > 
>> > In the RHEL case, this would find exactly the wrong copy of ntp.conf,
>> > being the one we were changing to no avail, not the one that NTP was in
>> > fact using.
>> > 
>> > 
>> >> [peterc at tantalus ~]$ strace -f -o x /usr/sbin/ntpd -g
>> > 
>> > I'll have to look into this.  It sounds like it might be general enough.
>> > 
>> >  
>> >> [root at tantalus ~]# grep ntp.conf x
>> >> 3351  open("/etc/ntp.conf", O_RDONLY)   = 4
>> > 
>> > Doesn't this assume that the correct "ntp.conf" file is called ntp.conf?
>> > It may be common, the standard convention, but it is not required.
>> > 
>> > The whole point is to find the correct file without making assumptions,
>> > because on a strange computer strange things may have been done.
>> I fully agree.
>> Ntpd generates a bunch of messages about what it has found in the config
>> file, at least in debug mode.
>> Maybe you should open an enhancement request on http://bugs.ntp.org to make
>> ntpd also print the name of the config file it is using, maybe only in
>> debug mode.

>I'm surprised that it doesn't already print the full filename of every 
>file it uses.

>Will debug mode do much if the binary wasn't compiled for debug?  I'm 
>trying to use the provided binary, whatever it might be, and recompiling 
>is usually far too much trouble to be practical.  Especially as the 
>effort is per platform type, and we have multiple types.

Yes, ntp debug is different from gcc debug. 
However, if you are assuming that the distro people can screw things up
then they can screw up any changes that is made to the original source.
They can simply go in and disable the reporting even if it is put in. 

>I will file an enhancement request.  However, my feeling is that this 
>function would be most useful if added to ntpq, and yielded the full 
>filename including directories, as there may be multiple "ntp.conf" 

Almost noone wants that. and you would saddle everyone with useless

>files scattered about.  The key is to get NTP to tell us which file NTP 
>is using, without interference from our firmly held but sadly mistaken 
>assumptions about what NTP ought to be doing.

No, not assumption. It is compiled in. It is the default. Now redhat might
use the -c option in the /etc/init.d/ntp file ( have you looked there to
see if they use that option?)

I seriously doubt that redhat would recompile ntpd and put in a different
default config file. 

>Joe Gwinn

More information about the questions mailing list