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

Release file for repository is not valid yet #4114

Closed
salaxander opened this issue Jun 13, 2019 · 39 comments
Closed

Release file for repository is not valid yet #4114

salaxander opened this issue Jun 13, 2019 · 39 comments
Assignees
Labels

Comments

@salaxander
Copy link

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 secure@microsoft.com. 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 update within 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_command is failing, then run strace -o some_command.strace -f some_command some_args, and link the contents of some_command.strace in a gist here).

  • For WSL launch issues, please collect detailed logs.

See our contributing instructions for assistance.

@benhillis
Copy link
Member

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
Copy link
Author

salaxander commented Jun 13, 2019

Thanks for the reply!

~ date 
Wed Jun 12 19:29:19 PDT 2019 
~ cmd.exe /c time /t
 '\\wsl$\Ubuntu\home\xander'
CMD.EXE was started with the above path as the current directory. 
UNC paths are not supported.  Defaulting to Windows directory.
09:14 AM
~ readlink /etc/localtime
 /usr/share/zoneinfo/America/Los_Angeles

The only thing that catches my eye in sudo dmesg is

[    0.606657] hv_utils: cannot register PTP clock: 0

@benhillis
Copy link
Member

benhillis commented 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
Copy link
Author

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
Copy link

Can repro. My windows computer is in CET, but WSL2 gives a completely different utc time altho /etc/localtime seems to be correctly set to Europe/Berlin

@benhillis
Copy link
Member

This seems to have to do with clock drift. If you shut down wsl and restart, is the problem solved?

wsl.exe --shutdown

@salaxander
Copy link
Author

That does seem to resolve the issue for now. Running date shows the correct time. I'm still seeing [ 0.531827] hv_utils: cannot register PTP clock: 0 when running a sudo dmesg though (not sure if that's consequential or not). I'll report back if things fall out of sync again.

@therealkenc
Copy link
Collaborator

Laptop? Did it sleep? Maybe related this. WAG.

@benhillis benhillis added wsl2 Issue/feature applies to WSL 2 and removed needs-attention labels Jun 14, 2019
@benhillis benhillis self-assigned this Jun 14, 2019
@mithunshanbhag
Copy link

mithunshanbhag commented 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 the apt update command seems to fix it for now.

@salaxander
Copy link
Author

Yeah this does seem to be a re-occurring thing for me, running a shutdown is a quick fix though. Feel free to let me know if there's any more data that I can provide!

@akalipetis
Copy link

You could also try sudo hwclock -s, which does not need a restart of the underlying VM.

@leon-strong
Copy link

apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update

will work around it temporarily.

@xitos2019
Copy link

i am getting below error i dont kow how to fix this i am running on WSL1. any suggestion would be appreciable

Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [49.3 kB]
Get:2 http://security-cdn.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]
Reading package lists...
E: Release file for http://deb.debian.org/debian/dists/buster-updates/InRelease is not valid yet (invalid for another 2d 7h 51min 12s). Updates for this repository will not be applied.
E: Release file for http://security.debian.org/debian-security/dists/buster/updates/InRelease is not valid yet (invalid for another 1d 12h 25min 46s). Updates for this repository will not be applied.
ERROR: Service 'php-fpm-7.2' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y apt-transport-https ca-certificates && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

@giggio
Copy link

giggio commented Apr 26, 2020

I used to have this problem with Docker for Windows. Whenever the machine hibernated, when it came back I had to go to Hyper-v Manager and disable and reenable Time sync, than it would be back to regular time.
I'm pretty sure this is the same problem, it is happening to me in exactly the same pattern: whenever the computer hibernates. I'm on WSL 2.
I can confirm that sudo hwclock -s fixes it, but this should come in the box.
This did not happen before when this wsl instance was on WSL 1.

@gsusI
Copy link

gsusI commented Apr 28, 2020

Still happening:

  • Microsoft Windows [Version 10.0.19041.208]
  • Happens when running sudo apt-get update on WSL2 Ubuntu 18.04

Solution (workaround): sudo hwclock --hctosys, as suggested here.

Output:

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://packages.cloud.google.com/apt gcsfuse-bionic InRelease
Hit:5 http://packages.cloud.google.com/apt cloud-sdk InRelease
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Reading package lists... Done
E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 7h 34min 8s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease is not valid yet (invalid for another 7h 35min 30s). Updates for this repository will not be applied.
E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 7h 33min 8s). Updates for this repository will not be applied.

@pcolmer
Copy link

pcolmer commented Jun 4, 2020

The big problem with wsl --shutdown is that it also affects Docker if that is installed.

@pofl
Copy link

pofl commented Jun 6, 2020

This bug has given me HUGE frustration.

I'm coming off of two days of hunting a bug. I was trying to interact with Google BigQuery from code running inside a docker container. And I couldn't for the life of me find out why on earth I can't authenticate. For the longest time I thought the problem was introduced during the latest library update.

But how the hell am I supposed to think of the possibility that the problem is in fact that during authentication you need a correct clock otherwise during the request of a token you get an error response because a fucked up timer fucks up the expiry mechanism. Two days of my working life gone! Oh the hours I have spent trying to debug the library. fml.

How is this stupid bug not fixed a whole year later? I'm sorry for the language, but this has just been so frustrating.
This issue is tagged "workaround available". Screw that! That is so ironic. Just because the apt update command immediately complains and you can easily fix it by restarting WSL, doesn't mean this bug isn't a PITA in times when it's completely unobvious that weird behavior is unrelated to the system clock.

