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?
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.
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.
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.