Skip to content

Instantly share code, notes, and snippets.

@h3ssan
Created March 9, 2024 17:31
Show Gist options
  • Save h3ssan/f1dd6be9de50b708a7027c2f804b9c43 to your computer and use it in GitHub Desktop.
Save h3ssan/f1dd6be9de50b708a7027c2f804b9c43 to your computer and use it in GitHub Desktop.
Problem in Debian server that causes apt to not update `repository is not valid yet`.

Cause

  • Type in terminal timedatectl

It should show you a terminal interface contains several dates, Local time, Universal time and RTC time,

$ timedatectl 
               Local time: Sat 2024-03-09 17:29:25 UTC
           Universal time: Sat 2024-03-09 17:29:25 UTC
                 RTC time: Sat 2024-03-09 17:29:25
                Time zone: UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: n/a
          RTC in local TZ: no

you should noticed the time difference, we are in the past now. This can happen when you restore the system from a snapshot, therefore the time indication will be incorrect for at least a while.

Fix

  • Install ntp using apt
sudo apt install -y ntp
  • Restart the service
sudo systemctl restart ntp
  • Now, check the time using timedatectl, it should be correct

  • Now you can do sudo apt update with no issues.


Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment