dpkgエラー:debconf:DbDriver "config":/var/cache/debconf/config.datが他のプロセスによってロックされています。リソースは一時的に使用できません。

dpkgエラー:debconf:DbDriver

以下を実行すると処理パッケージエラーが発生しますapt upgrade

オンラインで言及された一般的な解決策を試しました。しかし、それはループに閉じ込められた。

❯ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 mysql-server-5.7 : PreDepends: mysql-common (>= 5.5) but it is not installed
                    Depends: apparmor (>= 2.10) but it is not installed
                    Depends: mysql-client-5.7 (>= 5.7.32-0ubuntu0.16.04.1) but it is not installed
                    Depends: mysql-common (>= 5.6.22-1~) but it is not installed
                    Depends: mysql-server-core-5.7 (= 5.7.32-0ubuntu0.16.04.1) but it is not installed
                    Recommends: libhtml-template-perl but it is not installed
 phpmyadmin : Depends: libapache2-mod-php or
                       libapache2-mod-phpfilter but it is not installable or
                       php-cgi or
                       php-fpm or
                       php
              Depends: php-mysql but it is not installed or
                       php-mysqli or
                       php-mysqlnd
              Depends: php-json
              Depends: php-common but it is not installed
              Depends: libjs-sphinxdoc (>= 1.0) but it is not installed
              Depends: dbconfig-mysql but it is not installed or
                       dbconfig-no-thanks but it is not installed or
                       dbconfig-common (< 2.0.0) but it is not installed
              Depends: php-gettext
              Depends: php-mbstring
              Depends: php-phpseclib (>= 2.0)
              Recommends: php-gd
              Recommends: mysql-client but it is not installed or
                          mariadb-client but it is not installed or
                          virtual-mysql-client
              Recommends: php-tcpdf but it is not installed
E: Unmet dependencies. Try using -f.

次に、次のことを試してください。

❯ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  apparmor dbconfig-common dbconfig-mysql libapache2-mod-php libapache2-mod-php7.0
  libapparmor-perl libjs-sphinxdoc libjs-underscore mysql-client-5.7
  mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 php-common
  php-gettext php-mbstring php-mysql php-pear php-phpseclib php-xml php7.0-cli
  php7.0-common php7.0-json php7.0-mbstring php7.0-mysql php7.0-opcache php7.0-readline
  php7.0-xml
Suggested packages:
  apparmor-profiles apparmor-profiles-extra apparmor-docs apparmor-utils mysql-server
  | mariadb-server mailx tinyca php-libsodium php-mcrypt php-gmp
Recommended packages:
  libhtml-template-perl
The following NEW packages will be installed:
  apparmor dbconfig-common dbconfig-mysql libapache2-mod-php libapache2-mod-php7.0
  libapparmor-perl libjs-sphinxdoc libjs-underscore mysql-client-5.7
  mysql-client-core-5.7 mysql-common mysql-server-core-5.7 php-common php-gettext
  php-mbstring php-mysql php-pear php-phpseclib php-xml php7.0-cli php7.0-common
  php7.0-json php7.0-mbstring php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml
The following packages will be upgraded:
  mysql-server-5.7
1 upgraded, 27 newly installed, 0 to remove and 0 not upgraded.
14 not fully installed or removed.
Need to get 20.7 MB/23.2 MB of archives.
After this operation, 131 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...
Selecting previously unselected package php-phpseclib.
Preparing to unpack .../php-phpseclib_2.0.1-1build1_all.deb ...
Unpacking php-phpseclib (2.0.1-1build1) ...
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.7_5.7.33-0ubuntu0.16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

それから:

