如何修复Ubuntu Linux中的"存储库无效"错误
时间:2020-01-09 10:44:36 来源:igfitidea点击:
使用" sudo apt update"报错:
theitroad@localhost:~$ 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.
修复Ubuntu和其他Linux发行版中的"发布文件尚未生效"错误
错误的原因是系统时间与实际时间之间的差异。
我们会看到,每个存储库文件都在某个日期签名,我们可以通过查看发布文件来查看以下信息:
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