apt-get:「...しかしインストールされていません」の理由[重複]

apt-get:「...しかしインストールされていません」の理由[重複]

そのため、apt-getは、依存関係が「インストールされていない」ためにパッケージのインストールが失敗したという悪名高いメッセージでもう一度私を悩ませました。

~ $ sudo apt-get install php-apcu
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-apcu : Depends: phpapi-20151012
            Recommends: php-apcu-bc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

私が理解したのは、デフォルトは、欠落しているすべての依存関係と要求されたパッケージをインストールすることです。 apt-getが特定の依存関係のインストールを拒否する原因は何ですか? (この問題の原因が2つ以上の場合は、原因が何であるかをどうやって知ることができますか?)

ベストアンサー1

簡単に言うと: <foobar> is not going to be installed<foobar>依存関係自体が何らかの理由で満たすことができない一種の依存関係を持っていることを示唆しています。

再実行しapt-getて問題になる依存関係をコマンドラインに明示的に含めると、問題が何であるかをよりよく理解できます。


上記の例では、私はこれを得ます:

~ $ sudo apt-get install php-apcu php-apcu-bc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-apcu : Depends: phpapi-20151012
 php-apcu-bc : Depends: phpapi-20151012
E: Unable to correct problems, you have held broken packages.

そして:

~ $ sudo apt-get install php-apcu php-apcu-bc phpapi-20151012
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package phpapi-20151012 is a virtual package provided by:
  php7.0-phpdbg 7.0.22-3
  php7.0-fpm 7.0.22-3
  php7.0-cli 7.0.22-3
  php7.0-cgi 7.0.22-3
  libphp7.0-embed 7.0.22-3
  libapache2-mod-php7.0 7.0.22-3
You should explicitly select one to install.

E: Package 'phpapi-20151012' has no installation candidate

したがって、ここでの問題は、最初に要求されたパッケージphp-apcuがに依存しphp-apcu-bc、このパッケージもに依存することですphpapi-20151012。後者は直接インストールできるパッケージではなく、複数のパッケージで提供される機能なので、apt-getはインストールする必要がある項目を自動的に決定することはできません。

この特定のケースの根本的な原因は、PHP5を実行しているシステムにPHP7パッケージをインストールしようとし、php-apcu正しいパッケージですphp5-apcu

おすすめ記事