If you are on Debian, Ubuntu, or Kali Linux and after installing or restoring the system you start getting an error given below, while running system update command, then here is the solution.
Release file for http://http.kali.org/kali/dists/kali-rolling/InRelease is not valid yet (invalid for another 13h 23min 36s). Updates for this repository will not be applied.
This error appears because of your system date and time settings. If the system currently doesn’t match the current time of the world, this error would come.
Run the command to check the current time and date value of the system:
sudo timedatectl status
As you can see in the above screenshot, I am getting the error mention above while updating the system. The Kali system showing the date 17 June, however, in actual while this error was coming, the current date was 18 June.
So, what we have to do is the syncing of the Kali Linux time to the NTP server. May this would resolve the issue.
First, just restart the NTP service:
sudo systemctl restart ntp.service
Run the ntpq -p to check the listed NTP server in the ntp.conf file.
sudo ntpq -p
If everything is working fine, out of the listed NTP servers you will get the response. Then the problem is already solved, however, in case the NTP servers listed in the configuration file are not responding then add some manually.
Edit NTP.conf file
sudo nano etc/ntp.conf
Scroll down to the pool of existing NTP server and add the following one or any other you want:
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org
To save the file press CTRL+X and then Y.
Now, again run:
This time you definitely get a response from Network Time Protocol servers.
Finally, run update command:
sudo apt update