? ?
我最近在Raspberry Pi上安裝了Ubuntu服務器。我從Ubuntu終端將其連接到Wi-Fi,并在安裝任何要更新系統的Linux系統后繼續進行操作。
當我使用“ sudo apt update”命令時,它給了我一個錯誤,這對我來說是唯一的。它抱怨該存儲庫的發行文件在一定時間內無效。
ERROR:Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied.
這是完整的輸出:
ubuntu@ubuntu:~$ sudo apt update
Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB]
Reading package lists... Done
E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease is not valid yet (invalid for another 21d 23h 17min 25s). Updates for this repository will not be applied.
E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/InRelease is not valid yet (invalid for another 159d 15h 21min 2s). Updates for this repository will not be applied.
E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-backports/InRelease is not valid yet (invalid for another 159d 15h 21min 32s). Updates for this repository will not be applied.
E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied.
錯誤的原因是系統時間與實際時間之間的差異。
您會看到,每個存儲庫文件都在某個日期簽名,您可以通過查看發布文件來查看以下信息:
sudo head /var/lib/apt/lists/ports.ubuntu.com_ubuntu_dists_focal_InRelease
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Origin: Ubuntu
Label: Ubuntu
Suite: focal
Version: 20.04
Codename: focal
Date: Thu, 23 Apr 2020 17:33:17 UTC
Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x
現在,由于某些原因,我的Ubuntu服務器上的時間過去了,這就是為什么Ubuntu抱怨發行文件在X天內還無效的原因。
如果您已連接到Internet,則可能需要等待幾分鐘,系統才能同步時間。
如果它不起作用,則可以強制系統將本地時間用作實時時鐘(硬件時鐘):
sudo timedatectl set-local-rtc 1
使用timedatectl命令可以在Linux上配置時間,日期和更改時區。
您不需要重新啟動。它可以立即工作,您可以通過再次更新Ubuntu系統來進行驗證。
如果問題得以解決,則可以將實時時鐘設置為使用UTC(Ubuntu建議)。
sudo timedatectl set-local-rtc 0