ntp startup behaviour under Windows - NTP

This is a discussion on ntp startup behaviour under Windows - NTP ; I've been looking into the startup behaviour of ntp under Windows. I'm running ntp 4.2.0b from the Meinberg distribution as a service under Windows XP SP2. I've noticed that if the log file is enabled in ntp.conf, then ntp errors ...

+ Reply to Thread
Results 1 to 13 of 13

Thread: ntp startup behaviour under Windows

  1. ntp startup behaviour under Windows

    I've been looking into the startup behaviour of ntp under Windows. I'm
    running ntp 4.2.0b from the Meinberg distribution as a service under Windows
    XP SP2.

    I've noticed that if the log file is enabled in ntp.conf, then ntp errors do
    not show up as events in the Windows Event Viewer. Is this the expected
    behaviour? I would have expected to see the errors both in the log file
    (where they are visible) and also in the Event Viewer.

    John Allen\
    Bofferdange, Luxembourg



  2. Re: ntp startup behaviour under Windows

    John Allen wrote:
    > I've been looking into the startup behaviour of ntp under Windows. I'm
    > running ntp 4.2.0b from the Meinberg distribution as a service under Windows
    > XP SP2.
    >
    > I've noticed that if the log file is enabled in ntp.conf, then ntp errors do
    > not show up as events in the Windows Event Viewer. Is this the expected
    > behaviour? I would have expected to see the errors both in the log file
    > (where they are visible) and also in the Event Viewer.
    >


    Yes. The current design of the logging can only send the messages to one
    place. This is no different to doing this on Unix. To do anything else
    would require that we implement something like the BIND 9 logging and
    then you would be specifying mulitple logging streams in the
    configuration file.

    Is there a need for this? I don't see this as a high-priority requirement.

    Danny

    > John Allen\
    > Bofferdange, Luxembourg
    >

    _______________________________________________
    questions mailing list
    questions@lists.ntp.isc.org
    https://lists.ntp.isc.org/mailman/listinfo/questions


  3. Re: ntp startup behaviour under Windows

    Danny Mayer wrote:
    > John Allen wrote:
    >> I've been looking into the startup behaviour of ntp under Windows.
    >> I'm running ntp 4.2.0b from the Meinberg distribution as a service
    >> under Windows XP SP2.
    >>
    >> I've noticed that if the log file is enabled in ntp.conf, then ntp
    >> errors do not show up as events in the Windows Event Viewer. Is this
    >> the expected behaviour? I would have expected to see the errors both
    >> in the log file (where they are visible) and also in the Event
    >> Viewer.
    >>

    >
    > Yes. The current design of the logging can only send the messages to
    > one place. This is no different to doing this on Unix. To do anything
    > else would require that we implement something like the BIND 9
    > logging and then you would be specifying mulitple logging streams in
    > the configuration file.
    >
    > Is there a need for this? I don't see this as a high-priority
    > requirement.
    >
    > Danny


    Is it that complex? Can't the event logger module simply chain a call to
    the file logger module?

    To me it would fall into the "nice" but not "essential" category. I'd put
    a higher priority on fixing the hangs in the Windows version of ntpq -p.

    David



  4. Re: ntp startup behaviour under Windows

    "Danny Mayer" wrote in message
    news:44E7D535.6090601@ntp.isc.org...
    > John Allen wrote:
    >> I've been looking into the startup behaviour of ntp under Windows. I'm
    >> running ntp 4.2.0b from the Meinberg distribution as a service under
    >> Windows
    >> XP SP2.
    >>
    >> I've noticed that if the log file is enabled in ntp.conf, then ntp errors
    >> do
    >> not show up as events in the Windows Event Viewer. Is this the expected
    >> behaviour? I would have expected to see the errors both in the log file
    >> (where they are visible) and also in the Event Viewer.
    >>

    >
    > Yes. The current design of the logging can only send the messages to one
    > place. This is no different to doing this on Unix. To do anything else
    > would require that we implement something like the BIND 9 logging and
    > then you would be specifying mulitple logging streams in the
    > configuration file.
    >
    > Is there a need for this? I don't see this as a high-priority requirement.


    Danny,
    Thanks for the clarification. I can see the logic of the Unix way here.
    As I'm looking into the general question of how ntp behaves at Windows
    startup, I now have another question.
    Save scenario as above, and I'm reporting errors via the Event Viewer.
    I am experimenting with a PC which starts up very quickly, so that ntp can't
    resolve its server addresses, giving rise to messages like "couldn't resolve
    `2.us.pool.ntp.org', giving up on it'. In the Event Viewer, these are
    flagged as Errors, and indeed ntp isn't doing anything very useful, as it
    was unable to resolve any of the server addresses when it started. So far so
    good, and I understand what is going on.

    However, from the point of view of Windows, the "NTP service" is still
    running, ie this doesn't count as a "service failure". So my question is:
    why is a non-functional ntp process continue to run?

    If it exited, then the Windows service manager would be aware that something
    was wrong, and it could automatically restart the service.

    I hope this question makes sense.

    John

    --
    John Allen
    Bofferdange, Luxembourg



  5. Re: ntp startup behaviour under Windows

    John Allen wrote:

    > "Danny Mayer" wrote in message
    > news:44E7D535.6090601@ntp.isc.org...
    >
    >>John Allen wrote:
    >>
    >>>I've been looking into the startup behaviour of ntp under Windows. I'm
    >>>running ntp 4.2.0b from the Meinberg distribution as a service under
    >>>Windows
    >>>XP SP2.
    >>>
    >>>I've noticed that if the log file is enabled in ntp.conf, then ntp errors
    >>>do
    >>>not show up as events in the Windows Event Viewer. Is this the expected
    >>>behaviour? I would have expected to see the errors both in the log file
    >>>(where they are visible) and also in the Event Viewer.
    >>>

    >>
    >>Yes. The current design of the logging can only send the messages to one
    >>place. This is no different to doing this on Unix. To do anything else
    >>would require that we implement something like the BIND 9 logging and
    >>then you would be specifying mulitple logging streams in the
    >>configuration file.
    >>
    >>Is there a need for this? I don't see this as a high-priority requirement.

    >
    >
    > Danny,
    > Thanks for the clarification. I can see the logic of the Unix way here.
    > As I'm looking into the general question of how ntp behaves at Windows
    > startup, I now have another question.
    > Save scenario as above, and I'm reporting errors via the Event Viewer.
    > I am experimenting with a PC which starts up very quickly, so that ntp can't
    > resolve its server addresses, giving rise to messages like "couldn't resolve
    > `2.us.pool.ntp.org', giving up on it'. In the Event Viewer, these are
    > flagged as Errors, and indeed ntp isn't doing anything very useful, as it
    > was unable to resolve any of the server addresses when it started. So far so
    > good, and I understand what is going on.
    >
    > However, from the point of view of Windows, the "NTP service" is still
    > running, ie this doesn't count as a "service failure". So my question is:
    > why is a non-functional ntp process continue to run?
    >
    > If it exited, then the Windows service manager would be aware that something
    > was wrong, and it could automatically restart the service.
    >
    > I hope this question makes sense.
    >
    > John
    >
    > --
    > John Allen
    > Bofferdange, Luxembourg
    >
    >


    I'm not certain that I understand why your server addresses are not
    being resolved. Is ntpd started before the TCP/IP stack is available?

  6. Re: ntp startup behaviour under Windows

    In article ,
    John Allen wrote:

    > However, from the point of view of Windows, the "NTP service" is still
    > running, ie this doesn't count as a "service failure". So my question is:
    > why is a non-functional ntp process continue to run?


    It's not unconditionally non-functional. It may be possible to configure
    in servers remotely, and is is certainly possible to use diagnostics.
    What I suspect you really need is to configure appropriate service
    startup dependencies.

    > If it exited, then the Windows service manager would be aware that something
    > was wrong, and it could automatically restart the service.


    You don't want to enable automatic restarting, as, at least on Unix, ntpd
    exits when it considers it unsafe to proceed because it's server has made
    a wild time step. The intention is that the service should stop completely,
    not continually retry. In particular, never do this if you are using -g.

  7. Re: ntp startup behaviour under Windows

    David Woolley schrieb:
    > In article ,
    > John Allen wrote:
    >
    >> However, from the point of view of Windows, the "NTP service" is still
    >> running, ie this doesn't count as a "service failure". So my question is:
    >> why is a non-functional ntp process continue to run?

    >
    > It's not unconditionally non-functional. It may be possible to configure
    > in servers remotely, and is is certainly possible to use diagnostics.
    > What I suspect you really need is to configure appropriate service
    > startup dependencies.


    The current Meinberg installer is setting up "TCPIP" as a service
    dependency for NTP.

    Unfortunately some "hotplug" network interfaces like WLAN or USB stuff
    seem to bring up their interfaces after the TCPIP stack has been started.

    >> If it exited, then the Windows service manager would be aware that something
    >> was wrong, and it could automatically restart the service.

    >
    > You don't want to enable automatic restarting, as, at least on Unix, ntpd
    > exits when it considers it unsafe to proceed because it's server has made
    > a wild time step. The intention is that the service should stop completely,
    > not continually retry. In particular, never do this if you are using -g.


    A "second try" would be OK I guess, but I agree that there should be a
    limit on the restarts in a certain time period.

    Best regards,
    Heiko


    --
    Meinberg radio clocks: 25 years of accurate time worldwide

    MEINBERG Radio Clocks
    www.meinberg.de

    Stand alone ntp time servers and radio clocks based on GPS, DCF77 and
    IRIG. Rackmount and desktop versions and PCI slot cards.

  8. Re: ntp startup behaviour under Windows

    John Allen wrote:
    > "Danny Mayer" wrote in message
    > news:44E7D535.6090601@ntp.isc.org...
    >> John Allen wrote:
    >>> I've been looking into the startup behaviour of ntp under Windows. I'm
    >>> running ntp 4.2.0b from the Meinberg distribution as a service under
    >>> Windows
    >>> XP SP2.

    > Save scenario as above, and I'm reporting errors via the Event Viewer.
    > I am experimenting with a PC which starts up very quickly, so that ntp can't
    > resolve its server addresses, giving rise to messages like "couldn't resolve
    > `2.us.pool.ntp.org', giving up on it'. In the Event Viewer, these are
    > flagged as Errors, and indeed ntp isn't doing anything very useful, as it
    > was unable to resolve any of the server addresses when it started. So far so
    > good, and I understand what is going on.
    >


    I recently put in a fix for this to change this behavior so that you can
    get it to wait until it gets a proper response from DNS. I don't think
    it's in Meinberg's build yet because of a different issue.

    > However, from the point of view of Windows, the "NTP service" is still
    > running, ie this doesn't count as a "service failure". So my question is:
    > why is a non-functional ntp process continue to run?
    >


    You can always add servers through the ntpdc commands and even if you
    can't get to the servers it may be providing service to clients using
    it. You can define a local clock to do this and still provide time.

    > If it exited, then the Windows service manager would be aware that something
    > was wrong, and it could automatically restart the service.
    >


    See above. It's not necessary to restart any more.

    > I hope this question makes sense.
    >
    > John


    Danny
    _______________________________________________
    questions mailing list
    questions@lists.ntp.isc.org
    https://lists.ntp.isc.org/mailman/listinfo/questions


  9. Re: ntp startup behaviour under Windows

    Richard B. Gilbert wrote:
    >
    > I'm not certain that I understand why your server addresses are not
    > being resolved. Is ntpd started before the TCP/IP stack is available?
    >


    The DNS may not be accessible at the time that ntpd starts. There can be
    all sorts of reasons for that. I recently fixed this issue so that it
    will retry the lookup and either gets a valid response of it will get a
    NXDOMAIN.

    Danny
    _______________________________________________
    questions mailing list
    questions@lists.ntp.isc.org
    https://lists.ntp.isc.org/mailman/listinfo/questions


  10. Re: ntp startup behaviour under Windows

    Thanks to all who have provided clarification on the questions I raised. I
    understand now why (a) logging is to the Event Viewer or the log file, but
    not both and (b) why failing to connect to the servers doesn't count as a
    "service failure". So far so good.

    I was aware of the possibilities of using service dependencies to delay the
    startup of ntp under Windows. There is a KB article about this:
    http://support.microsoft.com/?kbid=193888
    However, on the PC I am currently experimenting with (which is not one of
    mine), setting up the Internet connection (via a cable modem and DHCP) is
    very slow, and even setting Spooler and Messenger as dependencies did not
    always allow ntp enough time to start properly.

    I prefer to use the Meinberg distribution, so I hope Heiko can get Danny's
    latest fixes into his build soon. In the interim, I'm trying a little
    kludge, which is to set the ntp service to start manually, and then use a
    small script to start it after an arbitrary delay:
    ======
    strComputer = "."
    Wscript.Sleep 60000
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colServices = objWMIService.ExecQuery _
    ("SELECT * FROM win32_Service WHERE Name = 'NTP'")
    For Each objService in colServices
    errReturnCode = objService.StartService()
    Next
    ======
    This script is saved as a file called something like "startntp.vbs" and
    included in the Windows "Start" group. This is not elegant, but it does seem
    to work.

    John



  11. Re: ntp startup behaviour under Windows

    John Allen wrote:
    > Thanks to all who have provided clarification on the questions I raised. I
    > understand now why (a) logging is to the Event Viewer or the log file, but
    > not both and (b) why failing to connect to the servers doesn't count as a
    > "service failure". So far so good.
    >
    > I was aware of the possibilities of using service dependencies to delay the
    > startup of ntp under Windows. There is a KB article about this:
    > http://support.microsoft.com/?kbid=193888
    > However, on the PC I am currently experimenting with (which is not one of
    > mine), setting up the Internet connection (via a cable modem and DHCP) is
    > very slow, and even setting Spooler and Messenger as dependencies did not
    > always allow ntp enough time to start properly.
    >
    > I prefer to use the Meinberg distribution, so I hope Heiko can get Danny's
    > latest fixes into his build soon. In the interim, I'm trying a little
    > kludge, which is to set the ntp service to start manually, and then use a
    > small script to start it after an arbitrary delay:
    > ======
    > strComputer = "."
    > Wscript.Sleep 60000
    > Set objWMIService = GetObject("winmgmts:" _
    > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    > Set colServices = objWMIService.ExecQuery _
    > ("SELECT * FROM win32_Service WHERE Name = 'NTP'")
    > For Each objService in colServices
    > errReturnCode = objService.StartService()
    > Next
    > ======
    > This script is saved as a file called something like "startntp.vbs" and
    > included in the Windows "Start" group. This is not elegant, but it does seem
    > to work.
    >
    > John
    >
    >


    I don't see why setting up an internet connection should be slow! Do
    you use a router? I have a little Linksys BEFSR81 router. You don't
    get much for $85 but it does act as a DHCP server. My NTP server is
    internal, running on Sun Solaris (SPARC) and I use W32TIME on the PC's.

  12. Re: ntp startup behaviour under Windows

    "Richard B. Gilbert" wrote in message
    > I don't see why setting up an internet connection should be slow! Do you
    > use a router? I have a little Linksys BEFSR81 router. You don't get much
    > for $85 but it does act as a DHCP server. My NTP server is internal,
    > running on Sun Solaris (SPARC) and I use W32TIME on the PC's.


    This issue has been discussed before in this group, see a thread from 2004
    entitled "NTP starting too early in Windows?".

    As I said, this is not my PC - it belongs to my mother-in-law - and I can't
    change the way it connects to the Internet, which is via some kind of cable
    modem supplied by Eastlink, her ISP. My interest was to be clearer about the
    startup behaviour of ntp as a service under Windows, and this thread has
    been helpful in that respect. It's not a long-term issue for me, just
    something I'm playing with during my summer holiday in Nova Scotia.

    John

    --
    John Allen
    Bofferdange, Luxembourg



  13. Re: ntp startup behaviour under Windows

    John Allen wrote:
    > "Richard B. Gilbert" wrote in message
    >> I don't see why setting up an internet connection should be slow! Do you
    >> use a router? I have a little Linksys BEFSR81 router. You don't get much
    >> for $85 but it does act as a DHCP server. My NTP server is internal,
    >> running on Sun Solaris (SPARC) and I use W32TIME on the PC's.

    >
    > This issue has been discussed before in this group, see a thread from 2004
    > entitled "NTP starting too early in Windows?".
    >


    See also bug #504. The problem is fixed in the 4.2.2 release.

    Danny
    _______________________________________________
    questions mailing list
    questions@lists.ntp.isc.org
    https://lists.ntp.isc.org/mailman/listinfo/questions


+ Reply to Thread