hwclock on Virtual Machines has a different value than hwclock on the hypervisor

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Virtualization 3
  • Red Hat Enterprise Linux 5.8
  • VM is migrated from XEN

Issue

Hypervisors display correct time:

[root@hw ~]# hwclock --show
Fr 11 Okt 2013 14:16:09 CEST  -0.912115 Seconds
[root@hw ~]# date
Fr 11. Okt 14:16:08 CEST 2013

but the VMs that run on them display incorrect time:

[root@vm ~]# hwclock --show
Fr 11 Okt 2013 12:16:52 CEST  -0.781593 Seconds
[root@vm ~]# date
Fr 11. Okt 12:16:57 CEST 2013

Resolution

Set "UTC=true" in /etc/sysconfig/clock

Root Cause

Under XEN there is no "hwclock" and thus UTC setting has no effect. However after Virtual Machines are migrated to KVM / RHEV, the system clock gets set to wrong time via hwclock.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.