「Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process」が出た場合の対処方法

Ubuntu20.04で[apt]を使った際、下記のような画面となりインストールが始まらない事象が発生しました。

root@ホスト名:~#
root@ホスト名:~# sudo apt install certbot python3-certbot-nginx
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1146  👈出た
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1146  👈出た
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1146  👈出た
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1146  👈出た
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1146  👈出た
^Cunattended-upgr)… 9s  👈秒数が増えていく

対応方法を調べたので、ご参考までに。

「lock」ファイル(ロックファイル)がロックされているようですので、Processをkillしましょう。

root@ホスト名:~#
root@ホスト名:~# sudo kill -9 1146 👈「1146」はエラー画面の番号
root@ホスト名:~#

再度、インストールしてみます。

root@ホスト名:~# sudo apt install certbot python3-certbot-nginx
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
python3-acme python3-certbot python3-configargparse python3-future python3-icu python3-josepy
python3-mock python3-parsedatetime python3-pbr python3-pyparsing python3-requests-toolbelt
python3-rfc3339 python3-tz python3-zope.component python3-zope.event python3-zope.hookable
Suggested packages:
python3-certbot-apache python-certbot-doc python-acme-doc python-certbot-nginx-doc
python-future-doc python-mock-doc python-pyparsing-doc
~~省略~~
The following NEW packages will be installed:
certbot python3-acme python3-certbot python3-certbot-nginx python3-configargparse
python3-future python3-icu python3-josepy python3-mock python3-parsedatetime python3-pbr
python3-pyparsing python3-requests-toolbelt python3-rfc3339 python3-tz python3-zope.component
python3-zope.event python3-zope.hookable
0 upgraded, 18 newly installed, 0 to remove and 141 not upgraded.
Need to get 1,264 kB of archives.
After this operation, 6,657 kB of additional disk space will be used.
Do you want to continue? [Y/n] y  👈「Y」を入力し実行
Get:1 http://jp.archive.ubuntu.com/ubuntu focal/universe amd64 python3-josepy all 1.2.0-2 [28.1 kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 python3-pbr all 5.4.5-0ubuntu1 [64.0 kB]
Setting up certbot (0.40.0-1ubuntu0.1) …
Created symlink /etc/systemd/system/timers.target.wants/certbot.timer → /lib/systemd/system/certbot.timer.
Setting up python3-certbot-nginx (0.40.0-0ubuntu0.1) …
Processing triggers for man-db (2.9.1-1) …
root@ホスト名:~#

インストールできたので、解決です!

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です