ntpd oddness - NTP

This is a discussion on ntpd oddness - NTP ; I'm having a small issue with ntp-4.2.0.a.20040617-6.el4 running under Red Hat Enterprise Linux 4 update 5. In the Kickstart script to configure the server, I specify: timezone --utc GMT/London After the installation is done: [joliver@0123456789-VCS ~]$ date Tue Apr 1 ...

+ Reply to Thread
Results 1 to 18 of 18

Thread: ntpd oddness

  1. ntpd oddness

    I'm having a small issue with ntp-4.2.0.a.20040617-6.el4 running under
    Red Hat Enterprise Linux 4 update 5.

    In the Kickstart script to configure the server, I specify:

    timezone --utc GMT/London

    After the installation is done:

    [joliver@0123456789-VCS ~]$ date
    Tue Apr 1 17:03:23 EDT 2008

    /etc/localtime is a real file:

    [joliver@0123456789-VCS ~]$ ls -l /etc/localtime
    -rw-r--r-- 1 root root 1267 Jan 31 2007 /etc/localtime

    If I remove that file and replace it with a symlink:

    [joliver@0123456789-VCS ~]$ ls -l /etc/localtime
    lrwxrwxrwx 1 root root 23 Apr 1 21:04 /etc/localtime ->
    /usr/share/zoneinfo/GMT

    The system clock displays correctly:

    [joliver@0123456789-VCS ~]$ date
    Tue Apr 1 21:05:09 GMT 2008

    But, now, the hwclock is always 12 hours off:

    [joliver@0123456789-VCS ~]$ /sbin/hwclock
    Tue 01 Apr 2008 09:05:39 PM GMT -0.323329 seconds
    [joliver@0123456789-VCS ~]$ sudo /sbin/hwclock --systohc
    [joliver@0123456789-VCS ~]$ /sbin/hwclock
    Tue 01 Apr 2008 09:05:52 PM GMT -0.776568 seconds


    1) Why is /etc/localtime a file by default instead of a symlink? Is
    this just some silly Red Hat-ism that has to be avoided?

    2) Why is my hardware clock 12 hours off from the system clock?

    --
    * John Oliver http://www.john-oliver.net/ *

    --
    Posted via a free Usenet account from http://www.teranews.com


  2. Re: ntpd oddness

    John Oliver wrote:
    > I'm having a small issue with ntp-4.2.0.a.20040617-6.el4 running under
    > Red Hat Enterprise Linux 4 update 5.


    Your problem has nothing to do with ntpd; ntpd works solely in UTC time.
    The Olsen timezone package handling is all done in libc.


  3. Re: ntpd oddness

    John Oliver writes:

    >I'm having a small issue with ntp-4.2.0.a.20040617-6.el4 running under
    >Red Hat Enterprise Linux 4 update 5.


    >In the Kickstart script to configure the server, I specify:


    >timezone --utc GMT/London


    No idea what the timezone script does.
    cp /usr/share/zoneinfo/GMT/London /etc/localtime
    chmod a+r /etc/localtime



    >After the installation is done:


    >[joliver@0123456789-VCS ~]$ date
    >Tue Apr 1 17:03:23 EDT 2008


    >/etc/localtime is a real file:


    The wrong one apparently.


    >[joliver@0123456789-VCS ~]$ ls -l /etc/localtime
    >-rw-r--r-- 1 root root 1267 Jan 31 2007 /etc/localtime


    >If I remove that file and replace it with a symlink:


    >[joliver@0123456789-VCS ~]$ ls -l /etc/localtime
    >lrwxrwxrwx 1 root root 23 Apr 1 21:04 /etc/localtime ->
    >/usr/share/zoneinfo/GMT


    >The system clock displays correctly:


    >[joliver@0123456789-VCS ~]$ date
    >Tue Apr 1 21:05:09 GMT 2008


    >But, now, the hwclock is always 12 hours off:


    I guess you forgot to put the hardware clock on utc.



    >[joliver@0123456789-VCS ~]$ /sbin/hwclock
    >Tue 01 Apr 2008 09:05:39 PM GMT -0.323329 seconds
    >[joliver@0123456789-VCS ~]$ sudo /sbin/hwclock --systohc
    >[joliver@0123456789-VCS ~]$ /sbin/hwclock
    >Tue 01 Apr 2008 09:05:52 PM GMT -0.776568 seconds



    >1) Why is /etc/localtime a file by default instead of a symlink? Is


    Because /usr may not be mounted when something needs the time on intial
    bootup.


    >this just some silly Red Hat-ism that has to be avoided?


    No it is a good idea. A link could point to nowhere.



    >2) Why is my hardware clock 12 hours off from the system clock?


    How do we know. Make sure it is set to utc and reset it.
    (look in /etc/sysconfig/clock)


    >--
    >* John Oliver http://www.john-oliver.net/ *


    >--
    >Posted via a free Usenet account from http://www.teranews.com



  4. Re: ntpd oddness

    John,

    John Oliver wrote:
    > I'm having a small issue with ntp-4.2.0.a.20040617-6.el4 running under
    > Red Hat Enterprise Linux 4 update 5.
    >
    > In the Kickstart script to configure the server, I specify:
    >
    > timezone --utc GMT/London
    >
    > After the installation is done:
    >
    > [joliver@0123456789-VCS ~]$ date
    > Tue Apr 1 17:03:23 EDT 2008


    What's the output of:

    date -u; date

    This shows both your system's UTC time and local time according to your time
    zone configuration. Which of them is correct?

    > [joliver@0123456789-VCS ~]$ /sbin/hwclock
    > Tue 01 Apr 2008 09:05:39 PM GMT -0.323329 seconds
    > [joliver@0123456789-VCS ~]$ sudo /sbin/hwclock --systohc
    > [joliver@0123456789-VCS ~]$ /sbin/hwclock
    > Tue 01 Apr 2008 09:05:52 PM GMT -0.776568 seconds


    Normally the system time is only initialized from the hwclock (the RTC chip
    on the mainboard) at boot time, and when the system shuts down properely
    the current system time should be written back to the hwclock. In most
    cases you see this in the console messages.

    If you have a dual/multi boot system then you must take care that all
    operating systems assume the RTC to run at the same time, i.e. either local
    time or UTC.

    E.g. if you set the system time under Windows 2000 then the RTC will be set
    to the current Windows local time. If you boot Linux afterwards you must
    take care that Linux knows the correct local time offset of the RTC which
    matches the Windows time zone offset. This may lead to a 1 hour offset if
    you shut down the system during standard time and reboot it the next
    morning after DST has started.

    If the system is Linux only I'd suggest you configure your Linux system such
    that the RTC chip keeps UTC time only. If then the time is not correct
    after a reboot your on-board battery may be low.

    Martin
    --
    Martin Burnicki

    Meinberg Funkuhren
    Bad Pyrmont
    Germany

  5. Re: ntpd oddness

    Hi John,

    To alter the localtime zone in Linux, use tzconfig.
    Till RedHat-7.3 the timezone was modified using 'setup' or
    'timeconfig' utility. But since RedHat-8.0 and subsequent versions
    'tzconfig' is used. I remember I've done this once.

    Venu

    John Oliver wrote:
    > I'm having a small issue with ntp-4.2.0.a.20040617-6.el4 running under
    > Red Hat Enterprise Linux 4 update 5.
    >
    > In the Kickstart script to configure the server, I specify:
    >
    > timezone --utc GMT/London
    >
    > After the installation is done:
    >
    > [joliver@0123456789-VCS ~]$ date
    > Tue Apr 1 17:03:23 EDT 2008
    >
    > /etc/localtime is a real file:
    >
    > [joliver@0123456789-VCS ~]$ ls -l /etc/localtime
    > -rw-r--r-- 1 root root 1267 Jan 31 2007 /etc/localtime
    >
    > If I remove that file and replace it with a symlink:
    >
    > [joliver@0123456789-VCS ~]$ ls -l /etc/localtime
    > lrwxrwxrwx 1 root root 23 Apr 1 21:04 /etc/localtime ->
    > /usr/share/zoneinfo/GMT
    >
    > The system clock displays correctly:
    >
    > [joliver@0123456789-VCS ~]$ date
    > Tue Apr 1 21:05:09 GMT 2008
    >
    > But, now, the hwclock is always 12 hours off:
    >
    > [joliver@0123456789-VCS ~]$ /sbin/hwclock
    > Tue 01 Apr 2008 09:05:39 PM GMT -0.323329 seconds
    > [joliver@0123456789-VCS ~]$ sudo /sbin/hwclock --systohc
    > [joliver@0123456789-VCS ~]$ /sbin/hwclock
    > Tue 01 Apr 2008 09:05:52 PM GMT -0.776568 seconds
    >
    >
    > 1) Why is /etc/localtime a file by default instead of a symlink? Is
    > this just some silly Red Hat-ism that has to be avoided?
    >
    > 2) Why is my hardware clock 12 hours off from the system clock?
    >


  6. Re: ntpd oddness

    Venu Gopal wrote:

    > To alter the localtime zone in Linux, use tzconfig.


    There is no such program in Slackware 11.0 Linux!

  7. Re: ntpd oddness

    David Woolley writes:

    >Venu Gopal wrote:


    >> To alter the localtime zone in Linux, use tzconfig.


    >There is no such program in Slackware 11.0 Linux!


    Then do
    rm /etc/localtime
    cp /usr/share/zoneinfo/America/Vancouver /etc/localtime
    chmod a+r /etc/localtime
    as root.


  8. Re: ntpd oddness

    On Wed, 02 Apr 2008 19:21:13 +0530, Venu Gopal wrote:
    > Hi John,
    >
    > To alter the localtime zone in Linux, use tzconfig.


    There is no "tzconfig" in Red Hat 4.

    --
    * John Oliver http://www.john-oliver.net/ *

    --
    Posted via a free Usenet account from http://www.teranews.com


  9. Re: ntpd oddness

    On Wed, 02 Apr 2008 18:20:26 GMT, Unruh wrote:
    > David Woolley writes:
    >
    >>Venu Gopal wrote:

    >
    >>> To alter the localtime zone in Linux, use tzconfig.

    >
    >>There is no such program in Slackware 11.0 Linux!

    >
    > Then do
    > rm /etc/localtime
    > cp /usr/share/zoneinfo/America/Vancouver /etc/localtime
    > chmod a+r /etc/localtime
    > as root.


    Maybe a rhetorical question, but why should this be necessary after
    you've specified the timezone during install?

    --
    * John Oliver http://www.john-oliver.net/ *

    --
    Posted via a free Usenet account from http://www.teranews.com


  10. Re: ntpd oddness

    On Wed, 02 Apr 2008 09:58:38 +0200, Martin Burnicki wrote:
    > What's the output of:
    >
    > date -u; date


    [root@0123456789-VCS ~]# date -u; date
    Wed Apr 2 20:29:25 UTC 2008
    Wed Apr 2 20:29:25 GMT 2008

    >> [joliver@0123456789-VCS ~]$ /sbin/hwclock
    >> Tue 01 Apr 2008 09:05:39 PM GMT -0.323329 seconds
    >> [joliver@0123456789-VCS ~]$ sudo /sbin/hwclock --systohc
    >> [joliver@0123456789-VCS ~]$ /sbin/hwclock
    >> Tue 01 Apr 2008 09:05:52 PM GMT -0.776568 seconds

    >
    > Normally the system time is only initialized from the hwclock (the RTC chip
    > on the mainboard) at boot time, and when the system shuts down properely
    > the current system time should be written back to the hwclock. In most
    > cases you see this in the console messages.
    >
    > If you have a dual/multi boot system then you must take care that all
    > operating systems assume the RTC to run at the same time, i.e. either local
    > time or UTC.


    There is only one OS on the host(s) in question.

    > If the system is Linux only I'd suggest you configure your Linux system such
    > that the RTC chip keeps UTC time only. If then the time is not correct
    > after a reboot your on-board battery may be low.


    There are no reboots. The above example is one command after another...
    read the hwclock, set it from the system time, and then immediately read
    it again. I don't see how this could be a hardware issue, unless this
    chip is specifically programmed to always add/subtract 12 hours from the
    time it's set to, which I rather doubt :-)

    --
    * John Oliver http://www.john-oliver.net/ *

    --
    Posted via a free Usenet account from http://www.teranews.com


  11. Re: ntpd oddness

    John Oliver writes:

    >On Wed, 02 Apr 2008 18:20:26 GMT, Unruh wrote:
    >> David Woolley writes:
    >>
    >>>Venu Gopal wrote:

    >>
    >>>> To alter the localtime zone in Linux, use tzconfig.

    >>
    >>>There is no such program in Slackware 11.0 Linux!

    >>
    >> Then do
    >> rm /etc/localtime
    >> cp /usr/share/zoneinfo/America/Vancouver /etc/localtime
    >> chmod a+r /etc/localtime
    >> as root.


    >Maybe a rhetorical question, but why should this be necessary after
    >you've specified the timezone during install?


    If your timezone works, do not do it. If it does not work, which was the
    case of the OP, then do this.

    Eg, you have moved from New York to Shaghai for 3 months. You screwed up on
    the install and accepted the default ( New York) time zone when you live in
    Greece. .....


  12. Re: ntpd oddness

    John Oliver writes:

    >On Wed, 02 Apr 2008 09:58:38 +0200, Martin Burnicki wrote:
    >> What's the output of:
    >>
    >> date -u; date


    >[root@0123456789-VCS ~]# date -u; date
    >Wed Apr 2 20:29:25 UTC 2008
    >Wed Apr 2 20:29:25 GMT 2008


    >>> [joliver@0123456789-VCS ~]$ /sbin/hwclock
    >>> Tue 01 Apr 2008 09:05:39 PM GMT -0.323329 seconds
    >>> [joliver@0123456789-VCS ~]$ sudo /sbin/hwclock --systohc
    >>> [joliver@0123456789-VCS ~]$ /sbin/hwclock
    >>> Tue 01 Apr 2008 09:05:52 PM GMT -0.776568 seconds

    >>
    >> Normally the system time is only initialized from the hwclock (the RTC chip
    >> on the mainboard) at boot time, and when the system shuts down properely
    >> the current system time should be written back to the hwclock. In most
    >> cases you see this in the console messages.
    >>
    >> If you have a dual/multi boot system then you must take care that all
    >> operating systems assume the RTC to run at the same time, i.e. either local
    >> time or UTC.


    >There is only one OS on the host(s) in question.


    Good-- information not available to us.


    >> If the system is Linux only I'd suggest you configure your Linux system such
    >> that the RTC chip keeps UTC time only. If then the time is not correct
    >> after a reboot your on-board battery may be low.


    >There are no reboots. The above example is one command after another...
    >read the hwclock, set it from the system time, and then immediately read
    >it again. I don't see how this could be a hardware issue, unless this
    >chip is specifically programmed to always add/subtract 12 hours from the
    >time it's set to, which I rather doubt :-)


    cat /etc/sysconfig/clock

    and post the output here.
    Anyway, none of this has anything to do with ntp at all. It would be best
    to go to a Linux group for your particular distribution.




    >--
    >* John Oliver http://www.john-oliver.net/ *


    >--
    >Posted via a free Usenet account from http://www.teranews.com



  13. Re: ntpd oddness

    On Wed, 02 Apr 2008 17:32:58 +0100, David Woolley wrote:

    > Venu Gopal wrote:
    >
    >> To alter the localtime zone in Linux, use tzconfig.

    >
    > There is no such program in Slackware 11.0 Linux!


    There is probably a copy of tzselect in glibc.

    /var/adm/packages/glibc-2.2.5-i386-4:usr/bin/tzselect

    Assuming you have a complete install of the timezone data that will
    suggest to you what /etc/localtime should symlink to or be copied from

    --
    2008/04/02:21:49:32UTC Slackware Linux 2.4.32
    up 6 days, 1:44, 6 users, load average: 2.01, 2.07, 2.09


  14. Re: ntpd oddness

    Lord High Executioner wrote:

    >
    > /var/adm/packages/glibc-2.2.5-i386-4:usr/bin/tzselect
    >

    Yes. But the point being made is that the supporting utilities vary
    from distribution to distribution and version to version, so one cannot
    make an unconditional statement that tzconfig will work on Linux.

  15. Re: ntpd oddness

    Hi all,

    My reply was specific to RedHat Linux.
    Its there in RedHat releases since 8.0, so I presumed that
    it would be there in RedHat Enterprise-4.0.

    It is used to change the system timezone (if you want to do so).
    If some one can post a method thats common to Linux distributions,
    it would be grateful !

    Venu


    John Oliver wrote:
    > On Wed, 02 Apr 2008 19:21:13 +0530, Venu Gopal wrote:
    >> Hi John,
    >>
    >> To alter the localtime zone in Linux, use tzconfig.

    >
    > There is no "tzconfig" in Red Hat 4.
    >


  16. Re: ntpd oddness

    Hi all,

    'tzselect' is available in Debian, Slackware and in RedHat.
    We can use this to set the timezone.

    Venu

  17. Re: ntpd oddness

    Venu Gopal writes:

    >Hi all,


    >My reply was specific to RedHat Linux.
    >Its there in RedHat releases since 8.0, so I presumed that
    >it would be there in RedHat Enterprise-4.0.


    >It is used to change the system timezone (if you want to do so).
    >If some one can post a method thats common to Linux distributions,
    >it would be grateful !


    I have. Twice.
    su

    rm /etc/localtime
    cp /usr/share/zoneinfo/America/Vancouver /etc/localtime
    chmod a+r /etc/localtime
    exit

    (change the timezone if you are unfortunate enough not to live in
    Vancouver)




  18. Re: ntpd oddness

    Hello John,

    On Tuesday, April 1, 2008 at 20:18:19 +0000, John Oliver wrote:

    > timezone --utc GMT/London


    I don't know this tool, but the correct timezone name could rather be
    Europe/London, no?


    > [joliver@0123456789-VCS ~]$ date
    > Tue Apr 1 21:05:09 GMT 2008
    >
    > [joliver@0123456789-VCS ~]$ /sbin/hwclock
    > Tue 01 Apr 2008 09:05:39 PM GMT -0.323329 seconds
    >
    > Why is my hardware clock 12 hours off from the system clock?


    Because you were unfortunate enough to check it on April 1st in the
    afternoon. Check it again in the morning of a normal day, and you'll
    see The Light. ;-)


    Serge.
    --
    Serge point Bets arobase laposte point net

+ Reply to Thread