apt update时报错Certificate verification failed
具体报错信息:
Certificate verification failed: The certificate is NOT trusted.
Err:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports Release
Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.
Could not handshake: Error in the certificate verification.
E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal Release' no longer has 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.
最近我的几个Ubuntu升级都出现了一样的问题,之前一直都是好的,看报错信息是SSL的ca证书验证失败,我用的清华镜像源,猜测可能是ca证书过期了,网上有的说重装一下ca-certificates这个软件,但是我拉软件就报错,仿佛变成了一个鸡生蛋,蛋生鸡的问题。
后来我的解决方法是,把apt源换成http协议,升级之后,ca-certificates会有一个版本的升级就自动好了。
- 打开
/etc/apt/sources.list
,把所有https
的网址换成http
- 执行
sudo apt udpate
- 执行
sudo apt upgrade
- 将
/etc/apt/sources.list
之前的改动还原。 - 再次执行
sudo apt update
验证问题是否修复。
如果还不行,可以检查一下有没有安装ca-certificates
这个软件,使用sudo apt install ca-certificates
安装或者sudo apt install --reinstall ca-certificates
进行重装。