Temporary fix:
- Pause and resume the VM.
- Stop and start the VM.
- Go to Hyper-V Manager console and disable and then enable the Time Synchronization option for the VM.
Long-term fix:
- Configure the VM to pull time from an external source (e.g. domain controller or NTP server). This requires the Time Synchronization option to be disabled on the host.
- Configure the host to pull time from an external source like domain controller or NTP server; and then verify if the VM is pulling time from the host OS through NTP.
- Create a script for cron to schedule time update on the server:
- You need to create the script using vi editor:
cd /etc/cron.hourlyvi ntpdate.sh
-
Change the pool.ntp.org to be whatever your time server is:
Example:
Original File:
#!/bin/bash
ntpdate -s pool.ntp.org
service crond reloadNew File:
#!/bin/bash
ntpdate -s time-a.nist.gov service crond reload - Save and close the file.
- Add the following in order to run hourly in crontab:
crontab –e
This allows you to edit the root crontab.
The original file looks something like this:
*/10 * * * * /usr/sbin/logrotate /etc/logrotate.d/lighttpd
0 * * * * /usr/tmcss/bin/tlogger
15 0 * * * /usr/tmcss/bin/CDTPurge.sh - Add a line to the script above:
19 * * * * /etc/cron.hourly/ntpdate.sh
The 19 means it will run every hour at the 19th minute. You can change this to any number you want.
- Save the file and make sure that the Time Synchronization option has been disabled on the host.