[Solved] Guest Local Time Delayed Behind RTC Time

muldr999

New Member
Jun 18, 2023
2
0
1
Hello Proxmox Community,

I'm reaching out today to seek assistance with an issue related to the local time synchronization in my Proxmox guest.

I have noticed that the local time inside the guest is consistently delayed behind the Real-Time Clock (RTC) time. 24 hours after restart it is already off by approximately 3 seconds. This time delay is causing some inconvenience and affecting the accuracy of certain operations within the guest.

I have taken the following steps to troubleshoot the issue:

  1. Verified with `chronyc tracking` that the host system's RTC time is accurate and synchronized with the external time source.
  2. Confirmed that the Proxmox VE Guest Agent is installed and running inside the guest. As per recommendation, NTP service is disabled in the guest. The `current_clocksource` is `kvm-clock`.
  3. Ensured that the guest's time zone configuration is correctly set.
Despite these efforts, I have been unable to resolve the time delay discrepancy. I'm wondering if there are any specific configurations, settings, or troubleshooting steps that I might have overlooked.

If anyone in the community has encountered a similar issue or has expertise in this area, I would greatly appreciate your guidance and assistance in resolving this time synchronization problem. Any suggestions, tips, or insights would be highly valuable.

Thank you all in advance for your time and support. I look forward to hearing from you and learning from your experiences.

Best regards,
 
I always run chrony or use systend-timesync in VM guests. Are you sure the recommendation you saw was for VM rather than container? You dont need separate time sync in a container because they share host time. VM is different.
 
I always run chrony or use systend-timesync in VM guests. Are you sure the recommendation you saw was for VM rather than container? You dont need separate time sync in a container because they share host time. VM is different.
In fact, after receiving the `system_clock_sync_state` alert from netdata and attempting to sync the RTC time between the host and guest, I had initially disabled NTP synchronization in the guest and opted for time synchronization solely on the host. For some reasons, Proxmox seems to be shifting the RTC time of the guest by 1 second toward the future.

In light of this discovery and your answer, I have decided to disable the netdata alert for the time being. Additionally, I will re-enable NTP synchronization in both the host and guest to ensure consistent and accurate timekeeping throughout the virtual environment.

I appreciate the support and insights from the community on this matter. Thank you for your time and valuable contributions.
 
Just for information to lurkers, the emulated RTC is only used to initialize the time, at least under Linux. Keeping time after that is done by the kernel using the high-resolution CPU timer if available else one of the regular interrupt-driven timers. This means that the RTC by itself is not relevant to any drift issues only to the time the OS starts up with.

This is true on hardware as well as in a VM. That is because a guest has a separate kernel and emulated hardware. It acts as if it is running on hardware not knowing most of it is fake. Since the emulated timer may not be as accurate as the real timer the time in a VM will tend to drift.

In a container on the other hand there is only one kernel, the host kernel. Therefore containers do not need to sync their time to the host because when you call gettimeofday() in a container it is the host kernel that returns the result. It is inherently synchronized.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!