Proxmox time and Windows 2019 VM sync

zecas

Member
Dec 11, 2019
51
5
13
Hi,

I have assembled a proxmox environment where I have 3 Windows 2019 VMs running. One of them was promoted to DC, and for some reason the server time started to be off by a few minutes.

Running the command:
Code:
w32tm /query /status

Returns that the source is "Local CMOS Clock" on that DC server.

On the other VMs (not DCs), that were cloned out of this one (before DC promotion), they state that the source is "time.windows.com,0x8".

Running the command:
Code:
w32tm /dumpreg /subkey:parameters

Returns on all VMs that the property "NtpServer" is "time.windows.com,0x8". The property "Type" however, on the DC server with time sync problem, is reported as NT5DS, while for the others (non-DCs) it is NTP.

I was trying to understand where I should change what, but I'm thinking that, being a VM, the DC server that is reporting as "Local CMOS Clock" may be getting its time updates from proxmox host.

Logging into proxmox console, I checked with "date" command that it has the same time the DC server is reporting.

Am I correct to think that proxmox it the source for this time update?

How can I solve this? I mean, is proxmox getting from CMOS clock, or from an NTP server (at least a default one)?

I'm thinking that only changing the system date from command line should not be enough, as there may be some time sync that may revert the value, at least on a system restart.

My "timesyncd.conf" file was not changed from initial installation and only contains commented lines:

Code:
~# cat /etc/systemd/timesyncd.conf

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.

[Time]
#NTP=
#FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

Checking services:

Code:
~# systemctl status systemd-timedated.service

● systemd-timedated.service - Time & Date Service
   Loaded: loaded (/lib/systemd/system/systemd-timedated.service; static; vendor pres
   Active: inactive (dead)
     Docs: man:systemd-timedated.service(8)
           man:localtime(5)
           https://www.freedesktop.org/wiki/Software/systemd/timedated

Code:
~# systemctl status systemd-timesyncd.service

● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor pre
  Drop-In: /usr/lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Thu 2020-12-10 08:52:47 WET; 1 months 16 days ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 738 (systemd-timesyn)
   Status: "Idle."
    Tasks: 2 (limit: 4915)
   Memory: 1.2M
   CGroup: /system.slice/systemd-timesyncd.service
           └─738 /lib/systemd/systemd-timesyncd

Warning: Journal has been rotated since unit was started. Log output is incomplete or


Thank you for your help.
zecas
 
Could you please post your VM config, too?
Code:
qm config <vmid>
There is one option --localtime which is important for Windows. You can search the qm man page for that word.
 
Could you please post your VM config, too?
Code:
qm config <vmid>
There is one option --localtime which is important for Windows. You can search the qm man page for that word.

Hi,

This is the output from the DC server that is showing the time sync problem (it is similar to the output from another test vm server that is not DC):

Code:
~# qm config 101
bootdisk: scsi0
cores: 1
memory: 2048
name: srv01-win2019
net0: e1000=46:67:38:A3:2F:9B,bridge=vmbr0,firewall=1
numa: 0
ostype: win10
protection: 1
sata0: none,media=cdrom
scsi0: local-lvm:vm-101-disk-0,size=40G
scsi1: local-lvm:vm-101-disk-1,size=10G
scsihw: virtio-scsi-pci
smbios1: uuid=8c7bd834-1669-3b46-917c-67c151348c76
sockets: 1
usb0: spice
vmgenid: 76b24568-2b63-4885-8db4-44a7c85ab5ab
~#


From qm man page:

Code:
 --localtime <boolean>

    Set the real time clock to local time. This is enabled by default if ostype indicates a Microsoft OS.

So being a windows vm, I'm assuming that --localtime its not set, but should be defaulting to local time.


Since the windows machine is reporting the exact same time as proxmox is reporting (if I change it, it will latter on update to proxmox time again), I'm assuming that, since the setup of DC was made, the vm time is being sync with proxmox. I believe this should be the correct behavior, right?

When checking how proxmox syncs time with NTP, I found what I believe it's causing the problem, the DNS server set on my proxmox:

Code:
~# cat /etc/network/interfaces
auto lo
iface lo inet loopback

iface eno1 inet manual

auto vmbr0
iface vmbr0 inet static
        address 192.168.1.200
        netmask 255.255.255.0
        gateway 192.168.1.1
        bridge_ports eno1
        bridge_stp off
        bridge_fd 0

iface enp8s2 inet manual
~#

The DNS was somehow set to 192.168.1.1, but it is not correct (the IP doesn't even exist), it should have been set to 192.168.1.250.

So at this time, my proxmox cannot resolve any url, nor reaching any internet address. If I'm correct, this prevents proxmox from syncing time with an NTP server, which in turn syncs its incorrect time with my DC vm.

I'm probably right? right? :)

So if that's the problem, what is the preferred way to update the DNS entry? Changing /etc/network/interfaces gateway entry directly? I believe file /etc/resolv.conf must also be changed, don't know if there is any other places that must be changed or if changing it under the GUI (Host->System->DNS) will update all required files.


Thank you for your help.
zecas
 
It should be sufficient to change /etc/resolv.conf or use the GUI functions. The content of /etc/resolv.conf and the GUI fields should be the same.
 
Hi,

I have just found the solution:
Proxmox handles windows VM by setting using Local time as RTC.
In this case, your Proxmox time zone MUST match your windows timeZone.

If you want to mixte timezones in your setup, set Use local time for RTC to No, and TimeZoneInformation to RealTimeIsUniversal in your windows VMS.

as administrator run:

Bash:
reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1

and Voilà !

SOLVED.
 
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!