Saturday, May 4, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 7586  / 2 Years ago, mon, august 29, 2022, 12:05:03

Problem: ntpd, when installed on a virtual machine running Ubuntu (I've had this on hosts with a variety of hypervisors such as KVM and VMware ESX) seem to be prone to severe clock drift. I haven't found any good method and not everyone seems to experience this.



Question: How can I prevent this? Are there any settings in /etc/ntp.conf to force ntpd to be more aggressive in synchronizing the time inside the VM or should I use ntpdate -b timeserver instead inside a cron job running every so often?



Which method is recommended to avoid leaps when using ntpdate -b or clock drift in general inside a Ubuntu virtual machine?






Side-note: I've seen similar effects on vios (IBM hypervisor) slaves running AIX as well as on Solaris. So the problem is very real and appears to be related to hypervisors in general.


More From » virtualization

 Answers
3

I observed similar symptoms on a Linux machine running on VMware ESX. It seems that the drift (several minutes per day) was caused by having time synchronization both provided by NTP inside the VM and VMware tools. We solved our problem by disabling time synchronization in the VMware tools properties (in the VM properties in ESX). After that NTP was able to keep the clock in synch with a remote time server. If you prefer to edit the .vmx file manually, set tools.syncTime = "0".



Stopping NTP inside the VM and letting the tools synch the time would probably work as well, at least to correct the server drift. ESX itself can run an NTP daemon. VMware's timekeeping best practices recommend using NTP instead of VMWare Tools for time synchronization.



VMware publishes a lengthy paper on timekeeping in VMware virtual machines. The most relevant passage is the subsection “Clocksource Kernels”. The VMware KB also has troubleshooting tips for timekeeping in Linux guests.


[#31794] Tuesday, August 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rieency

Total Points: 299
Total Questions: 116
Total Answers: 111

Location: Wales
Member since Tue, Dec 14, 2021
2 Years ago
;