3

I'm posting my problem here because even with all the post I could read to fix this, the w32tm still give me the same error message when trying to synchronize the computer time with a local NTP server (which is a PLC).

Here's a quick explanation of the situation :

We have a PC with a "Windows 10 IoT Enterprise 2019" image installed that must be synchronized with the clock of a PLC of the customer.

We are trying to use the w32tm (Windows Time service) because it must be parametrizable via console commands that will be interfacing through a web page.

Everytime we try to make a w32tm /resync, we have this error : "The computer did not resync because no time data was available" even if we use the /force or /nowait parameters.

If we check the logs of this service, we find this error that seems to delete the packet received :

"Packet test 6 failed (not syncd or bad interval since last sync). - Ignoring packet that failed tests from 172.28.134.229,0x8 (ntp.m|0x8|0.0.0.0:123->172.28.134.229:123)."

I can ping the PLC, and if we use an external synchronization tool that use his own service instead of Windows Time, it works perfectly (but as explained before, we must interface this NTP settings with console command so it's not a good final solution).

We used Wireshark to read all the packets exchange between the PLC and the PC. The thing is that the packets are the same independing of the tool used (w32tm or the external tool). This is always the same packet content with the correct timestamp to use etc...

Here are the multiple solutions I tried :

  • Checking the group policies of Windows Time --> They are all on "Not configured"

  • The firewall is not blocking any NTP packets (port 123)

  • Did all of these command :

net stop w32time w32tm /unregister reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\VMICTimeProvider /v Enabled /t reg_dword /d0 w32tm /register net start w32time w32tm /config/manualpeerlist:"172.28.134.229,0x8" /syncfromflags:manual/reliable:yes/update w32tm /resync net stop w32time net start w32time w32tm /resync

I tried all the flags "0x1, 0x4, 0x8, 0x9" and even deleted the quote.

I also tried :

w32tm /config /syncfromflags:domhier /update

w32tm /resync

I checked the parameters of the registers (regedit) and they are set to NTP with the correct IP address.

I also tried with NT5DS and "NoSync" but no success.

Here are the configurations read with the w32tm /query commands :

C:\Windows\system32>w32tm.exe /config /syncfromflags:manual /manualpeerlist:172.28.134.229,0x8 /reliable:yes /update
The command completed successfully.


C:\Windows\system32>w32tm /query /peers
#Peers: 1

Peer: 172.28.134.229,0x8
State: Active
Time Remaining: 990.8006238s
Mode: 3 (Client)
Stratum: 0 (unspecified)
PeerPoll Interval: 0 (unspecified)
HostPoll Interval: 10 (1024s)


C:\Windows\system32>w32tm /query /status
Leap Indicator: 0(no warning)
Stratum: 1 (primary reference - syncd by radio clock)
Precision: -23 (119.209ns per tick)
Root Delay: 0.0000000s
Root Dispersion: 10.0000000s
ReferenceId: 0x4C4F434C (source name:  "LOCL")
Last Successful Sync Time: 23/04/2021 13:59:08
Source: Local CMOS Clock
Poll Interval: 10 (1024s)


C:\Windows\system32>w32tm /query /configuration
[Configuration]

EventLogFlags: 2 (Local)
AnnounceFlags: 5 (Local)
TimeJumpAuditOffset: 28800 (Local)
MinPollInterval: 10 (Local)
MaxPollInterval: 15 (Local)
MaxNegPhaseCorrection: 54000 (Local)
MaxPosPhaseCorrection: 54000 (Local)
MaxAllowedPhaseOffset: 1 (Local)

FrequencyCorrectRate: 4 (Local)
PollAdjustFactor: 5 (Local)
LargePhaseOffset: 50000000 (Local)
SpikeWatchPeriod: 900 (Local)
LocalClockDispersion: 10 (Local)
HoldPeriod: 5 (Local)
PhaseCorrectRate: 1 (Local)
UpdateInterval: 360000 (Local)


[TimeProviders]

NtpClient (Local)
DllName: C:\Windows\SYSTEM32\w32time.DLL (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)
AllowNonstandardModeCombinations: 1 (Local)
ResolvePeerBackoffMinutes: 15 (Local)
ResolvePeerBackoffMaxTimes: 7 (Local)
CompatibilityFlags: 2147483648 (Local)
EventLogFlags: 1 (Local)
LargeSampleSkew: 3 (Local)
SpecialPollInterval: 32768 (Local)
Type: NTP (Local)
NtpServer: 172.28.134.229,0x8 (Local)

NtpServer (Local)
DllName: C:\Windows\SYSTEM32\w32time.DLL (Local)
Enabled: 0 (Local)
InputProvider: 0 (Local)



C:\Windows\system32>w32tm /resync
Sending resync command to local computer
The computer did not resync because no time data was available.

And here are the logs from the w32tm :

153514 12:12:08.7993597s - | OriginateTimestamp:   0xE42D3818CB35B91F - 13263653528793788500ns - 153514 12:12:08.7937885s
153514 12:12:08.7993921s - | ReceiveTimestamp:     0xE42D3819170A3D70 - 13263653529090000000ns - 153514 12:12:09.0900000s
153514 12:12:08.7994267s - | TransmitTimestamp:    0xE42D3819170A3D70 - 13263653529090000000ns - 153514 12:12:09.0900000s
153514 12:12:08.7994635s - >-- Non-packet info:
153514 12:12:08.7994818s - | DestinationTimestamp: 153514 12:12:08.7994963s - 0xE42D3818CBCBBA7E153514 12:12:08.7995103s -  - 13263653528796077400ns153514 12:12:08.7995263s -  - 153514 12:12:08.7960774s
153514 12:12:08.7995467s - | RoundtripDelay: 2288900ns (0s)
153514 12:12:08.7995746s - | LocalClockOffset: 295067000ns - 0:00.295067000s
153514 12:12:08.8015152s - \--
153514 12:12:08.8020609s - ListeningThread STC:717682
153514 12:12:08.8021869s - Packet test 6 failed (not syncd or bad interval since last sync).
153514 12:12:08.8022403s - Ignoring packet that failed tests from 172.28.134.229,0x8 (ntp.m|0x8|0.0.0.0:123->172.28.134.229:123).
153514 12:12:23.2930188s - W32TmServiceMain: timeout
153514 12:12:23.2937795s - Sample Prepared at 132636535432937200 for peer 172.28.134.229,0x8 (ntp.m|0x8|0.0.0.0:123->172.28.134.229:123)
153514 12:12:23.2938670s - ** NTP sample vector is empty.
153514 12:12:23.2939470s - No new NTP sample is available.
153514 12:12:23.2940151s - UpdateTimerQueue1: TN:112282810000::: LRT:104334530000  LUT:112122810000 LAFLTNS:160000000 TSLGT:160006702 LTNS:864000000000
153514 12:12:23.2940663s - W32TmServiceMain: waiting 1024.000s
153514 12:12:23.2941588s - Triggering re-read of configuration
153514 12:12:23.2950225s - RPC Call - Query Status
153514 12:12:23.2950599s - W32TmServiceMain: Param change notification
153514 12:12:23.2951580s - RPC Call - Query Configuration
153514 12:12:23.2952419s - RPC Call - Query Provider Configuration
153514 12:12:23.2952967s - TimeProvCommand([NtpClient], TPC_Query) called.
153514 12:12:23.2953598s - RPC Call - Query Provider Configuration
153514 12:12:23.2960078s - ReadConfig: Found provider 'NtpClient':
153514 12:12:23.2972157s - ReadConfig:   'InputProvider'=0x00000001
153514 12:12:23.2973229s - ReadConfig:   'MetaDataProvider'=0x00000000
153514 12:12:23.2973894s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2974384s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2974854s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2975555s - ReadConfig: Found provider 'NtpServer':
153514 12:12:23.2976585s - ReadConfig:   'InputProvider'=0x00000000
153514 12:12:23.2977217s - ReadConfig:   'MetaDataProvider'=0x00000000
153514 12:12:23.2977861s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2978341s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2978805s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2979806s - ReadConfig: Found provider 'VMICTimeProvider':
153514 12:12:23.2980822s - ReadConfig:   'InputProvider'=0x00000001
153514 12:12:23.2981444s - ReadConfig:   'MetaDataProvider'=0x00000000
153514 12:12:23.2982194s - ReadConfig:   'DllName'='C:\Windows\System32\vmictimeprovider.dll'
153514 12:12:23.2984498s - ReadConfig:   'DllName'='C:\Windows\System32\vmictimeprovider.dll'
153514 12:12:23.2985230s - ReadConfig:   'DllName'='C:\Windows\System32\vmictimeprovider.dll'
153514 12:12:23.2988793s - ReadConfig: 'PhaseCorrectRate'=0x00000001 (2)
153514 12:12:23.2989981s - ReadConfig: 'UpdateInterval'=0x00057E40 (2)
153514 12:12:23.2990612s - ReadConfig: 'FrequencyCorrectRate'=0x00000004 (2)
153514 12:12:23.2991230s - ReadConfig: 'PollAdjustFactor'=0x00000005 (2)
153514 12:12:23.2991877s - ReadConfig: 'LargePhaseOffset'=0x02FAF080 (2)
153514 12:12:23.2992474s - ReadConfig: 'SpikeWatchPeriod'=0x00000384 (2)
153514 12:12:23.2993069s - ReadConfig: 'HoldPeriod'=0x00000005 (2)
153514 12:12:23.2993674s - ReadConfig: 'MinPollInterval'=0x0000000A (2)
153514 12:12:23.2994285s - ReadConfig: 'MaxPollInterval'=0x0000000F (2)
153514 12:12:23.2994909s - ReadConfig: 'ClockHoldoverPeriod'=0x0000C350 (2)
153514 12:12:23.2995529s - ReadConfig: 'AnnounceFlags'=0x00000005 (2)
153514 12:12:23.2996139s - ReadConfig: 'LocalClockDispersion'=0x0000000A (2)
153514 12:12:23.2996766s - ReadConfig: 'MaxNegPhaseCorrection'=0x0000D2F0 (2)
153514 12:12:23.2997412s - ReadConfig: 'MaxPosPhaseCorrection'=0x0000D2F0 (2)
153514 12:12:23.2998337s - ReadConfig: 'EventLogFlags'=0x00000002 (2)
153514 12:12:23.2998984s - ReadConfig: 'MaxAllowedPhaseOffset'=0x00000001 (2)
153514 12:12:23.2999717s - ReadConfig: 'UtilizeSslTimeData'=0x00000001 (2)
153514 12:12:23.3000346s - ReadConfig: 'ClockAdjustmentAuditLimit'=0x00000320 (2)
153514 12:12:23.3000988s - ReadConfig: 'TimeJumpAuditOffset'=0x00007080 (2)
153514 12:12:23.3001792s - Clock adjustment info: dwCurrentSecPerTick: 156250 dwDefaultSecPerTick: 156250 bSyncToCmosDisabled:1
153514 12:12:23.3002293s - PerfFreq:10000000c/s
153514 12:12:23.3002816s - currAdj:10000000 Incr:10000000 IncrEnabled:1
153514 12:12:23.3017975s -   No params changed for local clock.
153514 12:12:23.3018766s - /--TimeProvider: new enabled provider list
153514 12:12:23.3019546s - | Name:NtpClient, Started:0, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3020198s - | Name:VMICTimeProvider, Started:0, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\System32\vmictimeprovider.dll
153514 12:12:23.3020668s - >--
153514 12:12:23.3021157s - | Total:2, Input: 2, Marked: 0
153514 12:12:23.3021618s - \--
153514 12:12:23.3022097s - /--TimeProvider: Parameter change before list is updated
153514 12:12:23.3022637s - | Name:NtpClient, Started:1, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3023098s - >--
153514 12:12:23.3023578s - | Total:1, Input: 1, Marked: 0
153514 12:12:23.3024034s - \--
153514 12:12:23.3024507s - /--TimeProvider: new disabled provider list
153514 12:12:23.3025036s - | Name:NtpServer, Started:0, Input:0, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3025495s - >--
153514 12:12:23.3025973s - | Total:1, Input: 0, Marked: 0
153514 12:12:23.3026427s - \--
153514 12:12:23.3026901s - /--TimeProvider: Parameter change before list is updated
153514 12:12:23.3027435s - | Name:NtpServer, Started:0, Input:0, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3027910s - >--
153514 12:12:23.3028391s - | Total:1, Input: 0, Marked: 0
153514 12:12:23.3028853s - \--
153514 12:12:23.3029456s - TimeProvCommand([NtpClient], TPC_UpdateConfig) called.
153514 12:12:23.3035085s - ReadConfig: 'AllowNonstandardModeCombinations'=0x00000001 (2)
153514 12:12:23.3035803s - ReadConfig: 'CompatibilityFlags'=0x80000000 (2)
153514 12:12:23.3036445s - ReadConfig: 'SpecialPollInterval'=0x00008000 (2)
153514 12:12:23.3037071s - ReadConfig: 'ResolvePeerBackoffMinutes'=0x0000000F (2)
153514 12:12:23.3037693s - ReadConfig: 'ResolvePeerBackoffMaxTimes'=0x00000007 (2)
153514 12:12:23.3038323s - ReadConfig: 'EventLogFlags'=0x00000001 (2)
153514 12:12:23.3038952s - ReadConfig: 'LargeSampleSkew'=0x00000003 (2)
153514 12:12:23.3039722s - ReadConfig: 'SignatureAuthAllowed'=0x00000001 (2)
153514 12:12:23.3040458s - ReadConfig: 'Type'=NTP (2)
153514 12:12:23.3041173s - ReadConfig: 'NtpServer'=172.28.134.229,0x8 (2)
153514 12:12:23.3042074s - ReadConfig: 'ManualPeerList'(parsed)='172.28.134.229,0x8'
153514 12:12:23.3042832s - ReadConfig: 'MinPollInterval'=0x0000000A (2)
153514 12:12:23.3043476s - ReadConfig: 'MaxPollInterval'=0x0000000F (2)
153514 12:12:23.3043993s - Poll interval settings: MinPollInterval:10 MaxPollInterval:15
153514 12:12:23.3044728s - NTP client telemetry enabled: 0
153514 12:12:23.3049786s -   ManualPeerListUpdate: add:0 del:0 noch:1
153514 12:12:23.3055288s - StartListeningThread completed!
153514 12:12:23.3056254s - PeerPollingThread: waiting 497.492s
153514 12:12:23.3056982s - StartPeerPollingThread completed!
153514 12:12:23.3062014s - Starting 'VMICTimeProvider', dll:'C:\Windows\System32\vmictimeprovider.dll'
153514 12:12:23.3199766s - LoadLibrary
153514 12:12:23.3201254s - Logging Info: Time provider 'VMICTimeProvider' indicated that the current operating environment is unsupported and has stopped. This is expected for VMIC provider in non-Hyperv environments. This may be the expected behavior for the current provider in the current operating environment as well. error:-2147024846
153514 12:12:23.3242933s - Discarding provider 'VMICTimeProvider'.
153514 12:12:23.3243877s - RemoveProviderFromList: VMICTimeProvider
153514 12:12:23.3244382s - /--TimeProvider: Provider list after the provider is actually removed
153514 12:12:23.3244921s - | Name:NtpClient, Started:1, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3245383s - >--
153514 12:12:23.3245879s - | Total:1, Input: 1, Marked: 0
153514 12:12:23.3246336s - \--
153514 12:12:23.3246865s -   Provider list: 0 stopped, 0 started, 1 not changed.
153514 12:12:23.3247354s - /--TimeProvider: Parameter change after list is updated
153514 12:12:23.3247893s - | Name:NtpClient, Started:1, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3248543s - >--
153514 12:12:23.3249166s - | Total:1, Input: 1, Marked: 0
153514 12:12:23.3249733s - \--
153514 12:12:23.3250806s - RPC Call - Query Configuration
153514 12:12:23.3252165s - RPC Call - Query Provider Configuration
153514 12:12:23.3252760s - TimeProvCommand([NtpClient], TPC_Query) called.
153514 12:12:23.3253381s - RPC Call - Query Provider Configuration
153514 12:12:23.3255358s - UpdateTimerQueue1: TN:112283120000::: LRT:104334530000  LUT:112122810000 LAFLTNS:160021737 TSLGT:160021737 LTNS:864000000000
153514 12:12:23.3255909s - W32TmServiceMain: waiting 1023.998s

As i'm struggling with this since few weeks now, do you have any idea on how to solve this issue ?

This is a really important feature for this application and we can't provide the PC to the customer if this doesn't work.

Thank you in advance for you reply.

Best Regards.

LL-PxC
  • 31
  • 1
  • 2
  • Are you still looking for a solution? If yes, why are you adding the announce flag to the IP address? I do no see this listed in MS's info page on w32Time, nor should it be relevant as your pc is not announcing itself as a time server, or is it? The log line at 153514 12:12:23.3041173s clearly shows that it includes this flag as part of the IP address, which will never work. – Ronny D'Hoore Jul 28 '22 at 10:21

4 Answers4

1

In the commandblock after "Here are the configurations read with the w32tm /query commands :" one of the lines the w32tm /query /status command returns, is:

Source: Local CMOS Clock

which means that your operating system is not using the Time Service. It takes the date and time from the built-in cmos clock.

I suggest:

w32tm.exe /config /update /manualpeerlist:"time1.google.com time2.google.com time3.google.com time4.google.com" /syncfromflags:manual

sc.exe stop w32time 

sc.exe start w32time

w32tm.exe /resync
Victor
  • 11
  • 3
0

The easiest solution is the installation of the pool.ntp.org.

The installation of the pool.ntp.org time server is recommended by the manual by the following command :

w32tm /config /update /manualpeerlist:"0.pool.ntp.org,0x8 1.pool.ntp.org,0x8 2.pool.ntp.org,0x8 3.pool.ntp.org,0x8" /syncfromflags:MANUAL

The additional information you can find here: https://support.ntp.org/bin/view/Support/WindowsTimeService

shalitha senanayaka
  • 1,905
  • 20
  • 37
0

In my case, the issue seems to be related to my "Ubuntu 22 / Windows 11" dual boot configuration!

Whenever I shutdown my Windows and restart it, time sync is OK.
But when I do the following sequence:

  1. Shutdown Windows
  2. Boot Ubuntu
  3. Shutdow Ubuntu
  4. and finally boot Windows again

then Windows time sync is in trouble!

My workaround is to create a Scheduled Windows Task wich gets executed, with admin rights, every time I log into Windows.

This scheduled task consist in a bat file :

Rem run as administrator
@echo on & @setlocal enableextensions
@echo =========================
@echo Turn off the time service
net stop w32time
@echo ======================================================================
@echo Set the SNTP (Simple Network Time Protocol) source for the time server
w32tm /config /syncfromflags:manual /manualpeerlist:"time.windows.com time.google.com server 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org"
@echo =============================================
@echo ... and then turn on the time service back on
net start w32time
@echo =============================================
@echo Tell the time sync service to use the changes
w32tm /config /update
@echo =======================================================
@echo Reset the local computer's time against the time server
w32tm /resync /rediscover
@endlocal & @goto :EOF

original source here: https://gist.github.com/thedom85/dbeb58627adfb3d5c3af

So, whenever I boot windows after Ubuntu, I see that time is wrong (- 2 hours), but, after a few secodns, time is correct, i.e., the Scheduled task did its job :-)

Notes:

  1. As you can see in the batch file, I am using Windows default time server time.windows.com but I also added fallback ntp servers: time.google.com server 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org
  2. FYI, before setting up this workaround, I tried many solutions, including replacing the CMOS clock battery...
Pascal
  • 15,257
  • 2
  • 52
  • 65
-1

I got a similar problem, but my ntp server is a Windows PC behind a firewall, without a connection to the internet or an other "master" ntp server. If I tried to sync a client from the server with w32tm /resync, I got always:

Unable to sync time - The computer did not resync because no time data was available

The problem was the status of the ntp server: It wasn't synchronised, therefore it doesn't provide times to the clients. I have to enable the "LocalNTP" parameter in the registry of the server:

Found here: https://techlibrary.hpe.com/docs/otlink-wo/How-to-Configure-a-Local-NTP-Server.html

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters

Enter a new parameter LocalNTP (DWORD) with value 1.

And also set the AnnounceFlags to 5 in:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config

So make sure, that the status of the ntp server on the PLC is "synchronized". It's not a problem of the ntp client on the windows machine, it's the ntp server on the PLC.

Mike969
  • 39
  • 6