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

ivan_pozdeev asked:

For example, in

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

My answer:

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.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.