「Another app is currently holding the yum lock; waiting for it to exit… 」エラー

プログラミング

CeontOSでyumを実行した際に「Another app is currently holding the yum lock; waiting for it to exit…」が表示されて処理が進まないときの対処法です。

現象

$ sudo yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 15761.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  24 M RSS (322 MB VSZ)
    Started: Tue Jul 14 15:04:25 2020 - 01:47 ago
    State  : Traced/Stopped, pid: 15761
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  24 M RSS (322 MB VSZ)
    Started: Tue Jul 14 15:04:25 2020 - 01:49 ago
    State  : Traced/Stopped, pid: 15761

何度も「Another app is currently holding the yum lock; waiting for it to exit…」が表示されてyumが一向に終わりません。

原因

何らかの原因で前回実行したyumが正常に終了しなかったためにyumにロックがかかった状態になってしまっています。現象のターミナルに表示されている通り、前回のyumのプロセスが残っています。(State : Traced/Stopped, pid: 15761)

対処法

前回のyumのプロセスを強制終了することで、ロックを解除します。

# 15761はプロセスIDです。
$ sudo kill -9 15761

これでyumが正常に実行されるはずです。

pocketcode

30代のWEB系企業エンジニアです。毎回同じようなことを検索してしまうので、自分の備忘録的に書いています。サイトのデザインはQiita(https://qiita.com)さんに寄せています。