I have a Windows 10 physical (laptop) host with Hyper-V installed and enabled and I am having a problem where for a rather vanilla Debian 9 guest installation, the clock isn't updated after the host is put to sleep for a while and then is waken back up again (I assume the guest is suspended with the host).

As far as I understand, this problem should be trivially handled by Hyper-V integration services, which are enabled both in the virtual machine settings (all integration services enabled) and in the guest (all the hv_* modules are loaded), and where one of the services synchronizes time and makes sure it stays up to date.

So, why doesn't it work in my case? I don't have NTP installed and I don't want to, partially on principle (to troubleshoot the problem with Hyper-V specifically) and partially because the guest must work without Internet connection and remote host services. My host timezone is setup to UTC explicitly (I roam a lot with the laptop and have neither need nor wish to statically associate the guest with a particular timezone), and use TZ variable as needed instead.

I've read a bunch of pages at Microsoft's and some Altaro articles which seemed very informed yet failed to enlighten me on this. I also have read a number of answers on Stack Exchange sites, where half recommend using NTP and other half are mostly about something else or just do not produce desired advice.

I understand that there is perhaps some signal that doesn't fire on the guest when the host gets back from sleep (as it would if you'd put the guest to sleep through ACPI, for instance), but shouldn't this be a solved problem?

What and where can I troubleshoot to make sure I can reliably close the lid on the laptop (putting it to sleep) and expect to come back to my guest with an up-to-date timestamp?


Check this: https://github.com/clearlinux/distribution/issues/39

A working fix is to disable all other time services and use chrony, than configuring only the LIS hyperv timesource ptp0.

Ensure the LIS time-source is available via:

ls /sys/class/ptp

cat /sys/class/ptp/ptp0/clock_name 

Now install chrony for your distro and check the config location, than create the config that corresponds to your ptp? device location.


refclock PHC /dev/ptp0 trust
makestep 1 -1

This will allow chrony to correct the systemtime via the hyperv ptp0 source in a single large step.

The poll time can be lowered to 4 seconds (power of 2) via:

refclock PHC /dev/ptp0 trust poll 2

PS: It seems this is a bug/oversight in hyperv/LIS.

  • Could you please quote something out of that discussion at GitHub? – CaldeiraG Apr 26 '18 at 8:55
  • my bad, updated to an actual answer – andy Apr 26 '18 at 10:01
  • No problem. Now, it is an good answer :) – CaldeiraG Apr 26 '18 at 10:08
  • I thought chrony was an NTP service, if anything I would want to disable it then, as I described in my original question -- I need things to work without Internet connection and preferably NTP, if possible. If chrony also does some "hardware" clock synchronization, then I am fine with that although I'd be also surprised why a distinctly-NTP service also does more than one thing (it ought to do well). – amn Mar 31 '19 at 11:01

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.