[解决方案]Linux更新apt错误解决办法

昨天装系统装出问题了,今天又发现服务器内存条烧了一根,让本就不富裕的内存又-8G。今天好不容易装好了系统,发现apt update又出现了问题。经过百度之后,摸索着解决了问题。本来想发个博客,又想起来服务器刚装好系统,啥都没有,没法发博客。

报错信息

violettec@linux:~# sudo apt-get update
Ign:1 https://mirrors.ustc.edu.cn/ubuntu bionic InRelease
Ign:2 https://mirrors.ustc.edu.cn/ubuntu bionic-updates InRelease
Ign:3 https://mirrors.ustc.edu.cn/ubuntu bionic-backports InRelease
Ign:4 https://mirrors.ustc.edu.cn/ubuntu bionic-security InRelease
Ign:5 https://mirrors.ustc.edu.cn/ubuntu bionic-proposed InRelease
Err:6 https://mirrors.ustc.edu.cn/ubuntu bionic Release
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses not yet valid certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
Err:7 https://mirrors.ustc.edu.cn/ubuntu bionic-updates Release
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses not yet valid certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
Err:8 https://mirrors.ustc.edu.cn/ubuntu bionic-backports Release
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses not yet valid certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
Err:9 https://mirrors.ustc.edu.cn/ubuntu bionic-security Release
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses not yet valid certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
Err:10 https://mirrors.ustc.edu.cn/ubuntu bionic-proposed Release
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses not yet valid certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
Reading package lists... Done
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu bionic-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu bionic-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu bionic-security Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://mirrors.ustc.edu.cn/ubuntu bionic-proposed Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

上面的报错信息,是我使用了中科大的源后,更新apt后的报错信息。当我复制下面这一段信息进行百度的时候,发现没有什么有用的线索。

E: The repository 'https://mirrors.ustc.edu.cn/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

当我尝试搜索靠上点的报错时:

Certificate verification failed: The certificate is NOT trusted. The certificate chain uses not yet valid certificate.  Could not handshake: Error in the certificate verification.

发现也许是服务器时间错误,导致证书检验错误。我看了一下服务器时间:

violettec@linux:~# date -R
Sun, 28 Jan 2018 15:59:44 +0000

(当时北京时间:2021/02/07 22:54)

本想用工具自动联网修改一下时间,想起来了apt是坏的,只能手动修改了。

violettec@linux:~# timedatectl set-timezone "Asia/Shanghai" #设置时区
violettec@linux:~# sudo date -s "2021-02-07 22:54:00" #设置时间

然后再apt update,换回清华源,终于正常了。

image.png

博客终于恢复了...

标签:

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code