microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.29k stars 814 forks source link

Time sync problem #10321

Open matteokutufa opened 1 year ago

matteokutufa commented 1 year ago

Windows Version

Microsoft Windows [Versione 10.0.22621.1992]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.90.1

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

while true; do sudo ntpdate ntp1.inrim.it && sleep 60; done

Expected Behavior

Syncronization in minute should be near to 0

Actual Behavior

Time syncronization is behind more than 2 second every minute immagine

Diagnostic Logs

No response

Abhijeet-kadance commented 1 year ago

have you tried adding -q?

Naomarik commented 1 year ago

Also suffering from this, clock is constantly drifting. Have the same version numbers as OP for everything.

matteokutufa commented 1 year ago

have you tried adding -q?

It's not a command flag problem but instad a problem on Windows 11 OS (I think). I have the same version of WSL and Kernel on a Win10 machine and everything working like a charm without drifting in time syncronization on Ubuntu 22.04 WSL distribution.

Versione WSL: 1.2.5.0 Versione kernel: 5.15.90.1 Versione WSLg: 1.0.51 Versione MSRDC: 1.2.3770 Versione Direct3D: 1.608.2-61064218 Versione DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Versione di Windows: 10.0.19045.3208

image image

Abhijeet-kadance commented 1 year ago

Version are similar but still configurations must be different. I Guess!!!

mwoodpatrick commented 1 year ago

I'm seeing the same issue when running with Arch Linux on WSL-2, using ntpdate fixes the problem (sudo hwclock -s no longer works for me). Currently updating clock in my .bashrc file will create a cron job or system unit file to run this more often until issue is resolved

date
Mon Sep  4 06:22:41 PM PDT 2023
mwoodpatrick@westie_arch:/mnt/wsl/projects/git/home/.config/bash (master)$ sudo ntpdate time.windows.com
 5 Sep 04:38:57 ntpdate[1860221]: step time server 168.61.215.74 offset +36880.214567 sec

My version info:

WSL version: 1.3.17.0
Kernel version: 5.15.90.4-1
WSLg version: 1.0.57
MSRDC version: 1.2.4485
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25880.1000-230602-1350.main
Windows version: 10.0.22631.2265
mwoodpatrick commented 1 year ago

I am running archlinux and ended up installing systemd-timesyncd

webstean commented 1 year ago

This has been a bug for years!! Surely it should be the job of the WSL to keep time properly across distributions

discotimetraveler commented 8 months ago

I am dealing with this issue and I agree with @matteokutufa this must be specific to Windows 11. I used WSL1 and 2 on a corporate Windows 10 machine for years and never experienced this. Now using WSL2 on a Windows 11 machine (fresh install even) and every time the system sleeps and I return, WSL time is off. I've updated wsl and Ubuntu and still continues to happen. I've seen in other threads this issue is allegedly fixed but it is not.

PS C:\Users> wsl --version WSL version: 2.0.14.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.3007

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy

This is on an Intel NUC11 that has the latest firmware.