Time drifting when running a Linux guest under VMware ESX server
This document (3858673) is provided subject to the disclaimer at the end of this document.
VMware ESX server
ERROR: -659 adding a server to the tree
SETUP NTP ON THE VIRTUALIZED GUESTS
- Modify the /etc/ntp.conf file. Comment out the following entries so the local clock will not be used by placing # signs before them:
#server 127.127.1.0 # local clock
#fudge 127.127.1.0 stratum 10
- Add an entry for this time source at the end of the file replacing x.x.x.x with the server's IP address:
server x.x.x.x prefer
- Stop the NTP daemon. On SLES10:
/etc/init.d/ntp stopOn SLES9:/etc/init.d/xntpd stop
- Slam the current time by typing:
ntpdate x.x.x.x(where x.x.x.x is the NTP source's IP address)
(Force this command several times until the offset displayed is less than one second.)
Start the NTP daemon again. On SLES10:/etc/init.d/ntp startOn SLES9:/etc/init.d/xntpd
Wait for this server to show a reach of 377 by typing:ntpq -p(This may take 15-20 minutes.)
This change helps with overcorrection of time - time moving forward due to the the extra ticks generated by the kernel's compensation code.
Within the guest, open the /boot/grub/menu.lst file within vi and add "clock=pit" to the end of the kernel line in the title Linux section.
NOTE: There was a report of clock=pit causing a reboot when clustering services start when running in a clustering environment. The recommendation was to change this to clock=pmtmr.
Below is an example:
kernel (hd0,2)/boot/vmlinuz root=/dev/hda3 vga=0x317 selinux=0 splash=silent
resume=/dev/hda1 elevator=cfq showopts clock=pit
Whether using LILO or GRUB, please reboot the server after adding this parameter.
Normally the above two VMware ESX server and guest changes should be enough to resolve NTP time issues within the guests. If NTP time issues persist then one may perform this additional step. It is not recommended to make this change unless all other avenues have been investigated.
- Locate the *.vmx configuration file for the guest on the ESX filesystem. (Default location is /root/vmware.) Open this file in vi and change the statement "tools.syncTime=FALSE" to "tools.syncTime=TRUE". For this change to take effect, the SLES9 guest will need to be completely powered off, not just reset, in order to re-read its configuration file. When powering the guest back up the guest should notice that its configuration file has been changed and ask if it should be re-read. Answer "yes" to this question.
Should you find NTP time is not being reliably synchronized the following steps may be useful:
- Verify that the choosen time souce has given us time and is trusted:
Ensure that when typing:
By using the following perl script it is possible to test the success of the suggestions mentioned above:
# Get drift
my $lines = `ntpdate -q pool.ntp.org`;
my @lines = split(/\s/,$lines);
my $dummy = pop(@lines);
my $drift = pop(@lines);
my $nowstring = `date +"%Y%m%d-%H%M%S"`;
print "$nowstring -> $drift\n";
Save this script e.g. into the file /usr/local/bin/timedrift-check.pl and make it executable (by using chmod +x).
The script prints a line in the following format:
When starting the script frequently you can see how the time drift evolve.
VMware Knowledgebase Articles
- "Linux Guest Clock Runs Slowly on ESX Server 3", http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&externalId=2219
- "Clock in a Linux Guest Runs More Slowly or Quickly Than Real Time", http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1420
Formerly known as TID# 10100597
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:3858673
- Creation Date: 29-Feb-2008
- Modified Date:04-Mar-2021
- SUSE Linux Enterprise Desktop
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: email@example.com