錯誤:ca 證書已損壞或未完全安裝

錯誤:ca 證書已損壞或未完全安裝

我試圖使用sudo dpkg-reconfigure ca-certificates命令安裝自簽署 SSL 證書,但在完成之前,我的電腦因電源故障而重置。

現在,當我運行sudo dpkg-reconfigure ca-certificates命令時,出現以下錯誤:

sudo dpkg-reconfigure ca-certificates
/usr/sbin/dpkg-reconfigure: ca-certificates is broken or not fully installed

當我嘗試時sudo update-ca-certificates,我收到以下錯誤:

sudo update-ca-certificates
Updating certificates in /etc/ssl/certs...
Unknown regexp modifier "/b" at /usr/bin/c_rehash line 15, at end of line
Unknown regexp modifier "/W" at /usr/bin/c_rehash line 26, at end of line
Unknown regexp modifier "/3" at /usr/bin/c_rehash line 26, at end of line
Unknown regexp modifier "/2" at /usr/bin/c_rehash line 26, at end of line
No such class installdir at /usr/bin/c_rehash line 58, near "Prefix our installdir"
  (Might be a runaway multi-line // string starting on line 26)
syntax error at /usr/bin/c_rehash line 58, near "Prefix our installdir"
Execution of /usr/bin/c_rehash aborted due to compilation errors.

當我嘗試 sudo 時apt install ca-certificates -f,出現以下錯誤:

sudo apt install ca-certificates -f 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
ca-certificates is already the newest version (20160104ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up ca-certificates (20160104ubuntu1) ...
Processing triggers for ca-certificates (20160104ubuntu1) ...
Updating certificates in /etc/ssl/certs...
Unknown regexp modifier "/b" at /usr/bin/c_rehash line 15, at end of line
Unknown regexp modifier "/W" at /usr/bin/c_rehash line 26, at end of line
Unknown regexp modifier "/3" at /usr/bin/c_rehash line 26, at end of line
Unknown regexp modifier "/2" at /usr/bin/c_rehash line 26, at end of line
No such class installdir at /usr/bin/c_rehash line 58, near "Prefix our installdir"
  (Might be a runaway multi-line // string starting on line 26)
syntax error at /usr/bin/c_rehash line 58, near "Prefix our installdir"
Execution of /usr/bin/c_rehash aborted due to compilation errors.
dpkg: error processing package ca-certificates (--configure):
 subprocess installed post-installation script returned error exit status 255
Errors were encountered while processing:
 ca-certificates
E: Sub-process /usr/bin/dpkg returned an error code (1)

因此,我什至無法將我的工作推送到 Git 存儲庫。當我嘗試這樣做時,出現以下錯誤:

fatal: unable to access 'https://github.com/***/***-tdd.git/': Problem with the SSL CA cert (path? access rights?)

有誰知道如何解決這個問題,而無需我重新安裝Ubuntu?請幫忙。

答案1

看起來 c_rehash perl 腳本中有一個錯誤(我遇到了類似的錯誤,我發現了這個討論:https://aur.archlinux.org/packages/icaclient/?comments=all)。在我的系統(archlinux,看起來你的系統在 /usr/bin/c_rehash 中)的 /bin/c_rehash 中,缺少一些引號。我必須更改它(靠近文件頂部):

my $dir = /etc/ssl;
my $prefix = /usr;

到:

my $dir = "/etc/ssl";
my $prefix = "/usr";

然後就成功了。

答案2

就我而言,錯誤關閉 ca 證書設定導致檔案損壞。重新安裝/更新“debconf”解決了我的問題:

sudo apt-get install debconf

相關內容