Repository navigation
Description
Please use the following bug reporting template to help produce issues which are actionable and reproducible, including all command-line steps necessary to induce the failure condition. Please fill out all the fields! Issues with missing or incomplete issue templates will be closed.
If you have a feature request, please post to the UserVoice.
If this is a console issue (a problem with layout, rendering, colors, etc.), please post to the console issue tracker.
Important: Do not open GitHub issues for Windows crashes (BSODs) or security issues. Please direct all Windows crashes and security issues to [email protected]. Ideally, please configure your machine to capture minidumps, repro the issue, and send the minidump from "C:\Windows\minidump".
Please fill out the below information:
-
Your Windows build number: Microsoft Windows [Version 10.0.18917.1000]
-
What you're doing and what's happening: Attempting to run a
sudo apt updatewithin a WSL 2 installation. Seeing thing following error
[sudo] password for xander: Hit:1 https://packages.microsoft.com/repos/azure-cli bionic InRelease Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] Reading package lists... Done E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 10h 29min 48s). Updates for this repository will not be applied. E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 11h 0min 22s). Updates for this repository will not be applied.
Based on my own searching, I suspect the WSL clock may be falling out of sync with my windows machine? Though trying to cat /etc/localtime causes WSL to hang
-
What's wrong / what should be happening instead: apt should run an update with no error output
-
Strace of the failing command, if applicable: (If
some_commandis failing, then runstrace -o some_command.strace -f some_command some_args, and link the contents ofsome_command.stracein a gist here). -
For WSL launch issues, please collect detailed logs.
See our contributing instructions for assistance.
Activity
benhillis commentedon Jun 13, 2019
What do the following commands return?
date
cmd.exe /c time /t
readlink /etc/localtime
What is your Windows timezone? Any interesting errors in sudo dmesg?
salaxander commentedon Jun 13, 2019
Thanks for the reply!
The only thing that catches my eye in
sudo dmesgisbenhillis commentedon Jun 13, 2019
Interesting, not only is the hour wrong, the minutes is way off as well...
Thanks, does Ameria/Los_Angeles match your Windows time zone (Pacific)?
salaxander commentedon Jun 13, 2019
It does indeed! For what it's worth, I was also selfhosting a build with WSL 2 about a month ago (I work at Microsoft 😄), and I encountered the same issue, sorry for not reporting it to the team sooner!
trondhindenes commentedon Jun 13, 2019
Can repro. My windows computer is in CET, but WSL2 gives a completely different utc time altho
/etc/localtimeseems to be correctly set toEurope/Berlinbenhillis commentedon Jun 13, 2019
This seems to have to do with clock drift. If you shut down wsl and restart, is the problem solved?
wsl.exe --shutdown
salaxander commentedon Jun 13, 2019
That does seem to resolve the issue for now. Running
dateshows the correct time. I'm still seeing[ 0.531827] hv_utils: cannot register PTP clock: 0when running asudo dmesgthough (not sure if that's consequential or not). I'll report back if things fall out of sync again.therealkenc commentedon Jun 14, 2019
Laptop? Did it sleep? Maybe related this. WAG.
mithunshanbhag commentedon Jun 16, 2019
Running into this same issue when running
sudo apt update && sudo apt upgrade(Ubuntu 18.04 with WSL2 on windows insider build 18917.1000 on Macbook air).Definitely some clock drift issue as the date command is returning the wrong time.
Shutting down WSL2 (
wsl --shutdown) and rerunning theapt updatecommand seems to fix it for now.20 remaining items
shinebayar-g commentedon Nov 25, 2020
Another quick fix:
Working on WSL2, Ubuntu 20.04 LTS.
mcandre commentedon Dec 5, 2020
Why does WSL ntpd fail upon resuming from hibernation?
brandonh-msft commentedon Dec 16, 2020
Even better, added to
~/.bashrc:)This lost me hours of work last night as I tried to troubleshoot a mysterious auth error from Terraform as it was trying to deploy an Azure Storage Account. Shows up in the form of a "bad authorization header" error message.
SebTardif commentedon Oct 13, 2021
It's not good enough for me. I need to have a cron job that execute it each 5 minutes. Basic things are so complicated when Windows is close by.
devedse commentedon Dec 7, 2021
Hi all, I created a script that creates a scheduled task to automatically update the time of WSL when you either restore from sleep or you restore a "Saved" Hyper-V VM.
Change
Ubuntu(in both places in the script) to the name of your WSL Instance (Seewsl --list), then execute the script incmd.Thanks to all the other comments/suggestions that helped me create this script 😄 .
SerhiiRohoza commentedon Dec 22, 2022
I have the same issue on Windows 11 22H2, WSL2, Ubuntu 22.04 while updating packages:
It could be fixed with
sudo hwclock --hctosys, but it's quite annoying.matthewnourse commentedon Mar 16, 2023
This problem was killing me so a chucked a tantrum and wrote a little daemon for it:
https://github.com/matthewnourse/polite-hwclock-hctosys
I hope you find it useful.
ManuInNZ commentedon Mar 16, 2023
craigloewen-msft commentedon Apr 21, 2023
/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!
microsoft-github-policy-service commentedon Apr 21, 2023
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!
roskee commentedon Jun 6, 2023
This might occur when there is another OS dual booted on the computer. For example, there will be a 3-hour clock offset between Ubuntu and Windows dual boot setup. I used the configuration changes recommended by Leon (@leon-strong).
mcandre commentedon Aug 8, 2023
I'm not dual booting.
Why do WSL and native Windows have split clocks?
Workaround microsoft/WSL#4114