2

My RTC time on my Ubuntu 16.04 is going crazy. After a few minutes the RTC time is going totaly wrong.

The strange thing is, if I disable NTP Service (timedatectl set-ntp false and service ntp stop) and fix the time once (hwclock -w) the RTC time is always correct. The local time (the really correct time) is always correct.

My configuration:

  • Root Server with Hyper-V (Windows Server 2012 R2) with correct ntp time.
  • Time Sync in the Hyper-V VM settings is disabled. (Otherwise I got this "Time has been changed" message every 5 seconds at /var/log/syslog)
  • Guest: Ubuntu 16.04

Without NTP Service:

timedatectl
Local time: Fri 2017-03-03 12:07:35 CET
Universal time: Fri 2017-03-03 11:07:35 UTC
RTC time: Fri 2017-03-03 11:07:35
Time zone: Europe/Berlin (CET, +0100)
Network time on: no
NTP synchronized: no
RTC in local TZ: no

With NTP Service (service ntp start):

timedatectl
Local time: Fri 2017-03-03 12:09:15 CET
Universal time: Fri 2017-03-03 11:09:15 UTC
RTC time: Fri 2017-03-03 11:09:29
Time zone: Europe/Berlin (CET, +0100)
Network time on: no
NTP synchronized: yes
RTC in local TZ: no

and later (with NTP enabled):

timedatectl
Local time: Fri 2017-03-03 13:12:28 CET
Universal time: Fri 2017-03-03 12:12:28 UTC
RTC time: Fri 2017-03-03 12:52:58
Time zone: Europe/Berlin (CET, +0100)
Network time on: no
NTP synchronized: yes
RTC in local TZ: no

even later (with NTP enabled):

timedatectl
Local time: Fri 2017-03-03 13:42:16 CET
Universal time: Fri 2017-03-03 12:42:16 UTC
RTC time: Fri 2017-03-03 12:51:46
Time zone: Europe/Berlin (CET, +0100)
Network time on: no
NTP synchronized: yes
RTC in local TZ: no

Same thing happens if I use "timedatectl set-ntp true" instead of ntpd. This only happens on Hyper-V. My Ubuntu 16.04 on esxi didn't have this problem. Why NTP service Change the RTC time clock? How can I fix it?

The main problem is, that the RTC time is using at boot time and then the time is going backwards after boot. Some services have a problem with this and didn't work properly if this time jumps happens.

  • 1
    Please refrain from spamming the same question on multiple SX sites. You asked the question on the ubuntu site: askubuntu.com/questions/889152/… – dfc Mar 5 '17 at 20:41
  • Did you find a resolution? The askubuntu link above no longer works, and I'm having a similar issue with RTC clocks on HyperV, I just had one drift 76 minutes fast after 90 minutes of run (i.e. almost double), this on 18.04 and chrony, so a lot later. But only this server. – Linwood Oct 15 '19 at 3:00
0

You could try PTP timekeeping:

[...] To solve the problem, a solution was introduced in Linux-4.11: PTP devices for KVM and Hyper-V. These devices are not actually related to the PTP time synchronization protocol and don't work with network devices, but they present themselves as PTP (/dev/ptp*) devices, so they're consumable by the existing time synchronization software. [...]

https://opensource.com/article/17/6/timekeeping-linux-vms

http://manpages.ubuntu.com/manpages/trusty/man8/ptpd.8.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.