Finding out where ntpd gets its ntp.conf file - NTP

This is a discussion on Finding out where ntpd gets its ntp.conf file - NTP ; We had been struggling with NTP running on Red Hat Enterprise Linux (RHEL) on IBM-built Intel boxes, specifically with getting NTP to generate loopstats and peerstats files. Basically, nothing worked, despite many attempts. Yesterday, I cracked it while working on ...

+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 20 of 72

Thread: Finding out where ntpd gets its ntp.conf file

  1. Finding out where ntpd gets its ntp.conf file

    We had been struggling with NTP running on Red Hat Enterprise Linux
    (RHEL) on IBM-built Intel boxes, specifically with getting NTP to
    generate loopstats and peerstats files. Basically, nothing worked,
    despite many attempts.

    Yesterday, I cracked it while working on the problem with one of the
    sysadmins. The ntp.config file was very complex, and I suspected it of
    being mostly flotsam and jetsam from prior uses, and probably in
    conflict with itself, so we cleaned it down to maybe three lines, and
    then stopped and started ntpd using the "service" utility.

    The daemon started, but complained that it was unable to synchronize.
    The sysadmin mentioned that it very often did this, for unknown reasons.
    Then I noticed that the timeserver IP address was not the same as
    specified in the simplified ntp.conf file, and sure enough the address
    that NTP was trying to use was not accessible to ping.

    Hmm. Huh? NTP cannot be using the ntp.conf file we thought it was.
    Tried starting NTP manually with -c option and providing the full path
    to our ntp.conf file. Success!

    Read the "service" shell script. It appears to get its file paths from
    environment variables named after the thing being started and stopped
    and accessible only in the root environment; this bit of RHEL-specific
    structure is being chased down. (Does anyone know where this is
    documented?)

    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
    being able to find or see the actual command line or lines that launched
    the daemon? I did not see a ntpq command that sounded plausible,
    although ntpq would be an obvious choice.

    This would be very useful for debugging, as each and every platform type
    seems to have a different approach to handling NTP.

    Joe Gwinn

  2. Re: Finding out where ntpd gets its ntp.conf file

    Joseph Gwinn wrote:
    > We had been struggling with NTP running on Red Hat Enterprise Linux
    > (RHEL) on IBM-built Intel boxes, specifically with getting NTP to
    > generate loopstats and peerstats files. Basically, nothing worked,
    > despite many attempts.
    >
    > Yesterday, I cracked it while working on the problem with one of the
    > sysadmins. The ntp.config file was very complex, and I suspected it of
    > being mostly flotsam and jetsam from prior uses, and probably in
    > conflict with itself, so we cleaned it down to maybe three lines, and
    > then stopped and started ntpd using the "service" utility.
    >
    > The daemon started, but complained that it was unable to synchronize.
    > The sysadmin mentioned that it very often did this, for unknown reasons.
    > Then I noticed that the timeserver IP address was not the same as
    > specified in the simplified ntp.conf file, and sure enough the address
    > that NTP was trying to use was not accessible to ping.
    >
    > Hmm. Huh? NTP cannot be using the ntp.conf file we thought it was.
    > Tried starting NTP manually with -c option and providing the full path
    > to our ntp.conf file. Success!
    >
    > Read the "service" shell script. It appears to get its file paths from
    > environment variables named after the thing being started and stopped
    > and accessible only in the root environment; this bit of RHEL-specific
    > structure is being chased down. (Does anyone know where this is
    > documented?)
    >
    > 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
    > being able to find or see the actual command line or lines that launched
    > the daemon? I did not see a ntpq command that sounded plausible,
    > although ntpq would be an obvious choice.
    >
    > This would be very useful for debugging, as each and every platform type
    > seems to have a different approach to handling NTP.
    >
    > Joe Gwinn


    I don't recall ever encountering such a facility. Or ever needing one.

    It seems to me that this is the sort of thing that the sysadmin should
    be documenting. And if he has not documented it, perhaps you should
    wonder what's going to happen when he walks in front of a truck, or is
    shot by an irate husband!

  3. Re: Finding out where ntpd gets its ntp.conf file

    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@tantalus ~]$ strings /usr/sbin/ntpd|grep ntp.conf
    /etc/ntp.conf

    [peterc@tantalus ~]$ strace -f -o x /usr/sbin/ntpd -g

    [root@tantalus ~]# grep ntp.conf x
    3351 open("/etc/ntp.conf", O_RDONLY) = 4

  4. Re: Finding out where ntpd gets its ntp.conf file

    In article <48bf5d9c$0$21355$c30e37c6@pit-reader.telstra.net>,
    "Peter J. Cherny" 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@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@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@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.

    Thanks,

    Joe Gwinn

  5. Re: Finding out where ntpd gets its ntp.conf file

    In article ,
    "Richard B. Gilbert" wrote:

    > Joseph Gwinn wrote:
    > > We had been struggling with NTP running on Red Hat Enterprise Linux
    > > (RHEL) on IBM-built Intel boxes, specifically with getting NTP to
    > > generate loopstats and peerstats files. Basically, nothing worked,
    > > despite many attempts.
    > >
    > > Yesterday, I cracked it while working on the problem with one of the
    > > sysadmins. The ntp.config file was very complex, and I suspected it of
    > > being mostly flotsam and jetsam from prior uses, and probably in
    > > conflict with itself, so we cleaned it down to maybe three lines, and
    > > then stopped and started ntpd using the "service" utility.
    > >
    > > The daemon started, but complained that it was unable to synchronize.
    > > The sysadmin mentioned that it very often did this, for unknown reasons.
    > > Then I noticed that the timeserver IP address was not the same as
    > > specified in the simplified ntp.conf file, and sure enough the address
    > > that NTP was trying to use was not accessible to ping.
    > >
    > > Hmm. Huh? NTP cannot be using the ntp.conf file we thought it was.
    > > Tried starting NTP manually with -c option and providing the full path
    > > to our ntp.conf file. Success!
    > >
    > > Read the "service" shell script. It appears to get its file paths from
    > > environment variables named after the thing being started and stopped
    > > and accessible only in the root environment; this bit of RHEL-specific
    > > structure is being chased down. (Does anyone know where this is
    > > documented?)
    > >
    > > 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
    > > being able to find or see the actual command line or lines that launched
    > > the daemon? I did not see a ntpq command that sounded plausible,
    > > although ntpq would be an obvious choice.
    > >
    > > This would be very useful for debugging, as each and every platform type
    > > seems to have a different approach to handling NTP.
    > >
    > > Joe Gwinn

    >
    > I don't recall ever encountering such a facility. Or ever needing one.


    You are very fortunate. I do need one.

    You have confirmed my suspicion that NTP has no such facility.

    Use of strace has been suggested. It is on some but not all platforms
    at present.


    > It seems to me that this is the sort of thing that the sysadmin should
    > be documenting. And if he has not documented it, perhaps you should
    > wonder what's going to happen when he walks in front of a truck, or is
    > shot by an irate husband!


    In this case, none of the sysadmins (who are too busy) had any idea what
    was going on, and they didn't know enough about NTP to realize what was
    going on. The sysadmin had gotten the can't-sync error message many
    times, but didn't quite understand what it was saying. So even if he is
    hit by an irate truck, his replacement won't necessarily be better or
    worse.

    The problem I'm trying to solve is different. We put NTP on lots of
    different kinds of computer, mostly Unix, but some Windows, and I'm
    looking for diagnosis tools that will tell me what's really going on,
    precisely so I can debug unfamiliar setups no matter how screwed up.

    Thanks,

    Joe Gwinn

  6. Re: Finding out where ntpd gets its ntp.conf file

    Joe,

    Joseph Gwinn wrote:
    > In article <48bf5d9c$0$21355$c30e37c6@pit-reader.telstra.net>,
    > "Peter J. Cherny" 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@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@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@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.

    Martin
    --
    Martin Burnicki

    Meinberg Funkuhren
    Bad Pyrmont
    Germany

  7. Re: Finding out where ntpd gets its ntp.conf file

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

    > Joe,
    >
    > Joseph Gwinn wrote:
    > > In article <48bf5d9c$0$21355$c30e37c6@pit-reader.telstra.net>,
    > > "Peter J. Cherny" 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@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@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@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.

    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"
    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.

    Joe Gwinn

  8. Re: Finding out where ntpd gets its ntp.conf file

    Joseph Gwinn wrote:
    > 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"
    > 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.


    And you'll file enhancement requests for every other daemon
    on the machine ???

    In most OSs the man pages are definitive and mostly correct,
    with changes noted in the release notes.
    If you've paid your support fees, ask the vendor.
    In most of the Unix family, the source is available.


    Else, ask a SysAdmin/SysEngineer/SwEngineer who does this for a living.
    You do have other than junior staff ?


  9. Re: Finding out where ntpd gets its ntp.conf file

    Joseph Gwinn wrote:
    > In article ,
    > "Richard B. Gilbert" wrote:
    >
    >> Joseph Gwinn wrote:
    >>> We had been struggling with NTP running on Red Hat Enterprise Linux
    >>> (RHEL) on IBM-built Intel boxes, specifically with getting NTP to
    >>> generate loopstats and peerstats files. Basically, nothing worked,
    >>> despite many attempts.
    >>>
    >>> Yesterday, I cracked it while working on the problem with one of the
    >>> sysadmins. The ntp.config file was very complex, and I suspected it of
    >>> being mostly flotsam and jetsam from prior uses, and probably in
    >>> conflict with itself, so we cleaned it down to maybe three lines, and
    >>> then stopped and started ntpd using the "service" utility.
    >>>
    >>> The daemon started, but complained that it was unable to synchronize.
    >>> The sysadmin mentioned that it very often did this, for unknown reasons.
    >>> Then I noticed that the timeserver IP address was not the same as
    >>> specified in the simplified ntp.conf file, and sure enough the address
    >>> that NTP was trying to use was not accessible to ping.
    >>>
    >>> Hmm. Huh? NTP cannot be using the ntp.conf file we thought it was.
    >>> Tried starting NTP manually with -c option and providing the full path
    >>> to our ntp.conf file. Success!
    >>>
    >>> Read the "service" shell script. It appears to get its file paths from
    >>> environment variables named after the thing being started and stopped
    >>> and accessible only in the root environment; this bit of RHEL-specific
    >>> structure is being chased down. (Does anyone know where this is
    >>> documented?)
    >>>
    >>> 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
    >>> being able to find or see the actual command line or lines that launched
    >>> the daemon? I did not see a ntpq command that sounded plausible,
    >>> although ntpq would be an obvious choice.
    >>>
    >>> This would be very useful for debugging, as each and every platform type
    >>> seems to have a different approach to handling NTP.
    >>>
    >>> Joe Gwinn

    >> I don't recall ever encountering such a facility. Or ever needing one.

    >
    > You are very fortunate. I do need one.
    >
    > You have confirmed my suspicion that NTP has no such facility.
    >
    > Use of strace has been suggested. It is on some but not all platforms
    > at present.
    >
    >
    >> It seems to me that this is the sort of thing that the sysadmin should
    >> be documenting. And if he has not documented it, perhaps you should
    >> wonder what's going to happen when he walks in front of a truck, or is
    >> shot by an irate husband!

    >
    > In this case, none of the sysadmins (who are too busy) had any idea what
    > was going on, and they didn't know enough about NTP to realize what was
    > going on. The sysadmin had gotten the can't-sync error message many
    > times, but didn't quite understand what it was saying. So even if he is
    > hit by an irate truck, his replacement won't necessarily be better or
    > worse.
    >
    > The problem I'm trying to solve is different. We put NTP on lots of
    > different kinds of computer, mostly Unix, but some Windows, and I'm
    > looking for diagnosis tools that will tell me what's really going on,
    > precisely so I can debug unfamiliar setups no matter how screwed up.
    >
    > Thanks,
    >
    > Joe Gwinn


    My memory grows DIMM but ISTR there is a program in at least some Unix
    or Unix-like operating systems that will tell you which program(s) have
    which files open.

    Give me a few weeks or months to think about it and the answer will
    bubble up from the sludge at the bottom of my mind!

  10. Re: Finding out where ntpd gets its ntp.conf file

    On 2008-09-04, Peter J. Cherny wrote:

    > In most OSs the man pages are definitive and mostly correct,


    Any NTP documentation distributed as man pages is produced by third
    parties and should not be viewed as authoritative.

    The NTP Reference Implemenatation Distribution Documentation is
    distributed as HTML and may be found in the ./html directory in
    the Distribution. It is also available on-line. Some OS vendors
    / distributors / aggregators may package this HTML documentation
    separately from the NTP binaries.

    The current documentation for the NTP Development tree is always
    available at http://www.eecis.udel.edu/~mills/ntp/html/. Access through
    our non-caching proxy at http://archive.ntp.org/html/ is available for
    anyone who is unable to use the primary documentation URL.

    Documentation for Production Releases (i.e. stable releases) of The NTP
    Reference Implemenation is housed in the NTP Documentation Archive at
    http://doc.ntp.org/

    --
    Steve Kostecke
    NTP Public Services Project - http://support.ntp.org/

  11. Re: Finding out where ntpd gets its ntp.conf file

    Joseph Gwinn wrote:
    > In article <30s4p5-as9.ln1@gateway.py.meinberg.de>,
    > Martin Burnicki wrote:
    >
    >> Joe,
    >>
    >> Joseph Gwinn wrote:
    >>> In article <48bf5d9c$0$21355$c30e37c6@pit-reader.telstra.net>,
    >>> "Peter J. Cherny" 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@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@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@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.
    >
    > 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"
    > 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.
    >


    ISTR that ntpd looks in /etc/inet if it is not told to look elsewhere by
    the command that starts ntpd. This should take care of Unix and
    Unix-like systems. Windoze?? Ask someone who knows.

  12. Re: Finding out where ntpd gets its ntp.conf file

    On 2008-09-03, Joseph Gwinn wrote:

    > Read the "service" shell script. It appears to get its file paths from
    > environment variables named after the thing being started and stopped
    > and accessible only in the root environment; this bit of RHEL-specific
    > structure is being chased down. (Does anyone know where this is
    > documented?)


    On Linux OSes init scripts are typically found in /etc/init.d/ or
    /etc/rc.d/init.d/ Look for one named ntp (or something containing ntp).

    > 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
    > being able to find or see the actual command line or lines that launched
    > the daemon? I did not see a ntpq command that sounded plausible,
    > although ntpq would be an obvious choice.
    >
    > This would be very useful for debugging, as each and every platform type
    > seems to have a different approach to handling NTP.


    Why not use the file location features built in to your OS to find all
    possible instances of ntp.conf?

    $ locate ntp.conf

    or

    $ find / -name ntp.conf

    Pipe the output of either of those commands to 'xargs ls -l' to see the
    datestamps of the files.

    --
    Steve Kostecke
    NTP Public Services Project - http://support.ntp.org/

  13. Re: Finding out where ntpd gets its ntp.conf file

    Joseph Gwinn wrote:
    > In article <30s4p5-as9.ln1@gateway.py.meinberg.de>,
    > Martin Burnicki wrote:
    >
    >> Joe,
    >>
    >> Joseph Gwinn wrote:
    >>> In article <48bf5d9c$0$21355$c30e37c6@pit-reader.telstra.net>,
    >>> "Peter J. Cherny" 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@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@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@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.
    >
    > 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"
    > 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.
    >
    > Joe Gwinn


    Since the source to NTPD is available, it's a SMOP to modify it to print
    out the desired file specification!

  14. Re: Finding out where ntpd gets its ntp.conf file

    Richard B. Gilbert wrote:
    > My memory grows DIMM but ISTR there is a program in at least some Unix
    > or Unix-like operating systems that will tell you which program(s) have
    > which files open.
    >
    > Give me a few weeks or months to think about it and the answer will
    > bubble up from the sludge at the bottom of my mind!


    ls -l /proc/`pidof ntpd`/fd

    But it does not work in this case, because the ntp.conf file is closed
    after being read. So it does not show in the list of open files of the
    running ntpd.

  15. Re: Finding out where ntpd gets its ntp.conf file

    Joseph Gwinn writes:

    >In article <48bf5d9c$0$21355$c30e37c6@pit-reader.telstra.net>,
    > "Peter J. Cherny" 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@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.


    Which one was ntp in fact using?



    >> [peterc@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@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.


    yes, but then do strace as above and look through the file looking for
    something that might be a configuration file. If they call it /lib/libc.so
    then you are probably **** out of luck, but usually they will not do that.



    >Thanks,


    >Joe Gwinn


  16. Re: Finding out where ntpd gets its ntp.conf file

    Joseph Gwinn writes:

    >In article ,
    > "Richard B. Gilbert" wrote:


    >> Joseph Gwinn wrote:
    >> > We had been struggling with NTP running on Red Hat Enterprise Linux
    >> > (RHEL) on IBM-built Intel boxes, specifically with getting NTP to
    >> > generate loopstats and peerstats files. Basically, nothing worked,
    >> > despite many attempts.
    >> >
    >> > Yesterday, I cracked it while working on the problem with one of the
    >> > sysadmins. The ntp.config file was very complex, and I suspected it of
    >> > being mostly flotsam and jetsam from prior uses, and probably in
    >> > conflict with itself, so we cleaned it down to maybe three lines, and
    >> > then stopped and started ntpd using the "service" utility.
    >> >
    >> > The daemon started, but complained that it was unable to synchronize.
    >> > The sysadmin mentioned that it very often did this, for unknown reasons.
    >> > Then I noticed that the timeserver IP address was not the same as
    >> > specified in the simplified ntp.conf file, and sure enough the address
    >> > that NTP was trying to use was not accessible to ping.
    >> >
    >> > Hmm. Huh? NTP cannot be using the ntp.conf file we thought it was.
    >> > Tried starting NTP manually with -c option and providing the full path
    >> > to our ntp.conf file. Success!
    >> >
    >> > Read the "service" shell script. It appears to get its file paths from
    >> > environment variables named after the thing being started and stopped
    >> > and accessible only in the root environment; this bit of RHEL-specific
    >> > structure is being chased down. (Does anyone know where this is
    >> > documented?)
    >> >
    >> > 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
    >> > being able to find or see the actual command line or lines that launched
    >> > the daemon? I did not see a ntpq command that sounded plausible,
    >> > although ntpq would be an obvious choice.
    >> >
    >> > This would be very useful for debugging, as each and every platform type
    >> > seems to have a different approach to handling NTP.
    >> >
    >> > Joe Gwinn

    >>
    >> I don't recall ever encountering such a facility. Or ever needing one.


    >You are very fortunate. I do need one.


    >You have confirmed my suspicion that NTP has no such facility.


    >Use of strace has been suggested. It is on some but not all platforms
    >at present.



    >> It seems to me that this is the sort of thing that the sysadmin should
    >> be documenting. And if he has not documented it, perhaps you should
    >> wonder what's going to happen when he walks in front of a truck, or is
    >> shot by an irate husband!


    >In this case, none of the sysadmins (who are too busy) had any idea what
    >was going on, and they didn't know enough about NTP to realize what was
    >going on. The sysadmin had gotten the can't-sync error message many
    >times, but didn't quite understand what it was saying. So even if he is
    >hit by an irate truck, his replacement won't necessarily be better or
    >worse.


    >The problem I'm trying to solve is different. We put NTP on lots of
    >different kinds of computer, mostly Unix, but some Windows, and I'm
    >looking for diagnosis tools that will tell me what's really going on,
    >precisely so I can debug unfamiliar setups no matter how screwed up.


    You cannot. They can screw up so badly that it is impossible to
    disentangle. For all you know they rewrote ntp to only use their server.

    The only sure way is to recompile ntpd from the original source yourself for each machine. They you
    know what the defaults are.



  17. Re: Finding out where ntpd gets its ntp.conf file

    Joseph Gwinn writes:

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


    >> Joe,
    >>
    >> Joseph Gwinn wrote:
    >> > In article <48bf5d9c$0$21355$c30e37c6@pit-reader.telstra.net>,
    >> > "Peter J. Cherny" 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@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@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@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
    information.

    >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


  18. Re: Finding out where ntpd gets its ntp.conf file

    "Richard B. Gilbert" writes:

    >Joseph Gwinn wrote:
    >> In article ,
    >> "Richard B. Gilbert" wrote:
    >>
    >>> Joseph Gwinn wrote:
    >>>> We had been struggling with NTP running on Red Hat Enterprise Linux
    >>>> (RHEL) on IBM-built Intel boxes, specifically with getting NTP to
    >>>> generate loopstats and peerstats files. Basically, nothing worked,
    >>>> despite many attempts.
    >>>>
    >>>> Yesterday, I cracked it while working on the problem with one of the
    >>>> sysadmins. The ntp.config file was very complex, and I suspected it of
    >>>> being mostly flotsam and jetsam from prior uses, and probably in
    >>>> conflict with itself, so we cleaned it down to maybe three lines, and
    >>>> then stopped and started ntpd using the "service" utility.
    >>>>
    >>>> The daemon started, but complained that it was unable to synchronize.
    >>>> The sysadmin mentioned that it very often did this, for unknown reasons.
    >>>> Then I noticed that the timeserver IP address was not the same as
    >>>> specified in the simplified ntp.conf file, and sure enough the address
    >>>> that NTP was trying to use was not accessible to ping.
    >>>>
    >>>> Hmm. Huh? NTP cannot be using the ntp.conf file we thought it was.
    >>>> Tried starting NTP manually with -c option and providing the full path
    >>>> to our ntp.conf file. Success!
    >>>>
    >>>> Read the "service" shell script. It appears to get its file paths from
    >>>> environment variables named after the thing being started and stopped
    >>>> and accessible only in the root environment; this bit of RHEL-specific
    >>>> structure is being chased down. (Does anyone know where this is
    >>>> documented?)
    >>>>
    >>>> 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
    >>>> being able to find or see the actual command line or lines that launched
    >>>> the daemon? I did not see a ntpq command that sounded plausible,
    >>>> although ntpq would be an obvious choice.
    >>>>
    >>>> This would be very useful for debugging, as each and every platform type
    >>>> seems to have a different approach to handling NTP.
    >>>>
    >>>> Joe Gwinn
    >>> I don't recall ever encountering such a facility. Or ever needing one.

    >>
    >> You are very fortunate. I do need one.
    >>
    >> You have confirmed my suspicion that NTP has no such facility.
    >>
    >> Use of strace has been suggested. It is on some but not all platforms
    >> at present.
    >>
    >>
    >>> It seems to me that this is the sort of thing that the sysadmin should
    >>> be documenting. And if he has not documented it, perhaps you should
    >>> wonder what's going to happen when he walks in front of a truck, or is
    >>> shot by an irate husband!

    >>
    >> In this case, none of the sysadmins (who are too busy) had any idea what
    >> was going on, and they didn't know enough about NTP to realize what was
    >> going on. The sysadmin had gotten the can't-sync error message many
    >> times, but didn't quite understand what it was saying. So even if he is
    >> hit by an irate truck, his replacement won't necessarily be better or
    >> worse.
    >>
    >> The problem I'm trying to solve is different. We put NTP on lots of
    >> different kinds of computer, mostly Unix, but some Windows, and I'm
    >> looking for diagnosis tools that will tell me what's really going on,
    >> precisely so I can debug unfamiliar setups no matter how screwed up.
    >>
    >> Thanks,
    >>
    >> Joe Gwinn


    >My memory grows DIMM but ISTR there is a program in at least some Unix
    >or Unix-like operating systems that will tell you which program(s) have
    >which files open.


    The config file is not kept open. It is read and then closed. The info does
    not change.


    >Give me a few weeks or months to think about it and the answer will
    >bubble up from the sludge at the bottom of my mind!


  19. Re: Finding out where ntpd gets its ntp.conf file

    One of the things I'd like to see is a command (or perhaps a signal) that
    would tell ntpd to dump its config state to a file, in a format suitable for
    use as an ntp.conf file.

    I'd also be perfectly happy to get patches to have ntpd report more of its
    internal state variables via ntpq.

    Also see http://support.ntp.org/Dev/GettingNtpdItsConfiguration and
    http://bugs.ntp.org/923 .
    --
    Harlan Stenn
    http://ntpforum.isc.org - be a member!

  20. Re: Finding out where ntpd gets its ntp.conf file

    Steve Kostecke wrote:

    > The NTP Reference Implemenatation Distribution Documentation is
    > distributed as HTML and may be found in the ./html directory in
    > the Distribution. It is also available on-line. Some OS vendors
    > / distributors / aggregators may package this HTML documentation
    > separately from the NTP binaries.


    Unlike the man pages in the better source trees, even the included HTML
    files are not fixed up based on build time configuration parameters, so
    are no use in answering this question. Those in the source distribution
    or available online are certainly of no use in finding the customised
    configuration file name.

+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast