1

Package A_0.0_all.deb's control file contains a dependency on Package B 0.0:

Depends: B (= 0.0)

Package B_0.0_all.deb's control file has the version 0.0:

Version: 0.0

Sitting in the same Debian repository is Package B_1.0_all.deb. When I try to install Package A, I get the following error:

[...]
The following packages have unmet dependencies:
 A : Depends: B (= 0.0) but 1.0 is to be installed.
E: Unable to correct problems, you have held broken packages.

An "apt-cache madison B" show both versions in the repo. Why won't apt-get install the version that A depends on? Is the control file wrong? How do you write the Depends: so that apt-get installs the exact version specified in the Package A's control file?

I'm building on, create the repo with, and installing with:

  • Ubuntu 13.04
  • apt 0.9.7.7ubuntu4 for amd64 compiled on Apr 12 2013 23:49:05
  • The Depends field is working exactly as expected. apt-get will prioritize the highest version/repository with highest priority. There's nothing you can do in Depends that will make apt install a lower version in favour of a higher version. – muru May 19 '15 at 23:14
  • Is there anything I can do in the control file to get apt to install a specified lower version? – user2569618 May 19 '15 at 23:23
  • Nope. Either the repository shouldn't serve a higher version, or apt's client-side configuration should use apt-preferences to prefer the lower version. Nothing your package can do by itself. – muru May 19 '15 at 23:24
  • One more question, do you know where I could find a good apt-preferences example regarding my situation? – user2569618 May 19 '15 at 23:30
  • See debian.org/doc/manuals/apt-howto/ch-apt-get.en.html#s-pin - the example shows pinning by version. – muru May 19 '15 at 23:32
0

Apt does not consider multiple versions of the same package. It chooses one (based on a combination of version numbers, pinning etc) and then it will either install that version or not install the package at all.

Aptitude will consider lower versions of the package but later upgrades will attempt to upgrade those lower versions which may result in your software getting inadvertantly removes.

So to the best of my knowlage there is no real way to do what you want. You either make the version number of your package higher than the one in the distro (possiblly by using an epoch), use a different package name or tell your users to set up pinning.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.