Get more information from apt-get if it reports an "impossible situation"

For example, in 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's error message is spectacularly unhelpful.

Is there a way to make it report more about what exactly it finds "impossible"? E.g. what combinations it's considering and what roadblocks encountering etc.

rpm, for example, explicitly tells me if there are conflicts.


In this particular case you can get more information by explicitly including the dependency which "is not going to be installed" in the list of packages to install in your apt command. Then you will get a more specific error for each of the packages explaining why it cannot be installed.

In the example case you gave, you could do something like:

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

then try the apt install command again.


As per debian - How can I identify the packages with conflicting dependencies? - Unix & Linux Stack Exchange, that'll be:

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

In this particular case, it said:

++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.

Which means that conflicting packages mysql-client-core-5.7 and mysql-server-core-5.7 are installed. Since the resolver didn't consider replacing them, they must be marked as manually installed.