エラー: ca-certificates が壊れているか、完全にインストールされていません

エラー: ca-certificates が壊れているか、完全にインストールされていません

コマンドを使用して自己署名 SSL 証明書をインストールしようとしましたsudo dpkg-reconfigure ca-certificatesが、完了する前に、電源障害によりコンピューターがリセットされました。

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

関連情報