Goglides Dev 🌱

Balkrishna Pandey
Balkrishna Pandey

Posted on

InRelease is not valid yet (invalid for another 2d 19h 59min 59s). Updates for this repository will not be applied.

Reading package lists... Done                        
E: Release file for http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease is not valid yet (invalid for another 2d 19h 59min 59s). 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 2d 20h 38min 8s). 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 2d 20h 1min 13s). Updates for this repository will not be applied.
Enter fullscreen mode Exit fullscreen mode

The error message is telling you that the "Release" file for the specified repositories is not valid yet, meaning that the system clock on your machine is ahead of the server's clock by a certain amount of time. This can happen if the system clock on your machine is not set correctly or if the server's clock is experiencing some delay.

To fix this issue, you need to ensure that the system clock on your machine is set correctly. You can do this by running the following command in the terminal:

sudo timedatectl set-ntp on
Enter fullscreen mode Exit fullscreen mode

This command will enable the Network Time Protocol (NTP) on your machine, which will automatically synchronize your system clock with the correct time from an NTP server.

There is temporary workaround as well which we can use to avoid this issue. You can add a configuration file to disable the time check during the package update process as follows,

RUN echo "Acquire::Check-Valid-Until \"false\";\nAcquire::Check-Date \"false\";" | cat > /etc/apt/apt.conf.d/10no--check-valid-until
Enter fullscreen mode Exit fullscreen mode

This command creates a new configuration file in the /etc/apt/apt.conf.d/ directory named 10no--check-valid-until and sets the Acquire::Check-Valid-Until and Acquire::Check-Date options to false. This will disable the check for the validity of the Release file and the system time during package updates.

After adding this command to your Dockerfile, rebuild your Docker image, and you should be able to run apt-get update without encountering the time check error.

Top comments (0)