在 Ubuntu 16.04 中删除 ca 证书后如何重新安装?

在 Ubuntu 16.04 中删除 ca 证书后如何重新安装?

首先,我收到此错误,E: Sub-process /usr/bin/dpkg returned an error code (1)因为软件包 ca-certificates 中存在一些问题。然后发现博客里提到了一些方法,我用的是前三种方法。

之后我发现问题并尝试使用其答案来解决我的问题但失败了。遗憾的是,第三种方法“ sudo apt-get --purge remove ca-certificates,我猜它会删除所有文件.crt

当我关注回答

输出:sudo cp foo.crt /usr/share/ca-certificates/extra/foo.crtcp: cannot stat 'foo.crt': No such file or directory

无输出:locate foo.crt

有关该系统的更多信息:

输出:

~$ uname -a
Linux redhwan 4.15.0-101-generic #102~16.04.1-Ubuntu SMP Mon May 11 11:38:16 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

输出:

~$ lsb_release -crid
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial

输出:

~$ grep ' ' /etc/ca-certificates.conf
# This file lists certificates that you wish to use or to ignore to be
# installed in /etc/ssl/certs.
# update-ca-certificates(8) will update /etc/ssl/certs by reading this file.
# This is autogenerated by dpkg-reconfigure ca-certificates.
# Certificates should be installed under /usr/share/ca-certificates
# and files with extension '.crt' is recognized as available certs.
# line begins with # is comment.
# line begins with ! is certificate filename to be deselected.
!This is suroegin's package - sort

然后移除!This is suroegin's package - sort

输出:

~$ sudo dpkg --configure -a
Setting up ca-certificates (20190110~16.04.1) ...
Processing triggers for ca-certificates (20190110~16.04.1) ...
Updating certificates in /etc/ssl/certs...
W: /usr/share/ca-certificates/This not found, but listed in /etc/ca-certificates.conf.
W: /usr/share/ca-certificates/is not found, but listed in /etc/ca-certificates.conf.
W: /usr/share/ca-certificates/suroegin's not found, but listed in /etc/ca-certificates.conf.
W: /usr/share/ca-certificates/package not found, but listed in /etc/ca-certificates.conf.
W: /usr/share/ca-certificates/- not found, but listed in /etc/ca-certificates.conf.
W: /usr/share/ca-certificates/sort not found, but listed in /etc/ca-certificates.conf.
sed: can't read This is suroegin's package - sort: No such file or directory
dpkg: error processing package ca-certificates (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 ca-certificates

~$ echo -e "4\n1\n3\n2" | sort
This is suroegin's package - sort

无输出:sudo updatedb

~$ locate suroegin
/etc/ssl/certs/This_is_suroegin's_package_-_sort.pem

如何修复?

相关内容