As I tried to update my WSL (Windows Subsystem for Linux) installation, I run into this error message:
1 |
sudo apt-get update |
E: Release file for http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease is not valid yet (invalid for another 58min 27s). Updates for this repository will not be applied.
How could that be? The difference of nearly an hour got me thinking about a wrong system clock, but on Windows everything was correct. As I checked the date inside WSL, it was indeed way off (at 15:48):
1 |
date |
Mon Jan 1 14:16:03 CET 2024
Since the hardware clock (as shown in Windows) was correct, I could fix the time inside WSL by setting the system clock to the value of the hardware clock:
1 |
sudo hwclock --hctosys |
The date util now returned the correct time:
1 |
date |
Mon Jan 1 15:49:05 CET 2024
And with the fixed clock I could run apt-get update without any strange error messages.