apt-get check` が失敗した場合の修正方法を教えてください。パッケージが壊れている可能性があります。

apt-get check` が失敗した場合の修正方法を教えてください。パッケージが壊れている可能性があります。

Ubuntu 18.04.1 LTS (GNU/Linux 4.9.0-15-amd64 x86_64) と Swizzin Box を実行しているレンタル専用サーバー上の壊れた autodl irssi インストールを、box autodl パッケージを削除して再インストールすることで修復しようとしました。

autodl を削除すると次のようになります:-

SUCCESS autodl removed 
ERROR dpkg database is locked by apt-get. Please try again later

再インストールしようとすると次のメッセージが表示されます:-

INFO Installing autodl 
E: Unable to correct problems, you have held broken packages. 
ERROR The simulation check resulted in an error. Please consult the log.

ログには

Reading package lists...
Building dependency tree...
Reading state information...
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 pkg-config : Depends: libdpkg-perl but it is not installed

'apt --fix-broken install' を実行すると、次のようになります:-

0 upgraded, 0 newly installed, 1 to remove and 107 not upgraded.
After this operation, 193 kB disk space will be freed.
Do you want to continue? [Y/n] y

(Reading database ... 87206 files and directories currently installed.)

Removing pkg-config (0.29-4+b1) ...

Can't locate Dpkg/Arch.pm in @INC (you may need to install the Dpkg::Arch module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/pkg-config-dpkghook line 14.

BEGIN failed--compilation aborted at /usr/share/pkg-config-dpkghook line 14.

dpkg: error processing package pkg-config (--remove):

 subprocess installed pre-removal script returned error exit status 2

Errors were encountered while processing:

 pkg-config

E: Sub-process /usr/bin/dpkg returned an error code (1)

この問題を解決する方法について何か提案はありますか?

答え1

を試してくださいsudo apt --fix-broken install libdpkg-pearl。また、固定されたパッケージがあるかどうかを確認します。 を実行しapt policy、興味深いものがあるかどうかを確認します。この場合、「興味深い」にはサードパーティのリポジトリが含まれます。行に「ubuntu.com」が含まれていない場合は疑わしいです。

再配布できないプロプライエタリ ソフトウェアや、ソフトウェアの最新のアップストリーム バージョンが必須要件である場合など、サードパーティのリポジトリ (Canonical 以外のもの) が必要になる場合があります。ただし、これらのリポジトリは、使用している OS の基本インストールで動作するように特別に設計されている必要があり、無関係なパッケージを含めてはなりません。別のオペレーティング システムへの参照を追加して互換性を確保しようとしないでください。たとえば、Ubuntu Bionic リリースのパッケージ ソースとして Debian Stretch を追加するなどです。奇妙なパッケージの競合や予期しない置き換えが多数発生する可能性があります。

chroot でこの状況を再現することはできませんでした。apt --fix-broken installいくつかの積極的な削除を行った後でも動作しました。Aptitude でさらに情報が得られるかもしれませんが、現在のパッケージの混乱を考えると、実行できるかどうかは疑問です。dpkg --list次のデバッグ情報は、pastebin になります。

関連情報