3

On my Debian Testing box, I have the following in /etc/apt/sources.list:

deb http://ftp.us.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.us.debian.org/debian/ testing main contrib non-free

deb http://security.debian.org/ testing/updates main contrib non-free
deb-src http://security.debian.org/ testing/updates main contrib non-free

deb http://ftp.us.debian.org/debian/ testing-updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ testing-updates main contrib non-free

deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse proposed partner
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse

deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse proposed partner
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse

Then suppose that I run sudo apt install libre-office. I see that it selects some required packages from ftp.us.debian.org and some from us.archive.ubuntu.com. How does APT decide which source to grab each package from?

4

The algorithm is described in much detail in the apt_preferences man page. In short, apt calculates a score for every version it knows about, based on command line options, configuration, and already installed packages. It then installs the version with the highest score.

You can tweak things by specifying explicit scores for explicit sources, as described in the same man page.

On a side note, mixing versions from Debian and Ubuntu like that is highly unlikely to work well; I would recommend against it.

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.