apt appears to be confused when installing a backport that version depends on other backports

Bug #1512219 reported by Stéphane Graber on 2015-11-02
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
High
Unassigned

Bug Description

This was seen in trusty where backports are pretty widely used.

We backported the whole lxc+lxd stack (golang, libseccomp, cgmanager, lxcfs, lxc, lxd) with some added version dependencies everywhere it made sense so that when pulling lxd, everything would be installed with the right version.

The assumption was that since lxd didn't exist in 14.04 and that as backports are enabled there by default, a simple "apt-get install lxd" would work.

That's not the case, it fails with:
root@blah:~# apt-get install lxd
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:
 lxd : Depends: lxc (>= 1.1.4-0ubuntu1.1~) but 1.0.7-0ubuntu0.9 is to be installed
       Recommends: lxd-client but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Showing more resolver details show:
 Broken lxd:amd64 Depends on lxc [ amd64 ] < none -> 1.0.7-0ubuntu0.9 | 1.1.4-0ubuntu1.1~ubuntu14.04.1 > ( admin ) (>= 1.1.4-0ubuntu1.1~)
 Considering lxc:amd64 0 as a solution to lxd:amd64 9999
 Re-Instated liblxc1:amd64
 Re-Instated python3-lxc:amd64
 Re-Instated lxc:amd64

I then tried installing with "apt-get install lxd/trusty-backports" which got me roughly the same thing:
root@blah:~# apt-get install lxd/trusty-backports
Reading package lists... Done
Building dependency tree
Reading state information... Done
Selected version '0.21-0ubuntu3~ubuntu14.04.1' (Ubuntu:14.04/trusty-backports [amd64]) for 'lxd'
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:
 lxd : Depends: lxc (>= 1.1.4-0ubuntu1.1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

So in the end, I had to use "apt-get -t trusty-backports install lxd" which did succeed in pulling everything from backports.

This seems like an apt bug as apt is clever enough to go pick things from backports when they're available nowhere else, one would expect that it would do the same when picking the dependencies of such a backport when they are in the same pocket as the backport, instead of failing to resolve the dependencies.

It'd be great if people could use a straight apt-get install for non-existing packages or the /trusty-backports packages to pull specific packages from backports during install, instead of having to rely on a separate apt-get run with -t trusty-backports specified.

Also it looks like our existing backports documentation points users to the /trusty-backports syntax which will not work for any reasonably complex backport which involves more than one package.

Michael Vogt (mvo) wrote :

Thanks for your bugreport.

I looked into this issue and it seems like its indeed a bug in apt that it will not properly do a version check when switching the candidate version to trusty-backports.

Attached is a patch that adds some debug code and also a potential fix for the problem, it breaks one of the existing tests, I need to inspect if the test is incorrect though. So its probably not the final diff but it highlights the prolem area.

For it to fully work you need to adjust the python3-lxc dependency in lxc too, please add something like:
  Depends: python3, python3-lxc (>= 1.1.4-0ubuntu1.1~ubuntu14.04.1)
(i.e. ensure that apt knows it needs to pick a reasonable high version). This is useful regardless of the diff.

Michael Vogt (mvo) wrote :
Changed in apt (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
importance: Medium → High
tags: added: patch
Stéphane Graber (stgraber) wrote :

Hi Michael, I have uploaded an updated lxc to the trusty-backports queue. Will ping someone on the backports team to get it in, thanks.

T T (netti+ubuntu) wrote :

I don't think apt resolving is fixed yet in trusty apt=1.0.1ubuntu2.13 (27.4.2016)

To get lxd installed, this is what I used:
apt-get install lxd/trusty-backports lxc/trusty-backports liblxc1/trusty-backports python3-lxc/trusty-backports

Stéphane Graber (stgraber) wrote :

"apt-get -t trusty-backports install lxd" would have been significantly easier and less error prone.

But yes, the apt bug itself hasn't been fixed as can be seen by this bug still being open.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Patches