Skip to main content

WSL 2 date incorrect

· One min read
Stephan Hochdörfer

There is an issue with WSL 2 where the clock in a WSL 2 instance isn't updated when the host resumes from sleep/hibernate. This can lead to problems when you want to install Linux packages or when creating or modifying files in general.

There have been numerous attempts to fix it, but it seems the issue is still around for certain people. The “hack” that is working for me for about a year, is using the solution outlined in this GitHub repo: https://github.com/stuartleeks/wsl-clock

The workaround is to create a scheduled task that is triggered by Windows Events for resuming from sleep/hibernation. When the scheduled task executes it does reset the clock in the WSL 2 instance. If you keep running into this issue, you might want to give this a try.