I manage an apt repository, for package PACKAGE, which has dependency (DEPENDENCY<<1.2). Both PACKAGE and DEPENDENCY are available in my repository.

We just released a version of DEPENDENCY (version 4.0.0), and now installing the same PACKAGE on a completely clean machine fails with the error:

The following packages have unmet dependencies:
 PACKAGE : Depends: DEPENDENCY (< 1.2.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

If I check the versions of DEPENDENCY available, I can see that there are known packages which meet the << 1.2 requirement:

sudo apt list -a DEPENDENCY
Listing... Done
DEPENDENCY/stable 4.0.0 all
DEPENDENCY/stable 1.1.12 all
DEPENDENCY/stable 1.1.11 all
DEPENDENCY/stable 1.1.10 all

Since I actually manage the package AND the dependency I can fix this on the repository side, but how? Why doesn't apt recognise the correct dependencies?

(Doing apt --fix-broken won't work because the packages are somehow broken on the server side).


APT doesn’t resolve versions of packages based on requirements, but rather based on availability (and priorities). Put another way, it is really designed to work with coherent repositories, i.e. repositories with single versions of packages, where all related packages can be installed with the versions in the repository. (That’s how the Debian repositories work most of the time, and is a requirement for the release repositories.)

Even though DEPENDENCY is available in multiple versions in the same suite, APT will consider the highest version only, 4.0.0, unless told otherwise.

You’ll probably need to help APT resolve the situation manually:

apt install PACKAGE DEPENDENCY=1.1.12

and even then I’m not 100% sure that will work.

As a general solution, you’d have to use different suites in your repository, and make sure PACKAGE and DEPENDENCY are present in mutually-acceptable versions in the same suite; version 4.0.0 of DEPENDENCY would therefore go in a different suite, without PACKAGE, until PACKAGE is available in a compatible version.

| improve this answer | |
  • thank you for the reply! It looks as though I should rethink the whole structure of my repository. – jenny Dec 12 '19 at 15:37

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.