0

Every time I sync the time on a CentOS 7 (Scientific Linux 7) server virtualized on VMware ESXi, I arrive the next day to find that the time gets 3 hours forward. I did a cronjob to write the time every 5 miniutes and I noticed that when the time is 22:55, the next time written is 2:00. This is my /etc/ntp.conf which is supposed to sync with a local NTP server

driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict localhost
restrict -6 ::1
server xx.xx.xx.xx prefer iburst
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
logfile /var/log/ntp.log

I configured chronyd with only server directive as above but I get the same behavior.

/etc/adjtime contents:

0.0 0 0.0
0
UTC

The way I sync the time:

  1. Stop ntpd
  2. ntpdate xx.xx.xx.xx
  3. timedatectl set-ntp true
  4. Start ntpd.

The timezone is correct through /etc/localtime link, tzselect, and timedatectl set-timezone commands.

  • What timezone are you in? Is the system's hardware clock set to UTC time? – Kusalananda Apr 17 '18 at 9:11
  • Asia/Amman. From the /etc/adjtime it seems yes. – 3bdalla Apr 17 '18 at 9:12
  • Ad is the host machine of the VM a Windows machine or another machine running in the UTC+3 timezone? – Kusalananda Apr 17 '18 at 9:16
  • No. All of our servers are running in an ESXi hypervisor. – 3bdalla Apr 17 '18 at 9:17
  • Please add output from /sbin/adjtimex --print to your question. – roaima Apr 17 '18 at 11:04
0

In my opinion you most likely have an issue with VMWare integrated time sync.
By default your esxi insure that the clock of your guest machines are synced with its clock.
If you want to disable the sync between your esxi clock and your guest VM you can.
See the VMWare KB1189 :

  • power off you VM
  • connect to the ESXI in SSH
  • edit the file /vmfs/volumes/datastore_name/vm_name/vm_name.vmx
  • change thos value to 0 or FALSE (it will depend on the type of vmware product you use:

tools.syncTime = "0" or "FALSE"
time.synchronize.continue = "0" or "FALSE"
time.synchronize.restore = "0" or "FALSE"
time.synchronize.resume.disk = "0" or "FALSE"
time.synchronize.shrink = "0" or "FALSE"
time.synchronize.tools.startup = "0" or "FALSE"
time.synchronize.tools.enable = "0" or "FALSE"
time.synchronize.resume.host = "0" or "FALSE"

Important note:
Before Doing that I would suggest you to check if the clock of your ESX is properly configure and that it's not the problem, it's easier to keep your esxi clock sync so all your vm will have a correct clock.

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.