]> git.saurik.com Git - apt.git/blame - doc/apt_preferences.5.xml
Merge branch 'debian/sid' into bugfix/update-progress-reporting
[apt.git] / doc / apt_preferences.5.xml
CommitLineData
24f6490f 1<?xml version="1.0" encoding="utf-8" standalone="no"?>
81cf16a2
DK
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
b2e465d6
AL
4
5<!ENTITY % aptent SYSTEM "apt.ent">
6%aptent;
7
0c1a7101
DK
8<!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
9%aptverbatiment;
10
694ef56e
DK
11<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
12%aptvendor;
b2e465d6
AL
13]>
14
15<refentry>
ec2853a7 16
5e80de29
AL
17 <refentryinfo>
18 &apt-author.team;
19 &apt-email;
20 &apt-product;
21 <!-- The last update date -->
dabb215c 22 <date>2012-06-09T00:00:00Z</date>
5e80de29
AL
23 </refentryinfo>
24
b2e465d6 25 <refmeta>
24f6490f
AL
26 <refentrytitle>apt_preferences</refentrytitle>
27 <manvolnum>5</manvolnum>
f0599b9c 28 <refmiscinfo class="manual">APT</refmiscinfo>
b2e465d6 29 </refmeta>
ec2853a7 30
b2e465d6
AL
31 <!-- Man page title -->
32 <refnamediv>
24f6490f
AL
33 <refname>apt_preferences</refname>
34 <refpurpose>Preference control file for APT</refpurpose>
b2e465d6 35 </refnamediv>
b2e465d6 36
24f6490f
AL
37<refsect1>
38<title>Description</title>
39<para>The APT preferences file <filename>/etc/apt/preferences</filename>
daa4aa52
DK
40and the fragment files in the <filename>/etc/apt/preferences.d/</filename>
41folder can be used to control which versions of packages will be selected
24f6490f 42for installation.</para>
ec2853a7 43
24f6490f 44<para>Several versions of a package may be available for installation when
ec2853a7 45the &sources-list; file contains references to more than one distribution
5b9d504e
AL
46(for example, <literal>stable</literal> and <literal>testing</literal>).
47APT assigns a priority to each version that is available.
48Subject to dependency constraints, <command>apt-get</command> selects the
408a8e0a 49version with the highest priority for installation.
44477002 50The APT preferences override the priorities that APT assigns to
5b9d504e 51package versions by default, thus giving the user control over which
24f6490f
AL
52one is selected for installation.</para>
53
54<para>Several instances of the same version of a package may be available when
408a8e0a
AL
55the &sources-list; file contains references to more than one source.
56In this case <command>apt-get</command> downloads the instance listed
5b9d504e 57earliest in the &sources-list; file.
44477002 58The APT preferences do not affect the choice of instance, only
24f6490f 59the choice of version.</para>
ec2853a7 60
d9dedf30
DK
61<para>Preferences are a strong power in the hands of a system administrator
62but they can become also their biggest nightmare if used without care!
44477002 63APT will not question the preferences, so wrong settings can
d9dedf30 64lead to uninstallable packages or wrong decisions while upgrading packages.
44477002 65Even more problems will arise if multiple distribution releases are mixed
d9dedf30 66without a good understanding of the following paragraphs.
44477002
JR
67Packages included in a specific release aren't tested in (and
68therefore don't always work as expected in) older or newer releases, or
37049546 69together with other packages from different releases.
d9dedf30
DK
70You have been warned.</para>
71
e29a6bb1
DK
72<para>Note that the files in the <filename>/etc/apt/preferences.d</filename>
73directory are parsed in alphanumeric ascending order and need to obey the
1fc8c922
MV
74following naming convention: The files have either no or "<literal>pref</literal>"
75as filename extension and only contain alphanumeric, hyphen (-),
7376837d 76underscore (_) and period (.) characters.
44477002
JR
77Otherwise APT will print a notice that it has ignored a file, unless that
78file matches a pattern in the <literal>Dir::Ignore-Files-Silently</literal>
0ca491a7 79configuration list - in which case it will be silently ignored.</para>
e29a6bb1 80
24f6490f 81<refsect2><title>APT's Default Priority Assignments</title>
ec2853a7 82
24f6490f 83<para>If there is no preferences file or if there is no entry in the file
408a8e0a
AL
84that applies to a particular version then the priority assigned to that
85version is the priority of the distribution to which that version
86belongs. It is possible to single out a distribution, "the target release",
87which receives a higher priority than other distributions do by default.
88The target release can be set on the <command>apt-get</command> command
89line or in the APT configuration file <filename>/etc/apt/apt.conf</filename>.
99fc3e08
LB
90Note that this has precedence over any general priority you set in the
91<filename>/etc/apt/preferences</filename> file described later, but not
92over specifically pinned packages.
408a8e0a 93For example,
24f6490f 94
408a8e0a
AL
95<programlisting>
96<command>apt-get install -t testing <replaceable>some-package</replaceable></command>
97</programlisting>
98<programlisting>
99APT::Default-Release "stable";
100</programlisting>
ec2853a7
AL
101</para>
102
24f6490f 103<para>If the target release has been specified then APT uses the following
408a8e0a 104algorithm to set the priorities of the versions of a package. Assign:
24f6490f 105
ec2853a7 106<variablelist>
10df254b
DK
107<varlistentry>
108<term>priority 1</term>
109<listitem><simpara>to the versions coming from archives which in their <filename>Release</filename>
fcaf14fe 110files are marked as "NotAutomatic: yes" but <emphasis>not</emphasis> as "ButAutomaticUpgrades: yes"
44477002 111like the Debian <literal>experimental</literal> archive.</simpara></listitem>
10df254b
DK
112</varlistentry>
113
ec2853a7
AL
114<varlistentry>
115<term>priority 100</term>
fcaf14fe
DK
116<listitem><simpara>to the version that is already installed (if any) and to the versions coming
117from archives which in their <filename>Release</filename> files are marked as "NotAutomatic: yes" and
44477002 118"ButAutomaticUpgrades: yes" like the Debian backports archive since <literal>squeeze-backports</literal>.
fcaf14fe 119</simpara></listitem>
ec2853a7 120</varlistentry>
24f6490f 121
ec2853a7
AL
122<varlistentry>
123<term>priority 500</term>
5b9d504e 124<listitem><simpara>to the versions that are not installed and do not belong to the target release.</simpara></listitem>
ec2853a7 125</varlistentry>
24f6490f 126
ec2853a7
AL
127<varlistentry>
128<term>priority 990</term>
5b9d504e 129<listitem><simpara>to the versions that are not installed and belong to the target release.</simpara></listitem>
ec2853a7
AL
130</varlistentry>
131</variablelist>
132</para>
133
24f6490f 134<para>If the target release has not been specified then APT simply assigns
5b9d504e 135priority 100 to all installed package versions and priority 500 to all
a0a1ce6d 136uninstalled package versions, except versions coming from archives which
10df254b 137in their <filename>Release</filename> files are marked as "NotAutomatic: yes" -
fcaf14fe
DK
138these versions get the priority 1 or priority 100 if it is additionally marked
139as "ButAutomaticUpgrades: yes".</para>
ec2853a7 140
24f6490f 141<para>APT then applies the following rules, listed in order of precedence,
5b9d504e 142to determine which version of a package to install.
ec2853a7 143<itemizedlist>
5b9d504e
AL
144<listitem><simpara>Never downgrade unless the priority of an available
145version exceeds 1000. ("Downgrading" is installing a less recent version
146of a package in place of a more recent version. Note that none of APT's
147default priorities exceeds 1000; such high priorities can only be set in
148the preferences file. Note also that downgrading a package
149can be risky.)</simpara></listitem>
150<listitem><simpara>Install the highest priority version.</simpara></listitem>
151<listitem><simpara>If two or more versions have the same priority,
152install the most recent one (that is, the one with the higher version
153number).</simpara></listitem>
154<listitem><simpara>If two or more versions have the same priority and
155version number but either the packages differ in some of their metadata or the
24f6490f 156<literal>--reinstall</literal> option is given, install the uninstalled one.</simpara></listitem>
ec2853a7
AL
157</itemizedlist>
158</para>
159
24f6490f 160<para>In a typical situation, the installed version of a package (priority 100)
5b9d504e
AL
161is not as recent as one of the versions available from the sources listed in
162the &sources-list; file (priority 500 or 990). Then the package will be upgraded
163when <command>apt-get install <replaceable>some-package</replaceable></command>
164or <command>apt-get upgrade</command> is executed.
ec2853a7
AL
165</para>
166
24f6490f 167<para>More rarely, the installed version of a package is <emphasis>more</emphasis> recent
5b9d504e
AL
168than any of the other available versions. The package will not be downgraded
169when <command>apt-get install <replaceable>some-package</replaceable></command>
24f6490f 170or <command>apt-get upgrade</command> is executed.</para>
ec2853a7 171
24f6490f 172<para>Sometimes the installed version of a package is more recent than the
ec2853a7 173version belonging to the target release, but not as recent as a version
5b9d504e
AL
174belonging to some other distribution. Such a package will indeed be upgraded
175when <command>apt-get install <replaceable>some-package</replaceable></command>
176or <command>apt-get upgrade</command> is executed,
24f6490f
AL
177because at least <emphasis>one</emphasis> of the available versions has a higher
178priority than the installed version.</para>
179</refsect2>
ec2853a7 180
24f6490f 181<refsect2><title>The Effect of APT Preferences</title>
ec2853a7 182
24f6490f 183<para>The APT preferences file allows the system administrator to control the
5b9d504e
AL
184assignment of priorities. The file consists of one or more multi-line records
185separated by blank lines. Records can have one of two forms, a specific form
186and a general form.
ec2853a7
AL
187<itemizedlist>
188<listitem>
1c62ab24 189<simpara>The specific form assigns a priority (a "Pin-Priority") to one or more
44477002 190specified packages with a specified version or version range. For example,
5b9d504e 191the following record assigns a high priority to all versions of
44477002 192the <filename>perl</filename> package whose version number begins with "<literal>&good-perl;</literal>".
1c62ab24 193Multiple packages can be separated by spaces.</simpara>
ec2853a7
AL
194
195<programlisting>
196Package: perl
44477002 197Pin: version &good-perl;*
ec2853a7
AL
198Pin-Priority: 1001
199</programlisting>
200</listitem>
201
24f6490f 202<listitem><simpara>The general form assigns a priority to all of the package versions in a
ec2853a7 203given distribution (that is, to all the versions of packages that are
24f6490f 204listed in a certain <filename>Release</filename> file) or to all of the package
5b9d504e 205versions coming from a particular Internet site, as identified by the
24f6490f 206site's fully qualified domain name.</simpara>
ec2853a7 207
24f6490f 208<simpara>This general-form entry in the APT preferences file applies only
5b9d504e 209to groups of packages. For example, the following record assigns a high
24f6490f 210priority to all package versions available from the local site.</simpara>
ec2853a7
AL
211
212<programlisting>
213Package: *
214Pin: origin ""
215Pin-Priority: 999
216</programlisting>
217
4fb6fdaf
DK
218<simpara>A note of caution: the keyword used here is "<literal>origin</literal>"
219which can be used to match a hostname. The following record will assign a high priority
220to all versions available from the server identified by the hostname "ftp.de.debian.org"</simpara>
221<programlisting>
222Package: *
223Pin: origin "ftp.de.debian.org"
224Pin-Priority: 999
225</programlisting>
226<simpara>This should <emphasis>not</emphasis> be confused with the Origin of a distribution as
24f6490f
AL
227specified in a <filename>Release</filename> file. What follows the "Origin:" tag
228in a <filename>Release</filename> file is not an Internet address
229but an author or vendor name, such as "Debian" or "Ximian".</simpara>
ec2853a7 230
24f6490f
AL
231<simpara>The following record assigns a low priority to all package versions
232belonging to any distribution whose Archive name is "<literal>unstable</literal>".</simpara>
ec2853a7
AL
233
234<programlisting>
235Package: *
236Pin: release a=unstable
704c39d6 237Pin-Priority: 50
ec2853a7
AL
238</programlisting>
239
efc487fb 240<simpara>The following record assigns a high priority to all package versions
e1dd65c9 241belonging to any distribution whose Codename is "<literal>&testing-codename;</literal>".</simpara>
efc487fb
DK
242
243<programlisting>
244Package: *
e1dd65c9 245Pin: release n=&testing-codename;
efc487fb
DK
246Pin-Priority: 900
247</programlisting>
248
24f6490f
AL
249<simpara>The following record assigns a high priority to all package versions
250belonging to any release whose Archive name is "<literal>stable</literal>"
44477002 251and whose release Version number is "<literal>&stable-version;</literal>".</simpara>
ec2853a7
AL
252
253<programlisting>
254Package: *
44477002 255Pin: release a=stable, v=&stable-version;
0493db1e 256Pin-Priority: 500
ec2853a7
AL
257</programlisting>
258</listitem>
259</itemizedlist>
260</para>
261
24f6490f 262</refsect2>
ec2853a7 263
44477002 264<refsect2><title>Regular expressions and &glob; syntax</title>
1a4c9766 265<para>
44477002
JR
266APT also supports pinning by &glob; expressions, and regular
267expressions surrounded by slashes. For example, the following
1a4c9766 268example assigns the priority 500 to all packages from
44477002 269experimental where the name starts with gnome (as a &glob;-like
1fc8c922 270expression) or contains the word kde (as a POSIX extended regular
1a4c9766
JAK
271expression surrounded by slashes).
272</para>
273
274<programlisting>
275Package: gnome* /kde/
276Pin: release n=experimental
277Pin-Priority: 500
278</programlisting>
279
280<para>
281The rule for those expressions is that they can occur anywhere
1fc8c922 282where a string can occur. Thus, the following pin assigns the
44477002 283priority 990 to all packages from a release starting with &ubuntu-codename;.
1a4c9766
JAK
284</para>
285
286<programlisting>
287Package: *
44477002 288Pin: release n=&ubuntu-codename;*
1a4c9766
JAK
289Pin-Priority: 990
290</programlisting>
291
2b9b27c3 292<para>
1a4c9766
JAK
293If a regular expression occurs in a <literal>Package</literal> field,
294the behavior is the same as if this regular expression were replaced
295with a list of all package names it matches. It is undecided whether
44477002 296this will change in the future; thus you should always list wild-card
1a4c9766
JAK
297pins first, so later specific pins override it.
298
299The pattern "<literal>*</literal>" in a Package field is not considered
44477002 300a &glob; expression in itself.
2b9b27c3 301</para>
1a4c9766
JAK
302</refsect2>
303
304
305
306
307
24f6490f
AL
308<refsect2>
309<title>How APT Interprets Priorities</title>
ec2853a7 310
5b9d504e
AL
311<para>
312Priorities (P) assigned in the APT preferences file must be positive
ec2853a7
AL
313or negative integers. They are interpreted as follows (roughly speaking):
314
315<variablelist>
5b9d504e 316<varlistentry>
5e594b30 317<term>P &gt;= 1000</term>
5b9d504e
AL
318<listitem><simpara>causes a version to be installed even if this
319constitutes a downgrade of the package</simpara></listitem>
ec2853a7 320</varlistentry>
5b9d504e 321<varlistentry>
5e594b30 322<term>990 &lt;= P &lt; 1000</term>
5b9d504e 323<listitem><simpara>causes a version to be installed
ec2853a7 324even if it does not come from the target release,
5b9d504e 325unless the installed version is more recent</simpara></listitem>
ec2853a7 326</varlistentry>
5b9d504e 327<varlistentry>
5e594b30 328<term>500 &lt;= P &lt; 990</term>
5b9d504e
AL
329<listitem><simpara>causes a version to be installed
330unless there is a version available belonging to the target release
331or the installed version is more recent</simpara></listitem>
ec2853a7 332</varlistentry>
5b9d504e 333<varlistentry>
5e594b30 334<term>100 &lt;= P &lt; 500</term>
5b9d504e
AL
335<listitem><simpara>causes a version to be installed
336unless there is a version available belonging to some other
337distribution or the installed version is more recent</simpara></listitem>
24f6490f 338</varlistentry>
5b9d504e 339<varlistentry>
5e594b30 340<term>0 &lt; P &lt; 100</term>
5b9d504e
AL
341<listitem><simpara>causes a version to be installed
342only if there is no installed version of the package</simpara></listitem>
ec2853a7 343</varlistentry>
5b9d504e
AL
344<varlistentry>
345<term>P &lt; 0</term>
346<listitem><simpara>prevents the version from being installed</simpara></listitem>
ec2853a7
AL
347</varlistentry>
348</variablelist>
349</para>
350
24f6490f 351<para>If any specific-form records match an available package version then the
5b9d504e
AL
352first such record determines the priority of the package version.
353Failing that,
354if any general-form records match an available package version then the
24f6490f 355first such record determines the priority of the package version.</para>
ec2853a7 356
24f6490f
AL
357<para>For example, suppose the APT preferences file contains the three
358records presented earlier:</para>
ec2853a7
AL
359
360<programlisting>
361Package: perl
44477002 362Pin: version &good-perl;*
b2e465d6 363Pin-Priority: 1001
ec2853a7 364
b2e465d6 365Package: *
ec2853a7
AL
366Pin: origin ""
367Pin-Priority: 999
368
369Package: *
370Pin: release unstable
371Pin-Priority: 50
372</programlisting>
373
24f6490f 374<para>Then:
ec2853a7 375<itemizedlist>
24f6490f 376<listitem><simpara>The most recent available version of the <literal>perl</literal>
ec2853a7 377package will be installed, so long as that version's version number begins
44477002
JR
378with "<literal>&good-perl;</literal>". If <emphasis>any</emphasis> &good-perl;* version of <literal>perl</literal> is
379available and the installed version is &bad-perl;*, then <literal>perl</literal> will be
ec2853a7 380downgraded.</simpara></listitem>
24f6490f 381<listitem><simpara>A version of any package other than <literal>perl</literal>
5b9d504e
AL
382that is available from the local system has priority over other versions,
383even versions belonging to the target release.
ec2853a7 384</simpara></listitem>
5b9d504e
AL
385<listitem><simpara>A version of a package whose origin is not the local
386system but some other site listed in &sources-list; and which belongs to
24f6490f 387an <literal>unstable</literal> distribution is only installed if it is selected
5b9d504e 388for installation and no version of the package is already installed.
ec2853a7
AL
389</simpara></listitem>
390</itemizedlist>
391</para>
24f6490f 392</refsect2>
ec2853a7 393
24f6490f
AL
394<refsect2>
395<title>Determination of Package Version and Distribution Properties</title>
ec2853a7 396
24f6490f 397<para>The locations listed in the &sources-list; file should provide
ec2853a7 398<filename>Packages</filename> and <filename>Release</filename> files
24f6490f 399to describe the packages available at that location. </para>
ec2853a7 400
24f6490f 401<para>The <filename>Packages</filename> file is normally found in the directory
ec2853a7
AL
402<filename>.../dists/<replaceable>dist-name</replaceable>/<replaceable>component</replaceable>/<replaceable>arch</replaceable></filename>:
403for example, <filename>.../dists/stable/main/binary-i386/Packages</filename>.
404It consists of a series of multi-line records, one for each package available
405in that directory. Only two lines in each record are relevant for setting
406APT priorities:
407<variablelist>
408<varlistentry>
24f6490f 409<term>the <literal>Package:</literal> line</term>
ec2853a7
AL
410<listitem><simpara>gives the package name</simpara></listitem>
411</varlistentry>
412<varlistentry>
24f6490f 413<term>the <literal>Version:</literal> line</term>
ec2853a7
AL
414<listitem><simpara>gives the version number for the named package</simpara></listitem>
415</varlistentry>
416</variablelist>
417</para>
418
24f6490f 419<para>The <filename>Release</filename> file is normally found in the directory
ec2853a7
AL
420<filename>.../dists/<replaceable>dist-name</replaceable></filename>:
421for example, <filename>.../dists/stable/Release</filename>,
e1dd65c9 422or <filename>.../dists/&stable-codename;/Release</filename>.
24f6490f 423It consists of a single multi-line record which applies to <emphasis>all</emphasis> of
5b9d504e 424the packages in the directory tree below its parent. Unlike the
24f6490f 425<filename>Packages</filename> file, nearly all of the lines in a <filename>Release</filename>
ec2853a7
AL
426file are relevant for setting APT priorities:
427
428<variablelist>
429<varlistentry>
efc487fb 430<term>the <literal>Archive:</literal> or <literal>Suite:</literal> line</term>
5b9d504e 431<listitem><simpara>names the archive to which all the packages
ec2853a7 432in the directory tree belong. For example, the line
efc487fb
DK
433"Archive: stable" or
434"Suite: stable"
5b9d504e 435specifies that all of the packages in the directory
24f6490f
AL
436tree below the parent of the <filename>Release</filename> file are in a
437<literal>stable</literal> archive. Specifying this value in the APT preferences file
ec2853a7
AL
438would require the line:
439</simpara>
ec2853a7
AL
440<programlisting>
441Pin: release a=stable
442</programlisting>
443</listitem>
444</varlistentry>
445
efc487fb
DK
446<varlistentry>
447<term>the <literal>Codename:</literal> line</term>
448<listitem><simpara>names the codename to which all the packages
449in the directory tree belong. For example, the line
e1dd65c9 450"Codename: &testing-codename;"
efc487fb
DK
451specifies that all of the packages in the directory
452tree below the parent of the <filename>Release</filename> file belong to a version named
e1dd65c9 453<literal>&testing-codename;</literal>. Specifying this value in the APT preferences file
efc487fb
DK
454would require the line:
455</simpara>
456<programlisting>
e1dd65c9 457Pin: release n=&testing-codename;
efc487fb
DK
458</programlisting>
459</listitem>
460</varlistentry>
461
ec2853a7 462<varlistentry>
24f6490f 463<term>the <literal>Version:</literal> line</term>
ec2853a7 464<listitem><simpara>names the release version. For example, the
b176de3a 465packages in the tree might belong to Debian release
44477002 466version &stable-version;. Note that there is normally no version number for the
24f6490f 467<literal>testing</literal> and <literal>unstable</literal> distributions because they
5b9d504e
AL
468have not been released yet. Specifying this in the APT preferences
469file would require one of the following lines.
ec2853a7
AL
470</simpara>
471
472<programlisting>
44477002
JR
473Pin: release v=&stable-version;
474Pin: release a=stable, v=&stable-version;
475Pin: release &stable-version;
ec2853a7
AL
476</programlisting>
477
478</listitem>
479</varlistentry>
480
481<varlistentry>
24f6490f 482<term>the <literal>Component:</literal> line</term>
ec2853a7 483<listitem><simpara>names the licensing component associated with the
24f6490f 484packages in the directory tree of the <filename>Release</filename> file.
5b9d504e 485For example, the line "Component: main" specifies that
24f6490f 486all the packages in the directory tree are from the <literal>main</literal>
5b9d504e
AL
487component, which entails that they are licensed under terms listed
488in the Debian Free Software Guidelines. Specifying this component
489in the APT preferences file would require the line:
ec2853a7 490</simpara>
ec2853a7
AL
491<programlisting>
492Pin: release c=main
493</programlisting>
494</listitem>
495</varlistentry>
496
497<varlistentry>
24f6490f 498<term>the <literal>Origin:</literal> line</term>
5b9d504e 499<listitem><simpara>names the originator of the packages in the
24f6490f
AL
500directory tree of the <filename>Release</filename> file. Most commonly, this is
501<literal>Debian</literal>. Specifying this origin in the APT preferences file
ec2853a7
AL
502would require the line:
503</simpara>
ec2853a7
AL
504<programlisting>
505Pin: release o=Debian
506</programlisting>
507</listitem>
508</varlistentry>
509
510<varlistentry>
24f6490f 511<term>the <literal>Label:</literal> line</term>
5b9d504e 512<listitem><simpara>names the label of the packages in the directory tree
24f6490f
AL
513of the <filename>Release</filename> file. Most commonly, this is
514<literal>Debian</literal>. Specifying this label in the APT preferences file
ec2853a7
AL
515would require the line:
516</simpara>
ec2853a7
AL
517<programlisting>
518Pin: release l=Debian
519</programlisting>
520</listitem>
521</varlistentry>
522</variablelist>
523</para>
524
24f6490f 525<para>All of the <filename>Packages</filename> and <filename>Release</filename>
5b9d504e 526files retrieved from locations listed in the &sources-list; file are stored
ec2853a7 527in the directory <filename>/var/lib/apt/lists</filename>, or in the file named
24f6490f 528by the variable <literal>Dir::State::Lists</literal> in the <filename>apt.conf</filename> file.
ec2853a7
AL
529For example, the file
530<filename>debian.lcs.mit.edu_debian_dists_unstable_contrib_binary-i386_Release</filename>
531contains the <filename>Release</filename> file retrieved from the site
24f6490f
AL
532<literal>debian.lcs.mit.edu</literal> for <literal>binary-i386</literal> architecture
533files from the <literal>contrib</literal> component of the <literal>unstable</literal>
534distribution.</para>
535</refsect2>
ec2853a7 536
24f6490f
AL
537<refsect2>
538<title>Optional Lines in an APT Preferences Record</title>
ec2853a7 539
24f6490f
AL
540<para>Each record in the APT preferences file can optionally begin with
541one or more lines beginning with the word <literal>Explanation:</literal>.
542This provides a place for comments.</para>
24f6490f
AL
543</refsect2>
544</refsect1>
ec2853a7 545
24f6490f
AL
546<refsect1>
547<title>Examples</title>
548<refsect2>
549<title>Tracking Stable</title>
ec2853a7 550
24f6490f 551<para>The following APT preferences file will cause APT to assign a
ec2853a7 552priority higher than the default (500) to all package versions belonging
24f6490f
AL
553to a <literal>stable</literal> distribution and a prohibitively low priority to
554package versions belonging to other <literal>Debian</literal> distributions.
ec2853a7
AL
555
556<programlisting>
5b9d504e
AL
557Explanation: Uninstall or do not install any Debian-originated
558Explanation: package versions other than those in the stable distro
ec2853a7
AL
559Package: *
560Pin: release a=stable
561Pin-Priority: 900
562
ec2853a7
AL
563Package: *
564Pin: release o=Debian
565Pin-Priority: -10
566</programlisting>
567</para>
568
24f6490f 569<para>With a suitable &sources-list; file and the above preferences file,
ec2853a7 570any of the following commands will cause APT to upgrade to the
24f6490f 571latest <literal>stable</literal> version(s).
ec2853a7
AL
572
573<programlisting>
574apt-get install <replaceable>package-name</replaceable>
575apt-get upgrade
576apt-get dist-upgrade
577</programlisting>
578</para>
579
24f6490f
AL
580<para>The following command will cause APT to upgrade the specified
581package to the latest version from the <literal>testing</literal> distribution;
5b9d504e
AL
582the package will not be upgraded again unless this command is given
583again.
ec2853a7
AL
584
585<programlisting>
586apt-get install <replaceable>package</replaceable>/testing
587</programlisting>
24f6490f
AL
588</para>
589</refsect2>
ec2853a7 590
24f6490f
AL
591 <refsect2>
592 <title>Tracking Testing or Unstable</title>
ec2853a7 593
24f6490f
AL
594<para>The following APT preferences file will cause APT to assign
595a high priority to package versions from the <literal>testing</literal>
5b9d504e 596distribution, a lower priority to package versions from the
24f6490f
AL
597<literal>unstable</literal> distribution, and a prohibitively low priority
598to package versions from other <literal>Debian</literal> distributions.
ec2853a7
AL
599
600<programlisting>
601Package: *
602Pin: release a=testing
603Pin-Priority: 900
604
605Package: *
606Pin: release a=unstable
607Pin-Priority: 800
608
609Package: *
610Pin: release o=Debian
611Pin-Priority: -10
612</programlisting>
613</para>
614
24f6490f 615<para>With a suitable &sources-list; file and the above preferences file,
5b9d504e 616any of the following commands will cause APT to upgrade to the latest
24f6490f 617<literal>testing</literal> version(s).
ec2853a7
AL
618
619<programlisting>
620apt-get install <replaceable>package-name</replaceable>
621apt-get upgrade
622apt-get dist-upgrade
623</programlisting>
624</para>
625
626<para>The following command will cause APT to upgrade the specified
24f6490f 627package to the latest version from the <literal>unstable</literal> distribution.
5b9d504e 628Thereafter, <command>apt-get upgrade</command> will upgrade
24f6490f 629the package to the most recent <literal>testing</literal> version if that is
5b9d504e 630more recent than the installed version, otherwise, to the most recent
24f6490f 631<literal>unstable</literal> version if that is more recent than the installed
5b9d504e 632version.
ec2853a7
AL
633
634<programlisting>
635apt-get install <replaceable>package</replaceable>/unstable
636</programlisting>
637</para>
efc487fb
DK
638</refsect2>
639
640
641<refsect2>
642<title>Tracking the evolution of a codename release</title>
643
644<para>The following APT preferences file will cause APT to assign a
645priority higher than the default (500) to all package versions belonging
646to a specified codename of a distribution and a prohibitively low priority to
647package versions belonging to other <literal>Debian</literal> distributions,
648codenames and archives.
649Note that with this APT preference APT will follow the migration of a release
650from the archive <literal>testing</literal> to <literal>stable</literal> and
651later <literal>oldstable</literal>. If you want to follow for example the progress
652in <literal>testing</literal> notwithstanding the codename changes you should use
653the example configurations above.
654
655<programlisting>
656Explanation: Uninstall or do not install any Debian-originated package versions
e1dd65c9 657Explanation: other than those in the distribution codenamed with &testing-codename; or sid
efc487fb 658Package: *
e1dd65c9 659Pin: release n=&testing-codename;
efc487fb
DK
660Pin-Priority: 900
661
662Explanation: Debian unstable is always codenamed with sid
663Package: *
4a2bb9e6 664Pin: release n=sid
efc487fb
DK
665Pin-Priority: 800
666
667Package: *
668Pin: release o=Debian
669Pin-Priority: -10
670</programlisting>
671</para>
672
673<para>With a suitable &sources-list; file and the above preferences file,
674any of the following commands will cause APT to upgrade to the
e1dd65c9 675latest version(s) in the release codenamed with <literal>&testing-codename;</literal>.
efc487fb
DK
676
677<programlisting>
678apt-get install <replaceable>package-name</replaceable>
679apt-get upgrade
680apt-get dist-upgrade
681</programlisting>
682</para>
683
684<para>The following command will cause APT to upgrade the specified
685package to the latest version from the <literal>sid</literal> distribution.
686Thereafter, <command>apt-get upgrade</command> will upgrade
e1dd65c9 687the package to the most recent <literal>&testing-codename;</literal> version if that is
efc487fb
DK
688more recent than the installed version, otherwise, to the most recent
689<literal>sid</literal> version if that is more recent than the installed
690version.
ec2853a7 691
efc487fb
DK
692<programlisting>
693apt-get install <replaceable>package</replaceable>/sid
694</programlisting>
695</para>
24f6490f
AL
696</refsect2>
697</refsect1>
ec2853a7 698
daa4aa52
DK
699<refsect1>
700<title>Files</title>
701 <variablelist>
702 &file-preferences;
703 </variablelist>
704</refsect1>
705
24f6490f
AL
706<refsect1>
707<title>See Also</title>
5e80de29 708<para>&apt-get; &apt-cache; &apt-conf; &sources-list;
5b9d504e 709</para>
24f6490f 710</refsect1>
b2e465d6
AL
711
712 &manbugs;
ec2853a7 713
b2e465d6 714</refentry>