LLI Wiki — My Digital Knowledge Base

Debian/Ubuntu: apt update fails due to wrong clock, resetting the time

Reset the system time from the HTTP Date header to unblock apt update.

When a Debian/Ubuntu machine's clock is far off (restored VM, no NTP), apt update fails because repositories and their signatures look invalid or "not yet valid". The time can be reset from the HTTP Date header of a public website, without any NTP service.

sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
sudo apt update

Notes

Mastodon LLIMastodon SocialFosstodon