❯ sudo dpkg --configure -a
Setting up grub-pc (2.02~beta2-36ubuntu3.29) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up tzdata (2021a-0ubuntu0.16.04) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package tzdata (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up samba-common (2:4.3.11+dfsg-0ubuntu0.16.04.32) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package samba-common (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up openssh-server (1:7.2p2-4ubuntu2.10) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package openssh-server (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of samba:
 samba depends on samba-common (= 2:4.3.11+dfsg-0ubuntu0.16.04.32); however:
  Package samba-common is not configured yet.
 
dpkg: error processing package samba (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-minimal:
 ubuntu-minimal depends on tzdata; however:
  Package tzdata is not configured yet.
  ...
dpkg: error processing package python-pip-whl (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nodejs:
 nodejs depends on ca-certificates; however:
  Package ca-certificates is not configured yet.
 
dpkg: error processing package nodejs (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 grub-pc
 tzdata
 samba-common
 openssh-server
 samba
 ubuntu-minimal
 samba-common-bin
 ca-certificates
 python-pip
 software-properties-common
 python-pip-whl
 nodejs

ここにリストされているパッケージを削除しようとしました。

❯ sudo apt-get remove $pkg -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libapache2-mod-php7.0' is not installed, so not removed
Package 'mysql-server' is not installed, so not removed
Package 'php-pear' is not installed, so not removed
Package 'php7.0-cli' is not installed, so not removed
Package 'php7.0-common' is not installed, so not removed
Package 'php7.0-gd' is not installed, so not removed
Package 'php7.0-json' is not installed, so not removed
Package 'php7.0-mysql' is not installed, so not removed
Package 'php7.0-opcache' is not installed, so not removed
Package 'php7.0-readline' is not installed, so not removed
Package 'php7.0-xml' is not installed, so not removed
Package 'php7.0-mbstring' is not installed, so not removed
Package 'php7.0-mcrypt' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 grub-gfxpayload-lists : Depends: grub-pc (>= 1.99~20101210-1ubuntu2)
 libtcl8.6 : Depends: tzdata but it is not going to be installed
 phpmyadmin : Depends: libapache2-mod-php or
                       libapache2-mod-phpfilter but it is not installable or
                       php-cgi or
                       php-fpm or
                       php
              Depends: php-mysql but it is not going to be installed or
                       php-mysqli or
                       php-mysqlnd
              Depends: php-json
              Depends: php-common but it is not going to be installed
              Depends: libjs-sphinxdoc (>= 1.0) but it is not going to be installed
              Depends: dbconfig-mysql but it is not going to be installed or
                       dbconfig-no-thanks but it is not going to be installed or
                       dbconfig-common (< 2.0.0) but it is not going to be installed
              Depends: php-gettext
              Depends: php-mbstring
              Depends: php-phpseclib (>= 2.0)
              Recommends: php-gd
              Recommends: mysql-client but it is not going to be installed or
                          mariadb-client but it is not going to be installed or
                          virtual-mysql-client
              Recommends: php-tcpdf but it is not going to be installed
 python3-requests : Depends: ca-certificates but it is not going to be installed
 rubygems-integration : Depends: ca-certificates but it is not going to be installed
 ssh-import-id : Depends: ca-certificates but it is not going to be installed
                 Recommends: openssh-server
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

これでインストール手順に戻ります。この問題を解決し、すべてをアップグレードするにはどうすればよいですかapt-get


オペレーティングシステム:Ubuntu 16.04.7 LTS x86_64

シェル:魚3.1.2

ベストアンサー1

あなたの状況は、…is locked by another process…他の実行中のプロセスによってdpkg引き起こされる可能性が高いです。これは、以前に失敗したパッケージ構成の実行から残っている可能性があります。

dpkg他のウィンドウなどで実行されていないことが確実な場合は、apt既存のプロセスを調べて使用をdpkg検討してください。kill

$ ps awux | grep dpkg

他のエラーの場合、インストール中に1つ以上のパッケージが構成されていないために発生します。実際に起こったことのログを見ることなく、原因を特定することは不可能です。

これらのパッケージが必要ないと判断した場合は、問題がなくなるまでそのパッケージを削除できます。/var/lib/dpkg/info/たとえば、事前または後の rm スクリプトの問題によってパッケージの削除が失敗した場合は、そのスクリプトを見つけて/var/lib/dpkg/info/mysql-server.postrm削除できます。明らかに、これらのパッケージを維持したい場合、これは「核オプション」であり、賢明な方法ではありません。すぐに再インストールしたいなら大丈夫でしょう。

私はあなたが求めている一括除去戦略をお勧めしません。重要なものを取り除き、インストールを完全に中断するのは簡単すぎます。個々のパッケージのインストールの問題を解決することに集中してください。 aptの出力は、何がどのように依存するかを知らせるのにとても良いです。この問題を解決するには、依存関係に従ってください。

将来の問題を解決するのに役立つように、失敗したインストールログをアーカイブしてください。当初、これらのパッケージが構成に失敗する理由を理解していないため、適切なヘルプを提供できません。

おすすめ記事