-
Notifications
You must be signed in to change notification settings - Fork 837
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 clock becomes unsynced on Desktop system #7255
Comments
The same is true for me as well. Even after the |
Are either of you running Windows in a VM and using your hypervisor to suspend it? I explained my solution to clock sync issues with using WSL2 in a Windows guest VM using Parallels on a Mac this comment: |
No, the wsl2 host is on bare metal for me. |
No, this is on a Windows desktop system bare metal that I never sleep or hibernate, |
I updated the WSL kernel version using cabinet and msi files but the date and time was still drifting after pausing the VMWare VM which contains my Windows 10 and WSL. add these lines at the end so WSL bash runs the powershell script, syncdates,ps1 everytime WSL bash is opened.
The script syncdates.ps1 is
I then added /usr/bin/date to my sudoers file to avoid having to keep typing the password. |
Is anyone working around this in a way that doesn't require manual intervention? I'm fairly new to wsl and this is a major inconvenience. And is this somehow not affecting everyone? I'd expect an issue like this to have a lot of traction. |
Yes, this is pretty big inconvenience. It needs to be fixed. |
I see this on a Win11 on baremetal that's been configured to stay in sync by making sure w32time starts and MaxPollInterval is set, as per https://eth-docker.net/docs/Support/Windows . For anything Windows not-domain-joined, first, the host time sync needs to be fixed, as it is Terribad(tm) out of the box. From there, there's still an issue of WSL2 getting out of sync without scheduled |
/logs |
Hello! Could you please provide more logs to help us better diagnose your issue? You can find instructions on how to attach logs here, please make sure to post the link to the Feedback Hub item in this chat so we can see it. Thank you! |
@owenschupp When would be the most helpful time to gather the logs? Would it be after the PC resumes from sleep and the WSL clock is out of sync with Windows? |
@mcollier that would be a great time, thanks for bringing that up! |
i started a recording, let my surface book go to sleep, waited a few minutes, woke it up, confirmed the clock had lagged, and stopped recording. let me know if i should re-do this in a different way to be more helpful. also i'm on the beta preview build if that matters. thanks for any insight into how to get the wsl clock to stay synced! |
As I noted in OP, my scenario requires that it run for up to 24 hours before the clock skew becomes obvious. I'm not sure how to show that the clock is skewed without doing a video, but seems that would make a rather large recording. How little skew would you find compelling as a demonstration that the clock is not in sync? |
My W10 Desktop with Debian 10 WSL has been up for 3 weeks. I just updated the date/time in WSL and it was off by 28+ seconds.
The system is always up (no sleep, hibernate, etc). |
Yea the clock does not seem to ever get synced after startup. Especially putting your pc to sleep desyncs the time so much that I can't even interface with a lot of external API's which is super annoying. There are a lot more people still reporting and commenting on those issues like #5324 |
Also seeing this since I updated to Windows 11 after working fine on Windows 10. Hibernating the machine overnight means the clock will be out of sync. However interestingly, the clock is not out of sync by the amount of time the system was shut down for as one might expect. Instead, when running a command today at around ~12:45pm, running
Running Ubuntu 20.04.5 LTS with kernel 5.15.68.1-microsoft-standard-WSL2. |
Not anymore. Now the WSL clock is a half hour ahead. Update: worked for me. Adding that to crontab to run every half hour should keep you plenty synced. |
Once WSL2 supported systemd enablement I turned that on, and enabled systemd-timesyncd. To make that work I copied /lib/systemd/systemd/systemd-timesyncd.service to /etc/systemd/system and commented out this line thusly
Time seems to stay in sync and I've noticed no side effects. |
/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! |
Windows Build Number
Microsoft Windows [Version 10.0.19043.1110]
WSL Version
Kernel Version
5.10.16.3-microsoft-standard-WSL2
Distro Version
Debian 10
Other Software
No response
Repro Steps
I restarted my Desktop (a Dell box, nothing funky) 3 days ago after installing the latest WSL update. At that point, the date/time in my Debian WSL was spot on with the rest of the world.
Now, 3 days later, it's off by 7 or 8 seconds.
I tried
sudo hwclock -s
but no joy. It didn't reset the time in WSL.Expected Behavior
Clock stays in sync, or there's a reasonable workaround to keep it in sync.
Actual Behavior
Time falls behind about 2 seconds per day.
Diagnostic Logs
Filled out the info in Windows Feedback and added a screenshot of two dclocks: a blue clock running on my chrony server, and a green dclock running in WSL2 Debian. As you can see, the time in the WSL2 Debian system is 7 seconds behind reality.
The text was updated successfully, but these errors were encountered: