如何修复Ubuntu Linux中的 “Release file is not valid yet” 错误

系统 Linux
我最近在我的树莓派上安装了 Ubuntu 服务器。我在 Ubuntu 终端连接上了 Wi-Fi,然后做了我在安装任何 Linux 系统后都会做的事情,那就是更新系统。当我使用 sudo apt update 命令时,它给了一个对我而言特别的错误。

我最近在我的树莓派上安装了 Ubuntu 服务器。我在 Ubuntu 终端连接上了 Wi-Fi,然后做了我在安装任何 Linux 系统后都会做的事情,那就是更新系统。

当我使用 sudo apt update 命令时,它给了一个对我而言特别的错误。它报出仓库的发布文件在某个时间段内无效。

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.**

下面是完整输出:

  1. ubuntu@ubuntu:~$ sudo apt update
  2. Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
  3. Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB]
  4. Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB]
  5. Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB]
  6. Reading package lists... Done
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11.  

修复 Ubuntu 和其他 Linux 发行版中 “Release file is not valid yet” 的错误。

错误的原因是系统上的时间和现实世界的时间不同。

你看,每个仓库文件都是在某个日期签名的,你可以通过查看发布文件信息了解:

  1. sudo head /var/lib/apt/lists/ports.ubuntu.com_ubuntu_dists_focal_InRelease
  2. -----BEGIN PGP SIGNED MESSAGE-----
  3. Hash: SHA512
  4.  
  5. Origin: Ubuntu
  6. Label: Ubuntu
  7. Suite: focal
  8. Version: 20.04
  9. Codename: focal
  10. Date: Thu, 23 Apr 2020 17:33:17 UTC
  11. Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x

现在,由于某些原因,我的 Ubuntu 服务器上的时间是过去时间,这也是为什么 Ubuntu 报出发布文件已经无效 X 天的原因。

如果你连接到了互联网,你可以等待几分钟让系统同步时间

如果不行,你可以强制系统使用本地时间作为实时时钟(硬件时钟):

  1. sudo timedatectl set-local-rtc 1

timedatectl 命令可以让你在 Linux 上配置时间、日期和更改时区

你应该不需要重新启动。它可以立即工作,你可以通过更新你的 Ubuntu 系统再次验证它。

如果问题解决了,你可以将实时时钟设置为使用 UTC(Ubuntu 推荐的)。

  1. sudo timedatectl set-local-rtc 0

是否为你解决了这个问题?

我希望这个提示能帮助你解决这个错误。如果你仍然遇到这个问题,请在评论栏告诉我,我会尽力帮助你。 

 

责任编辑:庞桂玉 来源: Linux中国
相关推荐

2020-05-13 18:34:33

UbuntuLinux

2022-07-31 21:30:15

Ubuntu

2015-07-28 14:45:31

ubuntu修复系统程序

2022-08-08 16:21:54

Ubuntu

2018-03-05 19:20:49

LinuxWordPressHTTP

2019-03-04 14:40:46

Linux文件系统修复

2022-07-11 12:23:50

UbuntuLinux

2023-11-27 09:40:58

Arch Linux

2018-08-30 10:28:05

修复Windows 10IntcOED

2015-09-16 16:16:47

可引导设备UbuntuLinux

2019-08-22 11:31:30

UbuntuLinux

2022-01-20 08:04:41

FSCKLinux磁盘

2023-10-10 09:27:17

Arch Linux命令

2022-08-14 19:27:16

LinuxmacOS

2015-08-17 14:56:43

Linux问题

2023-06-05 09:56:41

Arch Linux命令

2019-12-24 10:05:51

修复Windows 10Netwtw04.sy

2018-09-25 09:46:54

修复windows 100x80070057

2018-09-28 09:53:27

2018-11-12 11:10:47

修复windows 10SYNTP.SYS
点赞
收藏

51CTO技术栈公众号