解决Certificate verification failed错误
问题表现
执行sudo apt update的时候,所有更新项目都报以下错误:
Certificate verification failed: The certificate is NOT trusted. The certificate chain uses not yet valid certificate. Could not handshake: Error in the certificate verification
问题原因
猜测可能是因为改了时区,导致证书失效。
解决方案
调整更新源URL协议,需要在/etc/apt/sources.list文件中找到更新源,把其中的链接开头的https协议改成http,然后安装ntp,实现网络时间同步,避免因为时间问题导致证书出错:
执行
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vi /etc/apt/sources.list
将/etc/apt/sources.list中所有https改为http
然后执行:
# 更新源
sudo apt-get update
# 安装ntp,以实现网络时间同步
sudo apt-get install ntp
sudo systemctl start ntp
sudo systemctl enable ntp
最后再试一下
sudo apt-get update
正常情况下不会再报错了。
调整过的source.list可以再改回https协议,也可以不改回去。