1 .\" Title: apt_preferences
3 .\" Generator: DocBook XSL Stylesheets v1.71.0 <http://docbook.sf.net/>
4 .\" Date: 29 February 2004
8 .TH "APT_PREFERENCES" "5" "29 February 2004" "Linux" ""
9 .\" disable hyphenation
11 .\" disable justification (adjust text to left margin only)
14 apt_preferences \- Preference control file for APT
17 The APT preferences file
18 \fI/etc/apt/preferences\fR
19 can be used to control which versions of packages will be selected for installation.
21 Several versions of a package may be available for installation when the
23 file contains references to more than one distribution (for example,
26 testing). APT assigns a priority to each version that is available. Subject to dependency constraints,
28 selects the version with the highest priority for installation. The APT preferences file overrides the priorities that APT assigns to package versions by default, thus giving the user control over which one is selected for installation.
30 Several instances of the same version of a package may be available when the
32 file contains references to more than one source. In this case
34 downloads the instance listed earliest in the
36 file. The APT preferences file does not affect the choice of instance, only the choice of version.
37 .SS "APT's Default Priority Assignments"
39 If there is no preferences file or if there is no entry in the file that applies to a particular version then the priority assigned to that version is the priority of the distribution to which that version belongs. It is possible to single out a distribution, "the target release", which receives a higher priority than other distributions do by default. The target release can be set on the
41 command line or in the APT configuration file
42 \fI/etc/apt/apt.conf\fR. For example,
46 \fBapt\-get install \-t testing \fR\fB\fIsome\-package\fR\fR
54 APT::Default\-Release "stable";
59 If the target release has been specified then APT uses the following algorithm to set the priorities of the versions of a package. Assign:
63 to the version that is already installed (if any).
68 to the versions that are not installed and do not belong to the target release.
73 to the versions that are not installed and belong to the target release.
76 If the target release has not been specified then APT simply assigns priority 100 to all installed package versions and priority 500 to all uninstalled package versions.
78 APT then applies the following rules, listed in order of precedence, to determine which version of a package to install.
81 Never downgrade unless the priority of an available version exceeds 1000. ("Downgrading" is installing a less recent version of a package in place of a more recent version. Note that none of APT's default priorities exceeds 1000; such high priorities can only be set in the preferences file. Note also that downgrading a package can be risky.)
84 Install the highest priority version.
87 If two or more versions have the same priority, install the most recent one (that is, the one with the higher version number).
90 If two or more versions have the same priority and version number but either the packages differ in some of their metadata or the
92 option is given, install the uninstalled one.
96 In a typical situation, the installed version of a package (priority 100) is not as recent as one of the versions available from the sources listed in the
98 file (priority 500 or 990). Then the package will be upgraded when
99 \fBapt\-get install \fR\fB\fIsome\-package\fR\fR
101 \fBapt\-get upgrade\fR
104 More rarely, the installed version of a package is
106 recent than any of the other available versions. The package will not be downgraded when
107 \fBapt\-get install \fR\fB\fIsome\-package\fR\fR
109 \fBapt\-get upgrade\fR
112 Sometimes the installed version of a package is more recent than the version belonging to the target release, but not as recent as a version belonging to some other distribution. Such a package will indeed be upgraded when
113 \fBapt\-get install \fR\fB\fIsome\-package\fR\fR
115 \fBapt\-get upgrade\fR
116 is executed, because at least
118 of the available versions has a higher priority than the installed version.
119 .SS "The Effect of APT Preferences"
121 The APT preferences file allows the system administrator to control the assignment of priorities. The file consists of one or more multi\-line records separated by blank lines. Records can have one of two forms, a specific form and a general form.
124 The specific form assigns a priority (a "Pin\-Priority") to a specified package and specified version or version range. For example, the following record assigns a high priority to all versions of the
126 package whose version number begins with "5.8".
137 The general form assigns a priority to all of the package versions in a given distribution (that is, to all the versions of packages that are listed in a certain
139 file) or to all of the package versions coming from a particular Internet site, as identified by the site's fully qualified domain name.
141 This general\-form entry in the APT preferences file applies only to groups of packages. For example, the following record assigns a high priority to all package versions available from the local site.
150 A note of caution: the keyword used here is "origin". This should not be confused with the Origin of a distribution as specified in a
152 file. What follows the "Origin:" tag in a
154 file is not an Internet address but an author or vendor name, such as "Debian" or "Ximian".
156 The following record assigns a low priority to all package versions belonging to any distribution whose Archive name is "unstable".
161 Pin: release a=unstable
165 The following record assigns a high priority to all package versions belonging to any release whose Archive name is "stable" and whose release Version number is "3.0".
170 Pin: release a=stable, v=3.0
176 .SS "How APT Interprets Priorities"
178 Priorities (P) assigned in the APT preferences file must be positive or negative integers. They are interpreted as follows (roughly speaking):
182 causes a version to be installed even if this constitutes a downgrade of the package
187 causes a version to be installed even if it does not come from the target release, unless the installed version is more recent
192 causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent
197 causes a version to be installed unless there is a version available belonging to some other distribution or the installed version is more recent
202 causes a version to be installed only if there is no installed version of the package
207 prevents the version from being installed
210 If any specific\-form records match an available package version then the first such record determines the priority of the package version. Failing that, if any general\-form records match an available package version then the first such record determines the priority of the package version.
212 For example, suppose the APT preferences file contains the three records presented earlier:
225 Pin: release unstable
233 The most recent available version of the
235 package will be installed, so long as that version's version number begins with "5.8". If
239 is available and the installed version is 5.9*, then
244 A version of any package other than
246 that is available from the local system has priority over other versions, even versions belonging to the target release.
249 A version of a package whose origin is not the local system but some other site listed in
250 \fBsources.list\fR(5)
251 and which belongs to an
253 distribution is only installed if it is selected for installation and no version of the package is already installed.
256 .SS "Determination of Package Version and Distribution Properties"
258 The locations listed in the
259 \fBsources.list\fR(5)
264 files to describe the packages available at that location.
268 file is normally found in the directory
269 \fI.../dists/\fR\fI\fIdist\-name\fR\fR\fI/\fR\fI\fIcomponent\fR\fR\fI/\fR\fI\fIarch\fR\fR: for example,
270 \fI.../dists/stable/main/binary\-i386/Packages\fR. It consists of a series of multi\-line records, one for each package available in that directory. Only two lines in each record are relevant for setting APT priorities:
274 gives the package name
279 gives the version number for the named package
284 file is normally found in the directory
285 \fI.../dists/\fR\fI\fIdist\-name\fR\fR: for example,
286 \fI.../dists/stable/Release\fR, or
287 \fI.../dists/woody/Release\fR. It consists of a single multi\-line record which applies to
289 of the packages in the directory tree below its parent. Unlike the
291 file, nearly all of the lines in a
293 file are relevant for setting APT priorities:
297 names the archive to which all the packages in the directory tree belong. For example, the line "Archive: stable" specifies that all of the packages in the directory tree below the parent of the
301 archive. Specifying this value in the APT preferences file would require the line:
305 Pin: release a=stable
312 names the release version. For example, the packages in the tree might belong to Debian GNU/Linux release version 3.0. Note that there is normally no version number for the
316 distributions because they have not been released yet. Specifying this in the APT preferences file would require one of the following lines.
321 Pin: release a=stable, v=3.0
329 names the licensing component associated with the packages in the directory tree of the
331 file. For example, the line "Component: main" specifies that all the packages in the directory tree are from the
333 component, which entails that they are licensed under terms listed in the Debian Free Software Guidelines. Specifying this component in the APT preferences file would require the line:
344 names the originator of the packages in the directory tree of the
346 file. Most commonly, this is
347 Debian. Specifying this origin in the APT preferences file would require the line:
351 Pin: release o=Debian
358 names the label of the packages in the directory tree of the
360 file. Most commonly, this is
361 Debian. Specifying this label in the APT preferences file would require the line:
365 Pin: release l=Debian
374 files retrieved from locations listed in the
375 \fBsources.list\fR(5)
376 file are stored in the directory
377 \fI/var/lib/apt/lists\fR, or in the file named by the variable
381 file. For example, the file
382 \fIdebian.lcs.mit.edu_debian_dists_unstable_contrib_binary\-i386_Release\fR
385 file retrieved from the site
389 architecture files from the
394 .SS "Optional Lines in an APT Preferences Record"
396 Each record in the APT preferences file can optionally begin with one or more lines beginning with the word
397 Explanation:. This provides a place for comments.
401 line in each APT preferences record is optional. If omitted, APT assigs a priority of 1 less than the last value specified on a line beginning with
402 Pin\-Priority: release ....
404 .SS "Tracking Stable"
406 The following APT preferences file will cause APT to assign a priority higher than the default (500) to all package versions belonging to a
408 distribution and a prohibitively low priority to package versions belonging to other
414 Explanation: Uninstall or do not install any Debian\-originated
415 Explanation: package versions other than those in the stable distro
417 Pin: release a=stable
421 Pin: release o=Debian
428 \fBsources.list\fR(5)
429 file and the above preferences file, any of the following commands will cause APT to upgrade to the latest
435 apt\-get install \fIpackage\-name\fR
437 apt\-get dist\-upgrade
442 The following command will cause APT to upgrade the specified package to the latest version from the
444 distribution; the package will not be upgraded again unless this command is given again.
448 apt\-get install \fIpackage\fR/testing
452 .SS "Tracking Testing or Unstable"
454 The following APT preferences file will cause APT to assign a high priority to package versions from the
456 distribution, a lower priority to package versions from the
458 distribution, and a prohibitively low priority to package versions from other
465 Pin: release a=testing
469 Pin: release a=unstable
473 Pin: release o=Debian
480 \fBsources.list\fR(5)
481 file and the above preferences file, any of the following commands will cause APT to upgrade to the latest
487 apt\-get install \fIpackage\-name\fR
489 apt\-get dist\-upgrade
494 The following command will cause APT to upgrade the specified package to the latest version from the
496 distribution. Thereafter,
497 \fBapt\-get upgrade\fR
498 will upgrade the package to the most recent
500 version if that is more recent than the installed version, otherwise, to the most recent
502 version if that is more recent than the installed version.
506 apt\-get install \fIpackage\fR/unstable
515 \fBsources.list\fR(5)
518 [1]\&\fIAPT bug page\fR. If you wish to report a bug in APT, please see
519 \fI/usr/share/doc/debian/bug\-reporting.txt\fR
532 \%http://bugs.debian.org/src:apt