View previous topic :: View next topic |
Author |
Message |
dgulotta Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 09 Jan 2006 Posts: 88
|
Posted: Tue May 31, 2016 8:53 pm Post subject: clock drift on each reboot |
|
|
Every time I reboot, my system clock gets about 35 seconds farther behind. It seems that the problem is that the system time gets set at shutdown, but /etc/adjtime isn't updated to reflect the fact that the system time was adjusted. So at every boot the system thinks that it needs to compensate for all of the drift that happened since I last set the hardware clock manually. The problem seems to occur with sys-apps/util-linux-2.28 and 2.26.2, but it didn't occur with 2.25.2-r2. Is there any way I can fix this?
My /etc/conf.d/hwclock is just the standard one:
Code: | # Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also known as
# Greenwich Mean Time). If that clock is set to the local time, then
# set CLOCK to "local". Note that if you dual boot with Windows, then
# you should set it to "local".
clock="UTC"
# If you want the hwclock script to set the system time (software clock)
# to match the current hardware clock during bootup, leave this
# commented out.
# However, you can set this to "NO" if you are running a modern kernel
# and using NTP to synchronize your system clock.
#clock_hctosys="YES"
# If you do not want to set the hardware clock to the current system
# time (software clock) during shutdown, set this to no.
#clock_systohc="YES"
# If you wish to pass any other arguments to hwclock during bootup,
# you may do so here. Alpha users may wish to use --arc or --srm here.
clock_args=""
|
Edit: I think this is a bug caused by hwclock --systohc changing its behavior in util-linux-2.26, and /etc/init.d/hwclock not being updated accordingly. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
venomfang n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 22 Oct 2013 Posts: 2
|
Posted: Wed Jun 01, 2016 6:42 am Post subject: |
|
|
Here is where i would start:
1) Rule out this being a hardware problem (ex bad cmos/bios battery). This can be done by disabling the clock sync, doing a couple of reboot cycles and seeing if the time in the bios/uefi has drifted.
2) Are you using NTP at all to sync your time? If you are you should really set the clock_hctosys option to no. It is redundant if you have a reliable network connectin to an ntp server.
3) Do you get any errors when you hwclock --systohc? Does hwclock --show show the correct time after this? Just looking at ruling out the init script.
Hope this helps. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
chithanh Developer
![Developer Developer](/images/ranks/rank-dev.gif)
![](images/avatars/3210501551dc02a09eeb8.png)
Joined: 05 Aug 2006 Posts: 2158 Location: Berlin, Germany
|
Posted: Wed Jun 01, 2016 12:05 pm Post subject: |
|
|
You can check this by running Code: | # /etc/init.d/hwclock restart |
If every time you do that the clock shifts by 35 seconds then this points to a bug in util-linux or the init scripts. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
cwr Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 17 Dec 2005 Posts: 1969
|
Posted: Wed Jun 01, 2016 3:39 pm Post subject: |
|
|
For that reason, I don't adjust the CMOS clock at shutdown. I just let the clock run and either reset
it with calls to NTPD or (usually) adjust the relative system clock time with adjtime.
Will |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dgulotta Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 09 Jan 2006 Posts: 88
|
Posted: Thu Jun 02, 2016 4:47 pm Post subject: |
|
|
The drift happens when I run /etc/init.d/hwclock restart. I added some echo statements and it seems that the script runs hwclock --hctosys (which takes drift into account) and hwclock --systohc --noadjfile (which updates the harwareclock without updating /etc/adjtime). |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|