Skip to content
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

system date is not same with windows (WSL 2) #6974

Closed
1 of 2 tasks
axsaucedo opened this issue May 22, 2021 · 3 comments
Closed
1 of 2 tasks

system date is not same with windows (WSL 2) #6974

axsaucedo opened this issue May 22, 2021 · 3 comments

Comments

@axsaucedo
Copy link

Windows Build Number

Microsoft Windows [Version 10.0.19042.985]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020

Distro Version

Ubuntu 18.04

Other Software

No response

Repro Steps

As title suggests, there's drift on WSL2 distro and system clock. This causes unexpected behaviour such as incorrect date for git commits, etc. Reopening #4245 as not fixed - suggestions in this other issue are just workarounds.

More specifically, workarounds suggested are one of the following:

  • Running sudo ntpdate pool.ntp.org
  • Running sudo hwclock -s
  • Adding either of the previous to crontab (eg run every 10 mins)

To reproduce

To reproduce ause then resume the virtual machine reproduces issue (or getting laptop to go sleep)

image

Expected Behavior

System clock shouldn't drift from windows clock.

Actual Behavior

Clock drifts.

Diagnostic Logs

[ 0.335041] rtc_cmos 00:00: setting system clock to 2019-06-21 22:54:24 UTC (1561157664)
[ 0.335057] Unstable clock detected, switching default tracing clock to "global"
If you want to keep using the local clock, then add:
"trace_clock=local"
on the kernel command line

@0xbadfca11
Copy link

This has fixed, but on Insider Preview.
https://devblogs.microsoft.com/commandline/servicing-the-windows-subsystem-for-linux-wsl-2-linux-kernel/
https://docs.microsoft.com/en-us/windows/wsl/kernel-release-notes
If you want to fix it now, you need to update the kernel yourself.
https://www.catalog.update.microsoft.com/Search.aspx?q=Windows%20Subsystem%20for%20Linux

curl.exe -O http://download.windowsupdate.com/c/msdownload/update/software/updt/2021/04/wsl_update_x64_7694655b042eb3715cdc68f17da1bca6ca11f743.cab
expand.exe -R wsl_update_* .
cmd.exe /c start wsl_update_x64.msi

@therealkenc
Copy link
Collaborator

/dupe #5324

@ghost
Copy link

ghost commented May 25, 2021

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!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants