If the host go to sleep and wake up, the guest clock is not getting synchronized, and shows the time when the host went to sleep. I have all the Integration Services enabled under Hyper-V, including time synchronization, but that does not help.
Chrony is installed and running but that doesn't do its job either. I put the host to sleep last night, around 23:30 and this is how it looks now:
Local time, where I live: 10/08/2019 07:09
RHEL8:
[ops@rhel ~]$ date Fri Aug 9 23:31:52 BST 2019 [ops@rhel ~]$ systemctl status chronyd ● chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2019-08-09 20:37:08 BST; 2h 55min ago Docs: man:chronyd(8) man:chrony.conf(5) Main PID: 791 (chronyd) Tasks: 1 (limit: 24984) Memory: 3.4M CGroup: /system.slice/chronyd.service └─791 /usr/sbin/chronyd Aug 09 20:37:08 rhel chronyd[791]: Frequency 3.239 +/- 1.728 ppm read from /var/lib/chrony/drift Aug 09 20:37:08 rhel chronyd[791]: Using right/UTC timezone to obtain leap second data Aug 09 20:37:08 rhel systemd[1]: Started NTP client/server. Aug 09 20:39:21 rhel chronyd[791]: Selected source 129.70.132.35 Aug 09 20:39:21 rhel chronyd[791]: System clock TAI offset set to 37 seconds Aug 09 22:57:38 rhel chronyd[791]: Source 86.59.80.170 replaced with 178.17.161.12 Aug 09 23:04:57 rhel chronyd[791]: Can't synchronise: no majority Aug 09 23:13:20 rhel chronyd[791]: Selected source 78.46.204.247 Aug 09 23:13:20 rhel chronyd[791]: System clock wrong by 27576.380957 seconds, adjustment started Aug 09 23:19:49 rhel chronyd[791]: Selected source 129.70.132.35 [ops@rhel ~]$ chronyc tracking Reference ID : 81468423 (stratum2-2.ntp.techfak.net) Stratum : 3 Ref time (UTC) : Sat Aug 10 06:10:54 2019 System time : 27485.898437500 seconds slow of NTP time Last offset : +0.001137523 seconds RMS offset : 3753.853759766 seconds Frequency : 6.444 ppm fast Residual freq : +3.572 ppm Skew : 10.344 ppm Root delay : 0.028593639 seconds Root dispersion : 0.004012693 seconds Update interval : 59.7 seconds Leap status : Normal [ops@rhel ~]$ chronyc sources 210 Number of sources = 4 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^- nono.com 2 6 377 35 +2808us[+2808us] +/- 47ms ^- mira.beduzar.fr 3 6 377 53 -3661us[-2558us] +/- 29ms ^- time-b.as43289.net 2 8 377 316 +127ms[ +128ms] +/- 274ms ^* stratum2-2.ntp.techfak.n> 2 6 377 43 +147us[+1284us] +/- 18ms [ops@rhel ~]$
The time zone is set correctly and I have added servers to /etc/chrony.conf:
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 0.europe.pool.ntp.org server 1.europe.pool.ntp.org server 2.europe.pool.ntp.org server 3.europe.pool.ntp.org
I expect chronyd to synchronize the time but apparently it does something else. Do you guys know what it does and how to automate time synchronization in RHEL 8?
Just out of curiosity. Is RHEL8 the only guest to have this issue?
Hi, thanks for your report! There are 2 things need to be clarified.
1) For time synchronization in the Integration Services in rhel guest on windows
If enabled, the guest time sync to host will be triggered by the following operations:
a. Power OFF and Power ON the Virtual Machine.
b. Pause and Resume the Virtual Machine.
c. Save and start the Virtual Machine
d. Disable and Enable the Time Synchronization option in the virtual machine settings (via the Hyper-V Manager console).
2) Chrony sync time
Refer to chrony introduction, chronyd will cause the system to gradually correct any time offset, by slowing down or speeding up the clock as required
In this scenario, the host sleep and then be waken up, it will not trigger the guest to sync the time to host, and take long time for chronyd to sync time to NTP server for the long time sleep. This is not friendly to user.
If want to sync time immediately from NTP server, can manually exec "chronyc makestep".
Hope this can help!
@Jenny wrote:Hi, thanks for your report! There are 2 things need to be clarified.
Below is like 2 kind of time sync mechanism you can use for RHEL guest on Hyper-V.
1) For time synchronization in the Integration Services in rhel guest on windows
If enabled, the guest time sync to host will be triggered by the following operations:
a. Power OFF and Power ON the Virtual Machine.
b. Pause and Resume the Virtual Machine.
c. Save and start the Virtual Machine
d. Disable and Enable the Time Synchronization option in the virtual machine settings (via the Hyper-V Manager console).This may need to report to Microsoft if you think it should work. If it works, guest time would sync to Hyper-V host time.
2) Chrony sync time
Refer to chrony introduction, chronyd will cause the system to gradually correct any time offset, by slowing down or speeding up the clock as requiredIn this scenario, the host sleep and then be waken up, it will not trigger the guest to sync the time to host, and take long time for chronyd to sync time to NTP server for the long time sleep. This is not friendly to user.
If want to sync time immediately from NTP server, can manually exec "chronyc makestep".
This is how chrony works, it is not related to Hyper-V platform.
Hope this can help!
Thank you, pausing and resuming vm helps, but
sudo chronyc makestep
doesn't do anything except outputting "200 OK".
@AlexC wrote:
Hello,
If you use a local NTP server you can agressivly sync your server via this chronyd conf :
minpoll 0 maxpoll0
makestep 0.1 -1
The daemon contact the NTP server every second to correct is clock.
For information, at the opposite on VMWare the timesync is perform even when the time synchronisation is unchecked :
https://kb.vmware.com/s/article/1189
"The time synchronization checkbox controls only whether time is periodically resynchronized while the virtual machine is running. Even if this box is unselected, by default VMware Tools synchronizes the virtual machine's time after a few specific events that are likely to leave the time incorrect."
Regards
Hi AlexC, thanks for your share!
Update the /etc/chrony.conf:
1)Append 'minpoll 0 maxpoll 0' to server option;
2)Update default 'makestep 1.0 3' to 'makestep 0.1 -1'
Restart chronyd service, then the daemon will connect to NTP server every second and correct the clock in a few seconds.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.