Time drifting in VirtualBox RHEL/CentOS

I am running VirtualBox on a Solaris 10 installation, with a CentOS 5.4 virtual machine. The problem I have had is that the time in the virtual machine has been going nuts. Sometimes it goes so slow it almost seems like time is standing still, sometimes it speeds ahead. It is so bad, that neither ntpd nor guest additions’ time sync could keep it running properly.

After googling this a lot and trying different things, I can now bring you the solution:
1) Be sure you’re running the guest os additions (same as vmware tools)
2) Add the following kernel boot parameters:
nmi_watchdog=0 elevator=deadline noapic nolapic divider=10 nolapic_timer clocksource=acpi_pm
3) Reboot, and maybe do a ntpdate one time to get it right. After that, the guest additions should keep the time up to date. Oh, and you should probably not run ntpd at the same time as the guest additions, they could get in each other’s way…

Oh, and it should be fixed in later linux-kernels, but it seems RHEL 5.x (and therefore CentOS 5.x) is stuck on kernel version 2.6.18, which means we don’t get the fix before a new major release.


Tags: , ,

One Response to “Time drifting in VirtualBox RHEL/CentOS”

  1. danielscheu Says:

    Thanks a lot! Without your explanation I would have been spending hours on that problem.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: