You are not logged in.

#1 2011-07-08 17:15:18

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

Time gets set back by several hours every boot

This has been quite frustrating. I can't figure out why every time I boot, my time gets set back by approximately 7 hours.  My hardware clock will be correct (even in my bios before boot), but the system clock will be wrong, like so:

$ hwclock --show; date
Fri 08 Jul 2011 10:02:40 AM PDT  -0.564036 seconds
Fri Jul  8 03:01:40 PDT 2011

Whether I use hwclock or ntp or localtime or utc, it does not seem to matter.  Every time I reboot, the clock gets set back by around some amount of hours.  However, if I use ntp, it seems to automatically fix itself after the ntpd daemon has began running.

Every boot the clock starts wrongly, then crond displays a message and suddenly it is fixed.

Example times/messages from a single reboot:

Jul  8 09:46:00 localhost syslog-ng[917]: syslog-ng shutting down; version='3.2.4'   # Last message before reboot - time correct
Jul  8 02:51:25 localhost syslog-ng[896]: syslog-ng starting up; version='3.2.4'  # First message after reboot - time wrong
... [more boot messages with wrong time]
Jul  8 09:53:01 localhost crond[1016]: time disparity of 421 minutes detected # First message where time is correct again

The crond message is displayed after every boot.  And it's worth noting that 421 minutes is 7 hours, exactly how much time my clock is off by. However, sometimes it is off by more, so it's not always exactly 7 hours.

I can't figure out what is happening.  Is something setting my clock wrongly every reboot?

Last edited by CheesyBeef (2011-07-08 17:21:18)

Offline

#2 2011-07-08 18:16:46

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

Re: Time gets set back by several hours every boot

Hmm, well I actually have managed to get it to remember the time every reboot by (unfortunately) reverting to hwclock and localtime in /etc/rc.conf...

Steps:
1) Set the hwclock time correctly with ntp (hwclock --systohc)
2) Disable ntpd, enable hwclock and set HARDWARECLOCK="localtime" in /etc/rc.conf
3) Reboot

However, this setup is not ideal in my opinion.  I would rather use UTC and sync the time with ntp.  So a fix would still be something I want, but I am glad it is at least working now.

Offline

#3 2011-07-08 19:31:14

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

Re: Time gets set back by several hours every boot

Search the forums for this issue and the "adj" time file, i can't recall it's full name (it's located in /var/run iirc).  Delete the adjust-time file.  Use ntpd, I do.  Just remember to unset the "hwclock" in your daemons line.

Offline

#4 2011-07-08 19:33:48

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Time gets set back by several hours every boot


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#5 2011-07-08 21:13:46

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

Re: Time gets set back by several hours every boot

Yeah I tried removing the adjtime file, but it did not work :\

The adjtime file looks like this:

$ cat /var/lib/hwclock/adjtime 
0.000000 1310146696 0.000000
1310146696
LOCAL

Offline

Board footer

Powered by FluxBB