Problem with time within vms

undefine

New Member
Dec 6, 2024
6
0
1
I have a Proxmox cluster with several Debian 12 virtual machines. These VMs use ntpd to synchronize time with local NTP servers. Under normal conditions, everything works correctly. However, when creating a disk-only snapshot, I observe that the VM’s internal time freezes for approximately 0.3–0.8 seconds. Shortly afterward, ntpd performs a time "step" to correct the offset, but I would prefer to avoid this issue entirely.

The problem occurs on VMs using both local-lvm and ceph storage. All VMs have the qemu-guest-agent installed, and no freeze-related messages appear during snapshot creation.
 
Hi,
even when creating a disk-only snapshot, the VM needs to be paused, so that the state of the disks in the snapshots is from the same time.

Do you have the guest agent enabled in the configuration? It is recommended to freeze the file systems, otherwise it cannot be guaranteed that the raw disk state (which the storage snapshot represents) is consistent from a filesystem perspective.

Do you have any actual issue with the time? If the offset is corrected right away, that sounds to me like it works as intended.
 
  • Like
Reactions: Kingneutron
Hi,
  • The guest agent is configured and working correctly. During backups, freeze and thaw operations are performed by the agent as expected.
  • When creating a snapshot, I see the message on the VM: qemu-ga: info: guest-fsfreeze called.
  • NTP does correct the time, but since it isn’t triggered by the guest agent, it can take quite a while—often several minutes.
I noticed this issue especially with database snapshots, where the "pause" in time causes the primary instance to see secondaries as being in the future.


It would be helpful to have an option to trigger an immediate time synchronization (e.g. via the guest agent) after a snapshot is taken.
 
This is still my best workaround:

Bash:
qm guest exec $VMID /usr/sbin/hwclock -- --hctosys || true
 
This is still my best workaround:

Bash:
qm guest exec $VMID /usr/sbin/hwclock -- --hctosys || true
Thanks. Have you any idea how to integrate it with proxmox snapshots gui? Is there something simmilar to /etc/vzdump.conf with "scripts" where such code could be executed during snapshots?
 
Have you any idea how to integrate it with proxmox snapshots gui?

I would use QEMU Agent hook scripts instead, so you can run inside the VM which ever time sync command you need when the filesystem is thawed. Some details on [1] and [2].

Out of curiosity: which DB is it? Using Percona, MySQL GTID replication or Postgresql haven't seen that snapshot or backups have caused issues with time.

[1] https://pve.proxmox.com/wiki/VM_Backup_Consistency
[2] https://forum.proxmox.com/threads/freeze-thaw-scripts.144091/post-648224
 
I would use QEMU Agent hook scripts instead, so you can run inside the VM which ever time sync command you need when the filesystem is thawed. Some details on [1] and [2].

Upstream really have to fix this :(

That's really sad that this bug is in Proxmox forever.