I am using one Linux VM through VNC viewer from my Windows machine. What I am seeing is that time between two is not synchronized. It seems that the VM is about 5 minutes delayed from Windows (windows time is up-to-date). It means my Linux VM is running 5 mins behind real time.

And both are in same time zone. Can we make the VM up-to-date with regard to actual time?


  • 1
    Hi Shekhar, I have tried almost everything I found on various forums(configuring ntp). But it didn't help – dcds Jul 21 '15 at 11:35
  • Have you tried ntpdate? – YoMismo Jul 21 '15 at 11:43
  • Hi YoMismo, when I am doing ntpdate its throwing error saying – dcds Jul 21 '15 at 11:54
  • ntpdate[9652]: the NTP socket is in use, exiting – dcds Jul 21 '15 at 11:55
  • Christohper, No VM is not on the same host. – dcds Jul 21 '15 at 11:56

ntpdate is giving you the "socket in use" error because you have a NTP daemon running. This is good. Now, the problem with VMs is that they tend to have a huge time offset (because of being frozen and restarted), and by default NTP panics and exit when the clock skew is too big. Add the following lines to /etc/ntp.conf:

tinker panic 0
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
server 3.rhel.pool.ntp.org

The first line tells NTP to force set the time even if the VM's clock is much late, and the following lines define a pool of NTP servers large enough not to pick up a falseticker (a bugged NTP server that gives you the wrong time).

This NTP server pool defined here is for Red Hat, if you have a different distro feel free to change these lines.

If you can, install the vm-tools package which will auto-sync the guest with the host's time, and also provide some nice additional capabilities (for instance being able to copy & paste text between guest and host).

  • After adding these above lines in /etc/ntp.conf. what I need to do ? Because after that also time is not synchronizing. – dcds Jul 21 '15 at 12:42
  • Restart the daemon with service ntpd restart. – dr01 Jul 21 '15 at 12:48
  • And set time manually, if time's error differ more than a couple of minutes time won't be updated by ntp. – YoMismo Jul 21 '15 at 12:56
  • @YoMismo There's no need to set the time manually, the changes I proposed to the NTP config have exactly the purpose of forcing NTP updates. Please re-read my answer. – dr01 Jul 21 '15 at 13:03
  • 1
    @dr01 You're right, I'm sorry. – YoMismo Jul 21 '15 at 13:13

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.