-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL2 date incorrect after waking from sleep #8204
Comments
I'm noticing the same thing. For me, WSL2 time was in sync with the Windows time until I updated to use the Windows Store version of WSL. Now, whenever my PC resumes from sleep, the WSL2 time is minutes to hours behind. To "fix", I will Default Distribution: Ubuntu-20.04 |
Yes, this is a regression bug after I updated to the latest Win11 beta push. I also found an earlier bug of the same nature #5324 |
Same for me (Ubuntu 20.04) WSL version: 0.56.2.0 |
same error; for me, this is not related system going to sleep, the clock is desynchronizing even if my terminal is in the background.
|
Also seeing this here on ARM64 with the latest Win11 insiders beta build and latest WSL2 kernel:
Somewhat more annoying is that the usual workaround
|
This is a really annoying issue! It blocks any application you're developing with Auth function; you'll get this error message:
wsl datetime is totally out of sync with System datetime
|
Found a workaround, set up a Windows scheduled task to update Ubuntu datetime when machine wake up from sleep. |
It looks like this is fixed in release https://github.com/microsoft/WSL/releases/tag/0.65.1! EDIT: EDIT2: Is there anything that need to be done to configure this to make it work? |
Created a function which I can call at my convenience: update_clock () {
echo '[ROOT] Updating clock (sudo hwclock --hctosys)'
sudo hwclock -s
sudo ntpdate time.windows.com
} Since, |
|
Not sure if it helps, but I hadn't experienced this problem for a while after the original bug was fixed (back when |
@heaths what version do you have exactly? I upgraded recently both Windows and my WSL but I still get out of sync clock when restoring my session from sleep/hibernate. My versions:
|
I still loose clock sync with |
|
I'm still losing sync, now with: WSL version: 0.70.0.0 |
Same issue here, date and time out of sync after sleep. WSL version: 0.70.0.0 |
Same.
|
Same
|
This is a constant friction when trying to develop inside WSL2. Running make, clock skew warnings clog the build output. |
I agreee, it sucks. I get all sorts of strange errors due to the clock being incorrect. Sometimes the clipboard hangs, sometimes I can't connect to internet, and sometimes Imagine you could do the same thing with the physical REAL time. Rewind the time and rewrite history! That'd be really COOL! |
with systemd now available i've installed ntp as a workaround and just restart the service after sleep. still annoying though. |
In practice, the patch made things (much) worse... |
Same here with 1.0.0.0
|
I worked around this by configuring the First you have to enable Set the systemd flag set in your WSL distro settings Add these lines to the
And close out of the nano editor using CTRL+O to save and CTRL+X to exit. Now close your WSL distro windows and run Now install
In the second step, when editing, add the two lines beginning with Now start it:
Check status with:
|
That seems to work for me! I automated the configuration in our setup script with this:
|
What are the downsides to running systemd? While I used linux almost exclusively many, many years ago, that predates systemd and all I've seen around the net is hate but haven't really seen why. |
This is ridiculous. WSL2 was set as future approach and this one year old, pretty serious bug is still there.
|
I think I have a way of reliably reproducing this if anyone from the Microsoft Linux kernel team is watching this thread. The key seems to be running WSL2 inside Windows itself running in a Hyper-V VM. Running directly on a Windows host doesn't have the problem. In my problematic case, it's WSL2 running in a Windows 10 VM inside a Windows 11 host. WSL2 kernel and windows are all updated to the latest. Perhaps something is getting lost in the VM inside an VM scenario? When I get some time, I will try to reproduce this on another machine with this VM inside a VM scenario. Feel free to contact me if any traces/logs are needed. |
I had this issue under Windows 11 on a laptop. For a solution see #8204 (comment) |
Yes, thanks, I did see that. Not sure of Windows 11 is a factor. I haven't seen the issue on a Windows 10 laptop with WSL2 running directly on it. I'm hoping the kernel or VM team can address this issue so folks don't need to look for workarounds. |
I am having this issue since moving to Windows 11. Using a fresh install of Win 11, WSL, Oracle Linux 7.9. Every time the host sleeps, the time skews out. Here's an example:
And right now, can't implement Chrony or anything similar to #8204 (comment) due to #9961 :( :( :( |
/dupe #10006 We're migrating all clock skew issues to a megathread so we can keep the top comment up to date with any updates and work arounds. Thank you for filing this! |
Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! |
I'm having this issue also. C:\Users\rebroad>wsl -v |
I use the following to fix the problem now: sudo apt install chrony sudo systemctl restart chrony.service You do need to install systemd by adding the following lines to [boot] systemd=true |
I have this problem. |
Why is this issue closed, I still have this problem every day
|
It was closed, and a new bug opened, because people kept posting workarounds here (the problem itself needs to be fixed, not worked around). See: #8204 (comment) |
@dboreham, then let's get on it, Microsoft!!! This is insane, over a year people have been complaining |
I'm also experiencing this. WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2283 |
Do we need to start it manually every time we open WSL?
What's the expected result of these commands? When I run them they give me a bunch of information but it's unclear if they have any effect:
|
this breaks opening vscode from wsl with |
@simonerlandsen I'm not seeing that in Ubuntu: |
No
Just to be sure everything is running. Looks good in your case. Just check the WSL time once in awhile to verify its correct. |
Okay, I guess it's not universal, but others has the same issue as me with it, so fair warning I have Ubuntu as well btw |
It's closed because it's marked as a duplicate. I'm locking this thread. |
Version
Microsoft Windows [Version 10.0.22581.100]
WSL Version
Kernel Version
5.10.102.1
Distro Version
Release: 20.04
Other Software
No response
Repro Steps
Expected Behavior
WSL 2 date should be the same as Windows date.
Actual Behavior
WSL 2 date is way behind and slower than the Windows date.
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: