Mandriva 2010.0 + KVM + Centos 5.x guest = troubles with the clock

We are just in the process of completely reinventing our data center and thus are rolling out a number of Mandriva 2010.0 based servers for various tasks. One of those tasks is virtualization, of course.

Now, basically, there is nothing special about virtualization and Mandriva 2010.0 (maybe except this bug [1] that prevents it from giving more than 2G of RAM to KVM guests).

The only trouble I really ran into was with Centos 5.4 and its veryvery old 2.6.18 kernel (despite the fact that many things have been backported). With Centos 5.x getting a stable clocksource is very difficult.

To be honest, perviously I’ve never thought much about the clocksource, because things have just always worked right out of the box. Now I understand that a stable clocksource is really vital for many applications.

Yet with Centos 5.x the clock became so unstable, that some applications simply crashed, most notably dovecot, dying with a weird “Time has moved backwards by 4398 seconds” message. There is even a dedicated page on the dovecot wiki for this problem [2].

In order to circumvent the problem, the following is essential on the Centos guest:

  • do not use ntp
    running ntp on virtual hosts is a very bad idea, see [3]
  • do not use kvm-clock as a clock source
    use acpi_pm instead

For the latter, using acpi_pm, check the following:

% cat /sys/devices/system/clocksource/clocksource0/available_clocksource

This lists you the available clocksources.

Setting the clocksoure is done by adding a kernel boot parameter. Typically, this can be done either in /boot/grub/menu.lst or in /etc/lilo.conf, depending on which bootloader you have.

There, add clocksource=acpi_pm to the existing kernel parameters and reboot the box. That should be it.

As a reference, I found the following sites on the internet quite useful for debugging the problem:


Spread the love

Leave a Reply

Notify of

Post Navigation