If you are running update command on Ubuntu 20.04/18.04 or earlier version and start getting an error that release files are not valid for some specific time then here is the solution.
This error appears because your system time would not be synced with your current geographical location or Time server. In simple words, the time and date on your system are not correct thus remote repository server throwing an error that the release is not valid for your machine for some specific period of time.
Error: Reading package lists... Done E: Release file for http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 18h 32min 20s). Updates for this repository will not be applied. E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 18h 32min 19s). Updates for this repository will not be applied. E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease is not valid yet (invalid for another 18h 32min 45s). Updates for this repository will not be applied.
Thus, first, check your current date and time by typing:
Now, if you see that the time or data is not accurate then to change and sync it with the hardware clock of your system run:
sudo hwclock --hctosys
In case, the above command didn’t work then configure it manually by installing NTP and selecting the time zone:
sudo apt install ntp sudo dpkg-reconfigure tzdata
sudo service ntp restart
Well, now run the system update command and this time you will not get the error, even though still the issue has not been solved on your system, then hold checking of time for temporary will work. This will definitely resolve the issue:
sudo apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update
As every repository has been signed with some data and time, thus, it is necessary to make sure the system which is fetching them has the correct time, so that it can verify the latest release. If your system is in past then this mismatch will create a problem.