If you’re using WSL2 on a laptop, there are known issues with clock skew that can happen when your laptop hibernates. This can result in your WSL time and your Windows time getting out of sync and causes all kinds of issues inside Linux.
To resolve this there are two workarounds:
From inside WSL you can run the following command to re-sync with the hardware clock.
1
$ hwclock -s
Or from Windows you can just shutdown the WSL subsystem and it will automatically sync when it starts up the next time you use it.
1
C:> wsl --shutdown
Generally, I prefer #2 since it will be applied to all WSL environments in one go, and I can easily run it from Windows as part of my batch script that updates Linux in all my WSL environment. It does cause any existing WSL sessions to be terminated though, so if I’ve got a lot of sessions going I’ll just go for the first option.