APT 报错
[TOC]
问题一
更换 APT 源后有如下报错:
No system certificates available. Try installing ca-certificates
The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification.
根因
没有 ca 证书
解决方案
安装 ca 证书
安装同时又分为以下几种方案
原 APT 源能使用
切换回原来的APT源
apt update
apt install ca-certificates -y
然后再修改回需要更换的源
原 APT 源无法使用
方法一
去新的 APT 源的网站下载 deb 安装,这里以清华源为例,其他源对应替换链接即可
清华源的下载地址为 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/pool/main/c/ca-certificates/
下载对应版本的 ca-certificates_20211016~20.04.1_all.deb
dpkg -i ca-certificates_20211016~20.04.1_all.deb
有如下报错,需要依赖 openssl
,注意看需要的版本,这里要求是 >= 1.1.1
下载 OpenSSL
清华源的下载地址为 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/pool/main/o/openssl/
下载 libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb
和 openssl_1.1.1f-1ubuntu2.16_amd64.deb
注意自己版本的匹配
安装
dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb \
openssl_1.1.1f-1ubuntu2.16_amd64.deb \
ca-certificates_20211016~20.04.1_all.deb
方法二
上面那个属实太繁琐了,来个快捷的
apt -o "Acquire::https::Verify-Peer=false" update
apt -o "Acquire::https::Verify-Peer=false" install ca-certificates -y
由于个人水平有限,文中若有不合理或不正确的地方欢迎指出改正