@prairiewolf-by
Copy link

Guys, please, help!
HOW TO FIX THIS ***********N BUG???
None of recipes above work! :(
Cannot proceed with my task as I am permanently stopped by this.

Moreover, I am thinking of returning to WSL1 if that will be possible.

OS: Windows 2004 (build 19041.329) Pro.

@pcolmer
Copy link

pcolmer commented Jun 20, 2020

A couple of points to add to this:

  1. This clearly doesn't just affect apt-get. For example, I use AWS on my Ubuntu system and, if the clock is wrong, then the authentication phase succeeds but the use of the obtained authorisation tokens then fails.

  2. This might not just affect systems that have gone to sleep or hibernated. I shut down my Windows 10 system at the end of every day and, since finding this issue, I've been very careful to check the date on the Ubuntu WSL system when I start it, and it is always wrong. I don't know if that is because shutdown on Windows 10 might not be a "full" shutdown though? I seem to remember reading something about Windows not doing full shutdowns by default to make it faster, so maybe my system is hibernating after all?

@leon-strong
Copy link

https://github.com/stuartleeks/wsl-clock is quite a clever work around.

@bartr
Copy link

bartr commented Jul 5, 2020

None of the above worked for me, but putting this in my WSL .bashrc is working so far (you have to apt install ntpdate). I run it in the background because it takes 7-10 seconds to run. hth

sudo ntpdate ntp.ubuntu.com &

@leiless
Copy link

leiless commented Jul 14, 2020

None of the above worked for me, but putting this in my WSL .bashrc is working so far (you have to apt install ntpdate). I run it in the background because it takes 7-10 seconds to run. hth

sudo ntpdate ntp.ubuntu.com &

Worked for me, which we should first sudo apt install ntpdate
Another better way can be found at https://askubuntu.com/a/1168885

@ManuInNZ
Copy link

ManuInNZ commented Aug 6, 2020

Confirmed that on Win 10 WSL 2 I had to use the following after hibernation:

 wsl -d docker-desktop hwclock -s

Cheers
Manu

@benmccann
Copy link

I think this is a duplicate of #5324

@ManouchehrRasoulli
Copy link

Guys, please, help!
HOW TO FIX THIS ***********N BUG???
None of recipes above work! :(
Cannot proceed with my task as I am permanently stopped by this.
Moreover, I am thinking of returning to WSL1 if that will be possible.
OS: Windows 2004 (build 19041.329) Pro.

I used the workaround suggested by @leon-strong:

apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update

thanks for answer this one worked for me

@shinebayar-g
Copy link

shinebayar-g commented Nov 25, 2020

Another quick fix:

sudo apt-get install ntpdate
sudo ntpdate pool.ntp.org

Working on WSL2, Ubuntu 20.04 LTS.

@mcandre
Copy link

mcandre commented Dec 5, 2020

Why does WSL ntpd fail upon resuming from hibernation?

@brandonh-msft
Copy link

brandonh-msft commented Dec 16, 2020

Another quick fix:

sudo apt-get install ntpdate
sudo ntpdate pool.ntp.org

Working on WSL2, Ubuntu 20.04 LTS.

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
Copy link

Another quick fix:

sudo apt-get install ntpdate
sudo ntpdate pool.ntp.org

Working on WSL2, Ubuntu 20.04 LTS.

Even better, added to ~/.bashrc :)

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
Copy link

devedse commented 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.

wsl -d Ubuntu -u root apt-get update && apt-get install ntpdate
schtasks /Create /TN wsl-clock /TR "wsl -d Ubuntu -u root ntpdate pool.ntp.org" /SC ONEVENT /EC System /MO "*[System[Provider[@Name='Microsoft-Windows-Kernel-Power'] and (EventID=107 or EventID=507) or Provider[@Name='Microsoft-Windows-Kernel-General'] and (EventID=1)]]" /F

Change Ubuntu (in both places in the script) to the name of your WSL Instance (See wsl --list), then execute the script in cmd.

Thanks to all the other comments/suggestions that helped me create this script 😄 .

@SehiiRohoza
Copy link

I have the same issue on Windows 11 22H2, WSL2, Ubuntu 22.04 while updating packages:

$sudo apt update && sudo apt upgrade -y                                                                                                                                                                    
[sudo] password for serhii_rohoza:
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
Hit:4 https://baltocdn.com/helm/stable/debian all InRelease
Get:5 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security InRelease [7,535 B]
Hit:6 https://apt.releases.hashicorp.com jammy InRelease
Hit:7 https://packages.cloud.google.com/apt cloud-sdk InRelease
Get:8 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates InRelease [7,459 B]
Get:9 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security InRelease [7,453 B]
Get:10 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Get:11 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease [7,452 B]
Reading package lists... Done
E: Release file for http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease is not valid yet (invalid for another 1d 16h 4min 18s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease is not valid yet (invalid for another 1d 16h 4min 40s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease is not valid yet (invalid for another 1d 16h 5min 15s). Updates for this repository will not be applied.

It could be fixed with sudo hwclock --hctosys, but it's quite annoying.

@matthewnourse
Copy link

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
Copy link

ManuInNZ commented Mar 16, 2023 via email

@craigloewen-msft
Copy link
Member

/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
Copy link
Contributor

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
Copy link

roskee commented 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-strong.

@mcandre
Copy link

mcandre commented Aug 8, 2023

I'm not dual booting.

Why do WSL and native Windows have split clocks?

tpambor added a commit to tpambor/MISW4204 that referenced this issue Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests