Xen clock not keeping time

By default, the guest domain (domU) will attempt to use the same clock as the host (dom0). This approach reduces resources where every guest has to manage its own clock and there is no reason for the hosts to have varying experience of time. However, it is common for the time to "jump" forward by a few minutes a day.

Whilst this default behavior is set, it is not possible to set the time of the domain using the standard tools (rdate, ntpdate, clock, hwclock etc) so the time cannot be kept reliably.

To release a Linux guest domain to manage its own time, the kernel setting "independent_wallclock" needs to be set to 1 within the guest domain. You can check the current setting as follows:

<strong>cat /proc/sys/xen/independent_wallclock</strong>

This can be done from the command line and is effective immediately as follows:

<strong>echo 1 > /proc/sys/xen/independent_wallclock</strong>

To set the wallclock on boot, add the following to the file: /etc/sysctl.conf:

<strong>xen.independent_wallclock = 1</strong>

The dom0 can also suffer from the same problem and is fixed in the same way.