如果 apt-get 报告“不可能的情况”,则从其获取更多信息

如果 apt-get 报告“不可能的情况”,则从其获取更多信息

例如,在https://travis-ci.org/mysql-d/mysql-native/jobs/592298238

$ PACKAGES='mariadb-server-10.1'
<...>
$ sudo apt-get install -y -o Dpkg::Options::='--force-confnew' $PACKAGES
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:
 mariadb-server-10.1 : Depends: mariadb-client-10.1 (>= 10.1.41+maria-~xenial) but it is not going to be installed
                       Depends: mariadb-server-core-10.1 (>= 10.1.41+maria-1~xenial) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

apt-get的错误信息毫无帮助。

有没有办法让它详细报告它认为“不可能”的事情?例如,它正在考虑哪些组合以及遇到哪些障碍等等。

rpm例如,明确告诉我是否存在冲突。

答案1

在这种特殊情况下,您可以通过在 apt 命令中要安装的软件包列表中明确包含“不会安装”的依赖项来获取更多信息。然后,您将获得每个软件包的更具体的错误,解释无法安装的原因。

在您给出的示例中,您可以执行以下操作:

PACKAGES='mariadb-server-10.1 mariadb-client-10.1 mariadb-server-core-10.1'

然后再次尝试 apt install 命令。

答案2

按照debian - 如何识别具有冲突依赖关系的软件包? - Unix & Linux Stack Exchange, 那会:

apt -o Debug::pkgProblemResolver=yes install $PACKAGES

在这个特殊案例中,它说

++sudo apt-get install -y -o Debug::pkgProblemResolver=yes -o Dpkg::Options::=--force-confnew mariadb-server-10.1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Starting pkgProblemResolver with broken count: 1
Starting 2 pkgProblemResolver with broken count: 1
Investigating (0) mariadb-server-10.1 [ amd64 ] < none -> 10.1.41+maria-1~xenial > ( database )
Broken mariadb-server-10.1:amd64 Depends on mariadb-client-10.1 [ amd64 ] < none -> 10.1.41+maria-1~xenial > ( database ) (>= 10.1.41+maria-1~xenial)
  Considering mariadb-client-10.1:amd64 0 as a solution to mariadb-server-10.1:amd64 9999
  Re-Instated mariadb-client-core-10.1:amd64
  Re-Instated mariadb-client-10.1:amd64
Broken mariadb-server-10.1:amd64 Depends on mariadb-server-core-10.1 [ amd64 ] < none -> 10.1.41+maria-1~xenial > ( database ) (>= 10.1.41+maria-1~xenial)
  Considering mariadb-server-core-10.1:amd64 0 as a solution to mariadb-server-10.1:amd64 9999
  Re-Instated mariadb-server-core-10.1:amd64
Investigating (0) mysql-client-core-5.7 [ amd64 ] < 5.7.25-0ubuntu0.16.04.2 -> 5.7.27-0ubuntu0.16.04.1 > ( database )
Broken mysql-client-core-5.7:amd64 Conflicts on mysql-client-5.5 [ amd64 ] < none ->  > ( none )
  Considering mariadb-client-10.1:amd64 0 as a solution to mysql-client-core-5.7:amd64 1
  Added mariadb-client-10.1:amd64 to the remove list
Broken mysql-client-core-5.7:amd64 Conflicts on mysql-client-core-5.5 [ amd64 ] < none ->  > ( none )
  Considering mariadb-client-core-10.1:amd64 0 as a solution to mysql-client-core-5.7:amd64 1
  Added mariadb-client-core-10.1:amd64 to the remove list
Broken mysql-client-core-5.7:amd64 Conflicts on virtual-mysql-client-core [ amd64 ] < none ->  > ( none )
  Considering mariadb-client-core-10.1:amd64 0 as a solution to mysql-client-core-5.7:amd64 1
  Added mariadb-client-core-10.1:amd64 to the remove list
  Conflicts//Breaks against version 10.0.38-0ubuntu0.16.04.1 for mariadb-client-core-10.0 but that is not InstVer, ignoring
  Conflicts//Breaks against version 10.0.24-7 for mariadb-client-core-10.0 but that is not InstVer, ignoring
  Fixing mysql-client-core-5.7:amd64 via keep of mariadb-client-10.1:amd64
  Fixing mysql-client-core-5.7:amd64 via keep of mariadb-client-core-10.1:amd64
  Fixing mysql-client-core-5.7:amd64 via keep of mariadb-client-core-10.1:amd64
Investigating (0) mysql-server-core-5.7 [ amd64 ] < 5.7.25-0ubuntu0.16.04.2 -> 5.7.27-0ubuntu0.16.04.1 > ( database )
Broken mysql-server-core-5.7:amd64 Conflicts on mysql-server-core-5.5 [ amd64 ] < none ->  > ( none )
  Considering mariadb-server-core-10.1:amd64 0 as a solution to mysql-server-core-5.7:amd64 0
  Re-Instated mysql-server-core-5.7:amd64
Investigating (0) mariadb-server-core-10.1 [ amd64 ] < none -> 10.1.41+maria-1~xenial > ( database )
Broken mariadb-server-core-10.1:amd64 Conflicts on virtual-mysql-server-core [ amd64 ] < none ->  > ( none )
  Conflicts//Breaks against version 5.7.25-0ubuntu0.16.04.2 for mysql-server-core-5.7 but that is not InstVer, ignoring
  Conflicts//Breaks against version 5.6.37-26.21-0ubuntu0.16.04.2 for percona-xtradb-cluster-server-5.6 but that is not InstVer, ignoring
  Conflicts//Breaks against version 5.6.22-rel71.0-0ubuntu4.1 for percona-server-server-5.6 but that is not InstVer, ignoring
  Conflicts//Breaks against version 10.0.38-0ubuntu0.16.04.1 for mariadb-server-core-10.0 but that is not InstVer, ignoring
  Holding Back mariadb-server-core-10.1:amd64 rather than change virtual-mysql-server-core:amd64
Investigating (1) mariadb-server-10.1 [ amd64 ] < none -> 10.1.41+maria-1~xenial > ( database )
Broken mariadb-server-10.1:amd64 Depends on mariadb-client-10.1 [ amd64 ] < none -> 10.1.41+maria-1~xenial > ( database ) (>= 10.1.41+maria-1~xenial)
  Considering mariadb-client-10.1:amd64 0 as a solution to mariadb-server-10.1:amd64 9999
Broken mariadb-server-10.1:amd64 Depends on mariadb-server-core-10.1 [ amd64 ] < none -> 10.1.41+maria-1~xenial > ( database ) (>= 10.1.41+maria-1~xenial)
  Considering mariadb-server-core-10.1:amd64 0 as a solution to mariadb-server-10.1:amd64 9999
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:
 mariadb-server-10.1 : Depends: mariadb-client-10.1 (>= 10.1.41+maria-1~xenial) but it is not going to be installed
                       Depends: mariadb-server-core-10.1 (>= 10.1.41+maria-1~xenial) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

这意味着安装了冲突的软件包mysql-client-core-5.7mysql-server-core-5.7。由于解析器没有考虑替换它们,因此必须将它们标记为手动安装。

相关内容