Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say Ubuntu's repositories features a package.

I install that package using apt-get.

I then add an additional source (with add-apt-repository) that lists either a newer or older version of the package.

Will apt-get always upgrade to the latest version, regardless of which source offers the latest version?

share|improve this question
up vote 7 down vote accepted

APT will always install the latest version that isn't excluded by preferences. Preferences are indicated in the file /etc/apt/preferences (and in files under /etc/apt/preferences.d).

Some repositories have a configuration that prevents their packages from being installed automatically. For example, the Debian backports have release files (which you can see in /var/lib/apt/lists) that contain

NotAutomatic: yes
ButAutomaticUpgrades: yes

If you have multiple sources for the exact same package (i.e. same package name, same version number), then APT downloads from the first source found in /etc/apt/sources.list (or /etc/apt/sources.list.d/*). So list local mirrors first. The order in sources.list is irrelevant for packages that have a different version number.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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