3

I'm having a problem with the clock running fast in Ubuntu 8.04 server (2.6.24-24-generic kernel) running in VirtualBox 3.04.

It's drifting quickly, something like 5 minutes per hour.

I think it was working fine until I upgraded to VirtualBox 3.04 (from 2.something). I had ntpd running and the only thing I had to do was /etc/init.d/ntp stop, ntpdate ..., /etc/init.d/ntp start when the virtual machine was suspended/resumed.

Today, I've tried installing the VirtualBox Guest Additions, and they're running (according to /etc/init.d/vboxadd status.)

Running vboxadd-service --foreground --verbose Results in:

vboxadd-service: Starting 'timesync' in the main thread
vboxadd-service: adjtime by -380331911000 ns
vboxadd-service: adjtime by -381107064000 ns
vboxadd-service: adjtime by -381883899000 ns

Which looks like it's trying, but failing, to update the time.

So, I'm not sure what to do, I can't find any consensus on whether ntpd should be running or not? And if not, how do I stop it from starting up again on reboot?

Tom
  • 2,652
  • 1
  • 20
  • 12

3 Answers3

2

This was a know issue in VirtualBox, resolved by installing the Guest Additions on the Virtual Machine to manage the TimeSync. Their was a similiar problem with VMWare a while back as well. This is just one of the times it was reported for VirtualBox.

Ensure you are running the latest guest additions and it is the latest version provided with your version of VirtualBox.

BinaryMisfit
  • 1,593
  • 2
  • 15
  • 30
  • Yeah, I got that impression... I am running the 3.0.4 version of Guest Additions. – Tom Aug 20 '09 at 07:26
  • I noticed that some of the guest additions don't work right after a kernel upgrade...In other words they liked being recompiled when a kernel upgrade happens sometimes. I don't know if that would have anything to do with your problem, but it may... – KFro Sep 22 '09 at 00:15
  • Linux Debian host, Windows XP guest, the clock is delayed by up to exactly 3 minutes. If I sync the time (using NTP) an I let it run for approximately 15 minutes or more, the guest's time will be delayed by exactly 3 minutes. This is with the Guest Additions installed. The problem persists at least with Windows XP guests. – f.ardelian Apr 07 '14 at 06:52
1

I don't see why you couldn't run ntpd on the system, or cronjob an ntpdate to run every two or three minutes. I remember clock drift being an issue in many VM products at one time or another and the solution was always to make sure both the additions/utilities and the VM product were the same level.

You could also see if installing a new VM with an updated version of Ubuntu affects the clock drift at all, or if there's something odd with hyperthreading on your system or some other processor extension enabled in BIOS.

My personal approach would be to look at running a time sync from cron periodically since NTP can sometimes fail without telling me or run at random times which would be great when the clock isn't skewing like mad but in this type of situation...it might be handier to just force it to run consistently. Won't hurt anything aside from chewing a few extra processor cycles.

Bart Silverstrim
  • 31,172
  • 9
  • 67
  • 87
  • 1
    i think the clock is drifting too fast for ntpd to correct it using it's "gradual" method. for now i'm just running ntpdate hourly. – Tom Aug 21 '09 at 01:18
1

I don't know about Ubuntu and Virtualbox, but taking from what I know of RedHat and VMware, you could try appending "clock=pit" to your kernel boot options.

Alex
  • 6,603
  • 1
  • 24
  • 32