I've installed NTP and internal NTP server peer is stratum 2. But every time I reboot the server, the VM time is synced with ESX instead of ntp.

I did run ntpdate -s x.x.x.x and corrected it. But after reboot its hours behind again.

Why doesn't NTP handle it? I've enabled ntp and it starts up during boot but the time is always the esx time. I'm on Ubuntu 16.04.

Also timedatectl doesn't show NTP but systemd.timesyncd is displyed. systemd.timesyncd is disabled and stopped on the VM.

root@host001:~# timedatectl
                      Local time: Fri 2020-05-08 16:00:59 UTC
                  Universal time: Fri 2020-05-08 16:00:59 UTC
                        RTC time: Fri 2020-05-08 08:57:03
                       Time zone: UTC (UTC, +0000)
       System clock synchronized: no
systemd-timesyncd.service active: no
                 RTC in local TZ: no

ntpd will not sync the time if the difference between local computer time and the time server's time exceeds a threshold.

Put ntpdate -b 0.pool.ntp.org (replace 0.pool.ntp.org with your local time server if you have one) in your rc.local or a custom startup service and it should sort it out. You should probably also make sure that timesyncd is enabled and running. systemctl enable timesyncd; systemctl start timesyncd should accomplish that.

  • It isn't about the difference. I used ntpdate to set the time correctly and then ntp service works fine. But everytime I reboot the time is behind few hours which is the esxi time. I'm asking why ntp isn't syncing during reboot and why is the virtual machine syncing with Esxi although ntp is installed – R0bert2 May 8 '20 at 17:08
  • ntpd will refuse to sync if time is out by more than an hour, IIRC. ntpdate is less restrictive. The VM cannot change the host's time, that would be a significant security issue. – Gordan Bobic May 8 '20 at 18:26

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.