本日、CentOSの日常業務において、何らかの理由でyum -y install xxxコマンドが突然立ち往生し、Ctrl + Cで実行をキャンセルしても解決しないため、SSHを閉じて接続を再確立しますが、再度yum -y install xxxコマンドを再実行すると、以下のエラーが報告されました:
...
root@localhost:~>yum -y install xxx
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 27970.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 43 M RSS (362 MB VSZ)
Started: Mon Jul 13 18:27:38 2020 - 03:46 ago
State : Uninterruptible, pid: 27970
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 43 M RSS (362 MB VSZ)
Started: Mon Jul 13 18:27:38 2020 - 03:48 ago
State : Uninterruptible, pid: 27970
...
最初の判断は、1つの偽の死のためのプロセス番号である必要があります、単にSSHを閉じた場合でも、また、彼を殺していないので、単純に実行した -9 97270直接殺す、その後、yumを実行 -y xxxコマンドをインストールし、再びエラーレポートの結果:
...
root@localhost:~>yum -y install xxx
error: rpmdb: BDB0113 Thread/process 27970/140274709284672 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 - (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed
...
rpmdbのローカル・データストア・ファイルが吹っ飛んでしまいました。
以下のコマンドを実行して、YUMリポジトリのローカル・データストア・ファイルをクリーンアップします:
mv /var/lib/rpm/__db* /tmp;
以下のコマンドを実行して、yumキャッシュをクリアします:
rpm --rebuilddb;
yum clean all
素晴らしい仕事です。