e.g. if package specifies

Depends: www-browser

How does apt/dpkg decide which real package will be installed?

1 Answer 1


According to this answer on Ask Ubuntu, apt will first try to install any non-virtual packages listed as options instead:

Now, according to sources, apt tries first of satisfying the dependency before trying with virtual packages (i.e., if depends are firefox | www-browser, checks if any of the packages are installed, then try to install firefox if neither is).

If not, it will simply iterate over the list of packages that provide the virtual one, and install the first one that it can:

If the non-virtual package isn't available, it seems to just iterate over all packages which provides the virtual package, if no other dependencies are broken. Other comments evidence of this behavior are this which leads to GrpIterator::FindPreferredPkg function.

  • It is discouraged to use pure virtual dependencies, usually you'd give one real and one virtual package as in your example. For Build-Depends, this is required by policy as well, as "or" relationships are ignored by autobuilders. Jan 1, 2019 at 5:06
  • @SimonRichter Yes, it makes sense to discourage purely virtual dependencies because apt will just install any package that provides it, which is rarely what you'd want. Jan 1, 2019 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .