Ubuntu – Do ‘..-backports’ repositories automatically take precedence over the standard repos? in sources.list

aptsoftware-sources

Is the order of ..-backports repositories in sources.list significant?
…or does ..-backports take precedence over the standard entries, regardless of placement?

Are the two following examples effectively the same?

deb http://archive.ubuntu.com/ubuntu lucid-updates   main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse

vs.

deb http://archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu lucid-updates   main restricted universe multiverse

Best Answer

The packages in backports always have higher version numbers than the other standard repos, so effectively yes.

Traditionally, this has been correct. Because backports always have higher version numbers than the other pockets, if they are enabled, they will be preferred.

However, this has actually changed in recent Ubuntu versions. For the 10.04 (Natty) release, we changed apt so that it only installs backports if they are specifically requested (which you can do by adding the -t oneiric-backports (or similar) flag to apt-get.

(None of this is affected by the order of entries in your sources.list files; those are only used if multiple lines provide the exact same version of a package, in which case we fetch it from the first-listed one)