1

I have a virtual machine running headless in my machine. When I start it for the first time, the result of date command is correct. But after about a day or 2, I SSH into it and the date command has become late. Like when I tried today, it's already 5 days behind. A restart of the machine fixes this issue (but I don't want to restart all the time).

How do I keep the time/date updated on my server virtual machine over time?

I've noticed this behavior with CentOS 7 and Turnkey Linux (Debian 7) guest OSes. The host is a Mac mini and I'm virtualizing with VirtualBox.

  • Have you installed the guest additions on Linux? Are you running NTP on the guest? – Gilles May 19 '15 at 14:49
  • @Gilles I'm not sure. How do I check that? I'm currently running vanilla Turnkey Linux Core. – baktin May 22 '15 at 2:02
  • @Gilles Thanks for your comments, I think it resolved my issue: installing guest additions and ntp. But I have to observe it for a few days. I didn't know that guest additions was needed to get the time updated. – baktin Aug 18 '15 at 0:56
  • @Gilles Okay, I think your comment did the trick. Perhaps convert it to an answer so I can accept it as the answer. – baktin Sep 1 '15 at 7:41
0

Have you tried to install NTP in your VM and let it take care of that?

If you were using VMware the best thing to do would be to install vmware-tools which provides automatic sync of time. However, I don't know whether a similar package exists for VirtualBox.

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.