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:
ntpq -p
This time you definitely get a response from Network Time Protocol servers.
Finally, run update command:
sudo apt update
Just want to say Thank You.
I am happy.
Thank you
i spent 2 days for that…thank you
Thank you, the truth is, I don’t know how there are people who come up with those solutions, so I knew there was something wrong with the date and time, but I never thought of changing the ntp.conf configuration and passing the POOL hosts to it.
You helped me a lot, thank you.
Thanks super helpful
I get the following:
ntpq: read: connection refused
why restarting the ntp.service? he just should be update the timezone and everything will be fine lol
you can use: sudo ntpd -qg
or you need to set: sudo ntpdate -v pool.ntp.org
btw you dont have to change your source as long as you keep following the fresh updates!
thxz for u kindness share the tutorial..👍👍
Thank you
Thanks man! Save my day
Thankk youuu mateee!
This was the most succinct and helpful article I’ve ever read while troubleshooting. Big thanks!
Thank you so much a lot