Strange Issue With System Time Being Off

Home » CentOS » Strange Issue With System Time Being Off
CentOS 24 Comments

Hi all,

I am having an issue with some older CentOS 5.3 servers. Every time the server boots, it gives the error “Cannot access the hardware clock by any known method”, and then promptly sets the time 5 hours behind the hardware clock, down to the second.

After the system is up. “hwclock” works fine. hwclock –debug does not show any error at all.

The hardware clock is configured in local time. /etc/sysconfig/clock is set to UTC

24 thoughts on - Strange Issue With System Time Being Off

  • Russell Jones wrote:
    So, it’s obviously setting it to GMT.

    Wonder if there’s some permission or ownership problem…. You might also check in the BIOS, if some protection is turned on.


  • Thanks for the reply.

    The hwclock can be set properly from the OS. No BIOS permissions to even set for the clock, it’s just a standard old 24 hour clock.

  • Thanks, I tried again, rebooted, still 5 hours off slow. The second I
    do “hwclock –hctosys” the time is fine. That’s silly to have to do that though, I feel like I am missing a configuration parameter somewhere.

    [root@nod705 ~]# date Thu Aug 9 10:06:36 CDT 2012

    [root@nod705 ~]# hwclock Thu 09 Aug 2012 03:06:39 PM CDT -0.437183 seconds

    [root@nod705 ~]# cat /etc/sysconfig/clock
    # The ZONE parameter is only evaluated by system-config-date.
    # The timezone of the system is defined by the contents of /etc/localtime. ZONE=”America/Chicago”

  • Craig,

    Let me clarify. I correct the time, and both “date” and “hwclock” both show the correct time. I reboot the server and “date” is again 5 hours slow.

  • Also in case it wasn’t clear, I have ran “hwclock –systohc” after
    “date” shows the correct time.

  • Russell Jones wrote:
    Please don’t top post.

    Here’s a question: run hwclock, then, when you reboot, go into the BIOS, and see what the time is.


  • Thanks Mark. “hwclock” showed the right time before reboot. After reboot, entering BIOS it still showed the correct local time. After the server came up, “date” is slow by 5 hours.

    [root@nod705 ~]# date Thu Aug 9 11:26:12 CDT 2012

    [root@nod705 ~]# hwclock Thu 09 Aug 2012 04:26:15 PM CDT -0.002574 seconds

  • Russell Jones wrote:

    Hmmm… and the BIOS doesn’t have something that says use GMT? If not, sounds like there’s a configuration file *somewhere* that’s saying use GMT.

    I’m out of here for the day. See if something comes to mind tonight….


  • Nope, no timezone configuration options at all. Like I said, very strange. Usually time just “works” on a box.

    Thanks for the help

  • on 8/9/2012 12:33 PM Russell Jones spake the following:
    Since you say “servers” do you have one that you can bring more current then
    5.3 to see if there was a kernel patch or something that fixed this? Between
    5.3 and Current (5.8) anything could have happened.

  • Apparently something is amiss in the initramfs preventing access to the rtc, and once the real root filesystem is mounted, rtc access works. I’m not sure where to look or how an error might have crept in, but when I
    unpack my initramfs on a couple of systems (it’s a compressed cpio archive) and grep for “rtc”, I find:

    ./etc/modprobe.d/dist.conf:alias char-major-10-135 rtc
    ./etc/udev/rules.d/50-udev-default.rules:SUBSYSTEM==”rtc”, DRIVERS==”rtc_cmos”, SYMLINK+=”rtc”

  • Let’s back up a bit. I bet Mr Jones, the OP, is in the US central time zone, which right now is 5 hours earlier than UTC. I’m betting the hardware clock is set to UTC, but that CentOS believes that the hw clock is set to local time, i.e. CST6CDT. (That is how it would be set for Windoze.) There is some pitiful setting to correct the Windoze problem, and it is being applied. It shouldn’t be.

    Reboot, set bios clock to UTC. Then track down wherever CentOS
    gets the idea that you have a dual boot windows machine whose clock is set to local time, and whack that.

    I’m reasonably confident that this is the problem. The “exactly five hours off” is what clued me.

    I think some others up-thread have been hinting about this, at least indirectly.


  • Hi Dave, Robert,

    Thanks for the help!

    Dave: There are no options for time zones in the BIOS clock. The time is just “there” to be set. It is currently set to 7:08 PM, which is the current Central Time.

    Robert: Great idea! I am fairly certain that is a good direction to go in. I will check this on Tuesday (next time I am in the office).

  • Hello Russell,

    Have you tried adding –debug to CLOCKFLAGS in rc.sysinit to see if it reports anything for the first invocation?

    Regards, Leonard.

  • What other settings are in that file?

    The system is treating your hardware clock as if it were UTC. Actually setting it to UTC is probably the easiest fix (and possibly the best one).

  • Hi all,

    After poking around a bit I ended up just going the
    /etc/ntp/step-tickers route to resolve the issue and have the time in-sync as soon as the OS comes up.

    Thanks for all the help!