I’ve got virtual machines (with Debian or occasionally *buntu guests, GNU/Linux) running in libvirt/qemu/kvm, and I have discovered the feature to pause/unpause a VM.
After unpausing (virsh resume
), the guest clock is, obviously, off. How can I trigger a call to, say, /usr/sbin/rdate
when the VM unpauses to do a one-shot update (openntpd will do the rest later)?
I have acpi-support-base
installed on the guests so virsh shutdown
works cleanly, but neither dmesg
nor syslog show any events being triggert from pausing/unpausing.
Fortunately you found this obvious, wrong time on VM resume causes lots of confusion...
Ensure host time is accurate, configure hosts to use the same NTP servers that the rest of your devices do.
Install the qemu-guest-agent in the guest. Attach the host to the guest's VirtIO serial channel. Resume or
virsh domtime
now can control guest clock.Or, load ptp_kvm kernel module into Linux guests. chrony can then use PTP to get precise time from the host.