Skip to content

WSL2 date incorrect after waking from sleep #5324

Closed

Description

  • Your Windows build number (run ver at a Windows Command Prompt), your distribution (f.e. on Debian/Ubuntu run lsb_release -r), and whether the issue manifests on WSL 2 and/or WSL 1 (cat /proc/version):

Windows: version 2004, build 19041.264
Distro: Ubuntu 18.04
Issue manifests only on WSL2 (Linux version 4.19.84-microsoft-standard)

  • What you're doing and what's happening. Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screenshots if that helps demonstrate the problem:

I upgraded an Ubuntu 18.04 WSL1 instance to WSL2. Ever since then, the date does not advance when the machine is asleep or hibernating. To repro:

  • Install Ubuntu 18.04
  • Check that Windows system date is correct
  • Check that date is correct (use date command in WSL2)
  • Put laptop to sleep for a while
  • Resume from sleep
  • Check Windows date: correct
  • Check WSL2 date: wrong, still where it was when machine went to sleep
  • Wait a while to see if it auto-corrects
  • Notice that it doesn't

What's wrong / what should be happening instead:

  • Date does not update after sleep. It should be correct after resume, as it was in WSL1.

Note that there was a previous issue on this topic, #4245 which is now closed, I'm not sure why; it was recommended there by @therealkenc that I open a new issue.

There are temporary workarounds; if I use sudo hwclock -s or shut down the WSL2 VM with wsl --shutdown and restart, the time is correct, until the next sleep/hibernate.

As noted in various other issues on this topic (#5184, #4975, #4677 etc.), the time being incorrect is more than a minor inconvenience. It can cause trouble with apt install, validity of SSL certs, build problems, and many other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions