]> git.saurik.com Git - apt.git/blame - doc/apt_preferences.5.xml
* Updated French translation from Christian Perrier <bu...
[apt.git] / doc / apt_preferences.5.xml
CommitLineData
24f6490f
AL
1<?xml version="1.0" encoding="utf-8" standalone="no"?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
b2e465d6
AL
4
5<!ENTITY % aptent SYSTEM "apt.ent">
6%aptent;
7
8]>
9
10<refentry>
ec2853a7 11
b2e465d6 12 <refmeta>
24f6490f
AL
13 <refentrytitle>apt_preferences</refentrytitle>
14 <manvolnum>5</manvolnum>
b2e465d6 15 </refmeta>
ec2853a7 16
b2e465d6
AL
17 <!-- Man page title -->
18 <refnamediv>
24f6490f
AL
19 <refname>apt_preferences</refname>
20 <refpurpose>Preference control file for APT</refpurpose>
b2e465d6 21 </refnamediv>
b2e465d6 22
24f6490f
AL
23<refsect1>
24<title>Description</title>
25<para>The APT preferences file <filename>/etc/apt/preferences</filename>
5b9d504e 26can be used to control which versions of packages will be selected
24f6490f 27for installation.</para>
ec2853a7 28
24f6490f 29<para>Several versions of a package may be available for installation when
ec2853a7 30the &sources-list; file contains references to more than one distribution
5b9d504e
AL
31(for example, <literal>stable</literal> and <literal>testing</literal>).
32APT assigns a priority to each version that is available.
33Subject to dependency constraints, <command>apt-get</command> selects the
408a8e0a 34version with the highest priority for installation.
5b9d504e
AL
35The APT preferences file overrides the priorities that APT assigns to
36package versions by default, thus giving the user control over which
24f6490f
AL
37one is selected for installation.</para>
38
39<para>Several instances of the same version of a package may be available when
408a8e0a
AL
40the &sources-list; file contains references to more than one source.
41In this case <command>apt-get</command> downloads the instance listed
5b9d504e 42earliest in the &sources-list; file.
408a8e0a 43The APT preferences file does not affect the choice of instance, only
24f6490f 44the choice of version.</para>
ec2853a7 45
24f6490f 46<refsect2><title>APT's Default Priority Assignments</title>
ec2853a7 47
24f6490f 48<para>If there is no preferences file or if there is no entry in the file
408a8e0a
AL
49that applies to a particular version then the priority assigned to that
50version is the priority of the distribution to which that version
51belongs. It is possible to single out a distribution, "the target release",
52which receives a higher priority than other distributions do by default.
53The target release can be set on the <command>apt-get</command> command
54line or in the APT configuration file <filename>/etc/apt/apt.conf</filename>.
55For example,
24f6490f 56
408a8e0a
AL
57<programlisting>
58<command>apt-get install -t testing <replaceable>some-package</replaceable></command>
59</programlisting>
60<programlisting>
61APT::Default-Release "stable";
62</programlisting>
ec2853a7
AL
63</para>
64
24f6490f 65<para>If the target release has been specified then APT uses the following
408a8e0a 66algorithm to set the priorities of the versions of a package. Assign:
24f6490f 67
ec2853a7
AL
68<variablelist>
69<varlistentry>
70<term>priority 100</term>
5b9d504e 71<listitem><simpara>to the version that is already installed (if any).</simpara></listitem>
ec2853a7 72</varlistentry>
24f6490f 73
ec2853a7
AL
74<varlistentry>
75<term>priority 500</term>
5b9d504e 76<listitem><simpara>to the versions that are not installed and do not belong to the target release.</simpara></listitem>
ec2853a7 77</varlistentry>
24f6490f 78
ec2853a7
AL
79<varlistentry>
80<term>priority 990</term>
5b9d504e 81<listitem><simpara>to the versions that are not installed and belong to the target release.</simpara></listitem>
ec2853a7
AL
82</varlistentry>
83</variablelist>
84</para>
85
24f6490f 86<para>If the target release has not been specified then APT simply assigns
5b9d504e 87priority 100 to all installed package versions and priority 500 to all
24f6490f 88uninstalled package versions.</para>
ec2853a7 89
24f6490f 90<para>APT then applies the following rules, listed in order of precedence,
5b9d504e 91to determine which version of a package to install.
ec2853a7 92<itemizedlist>
5b9d504e
AL
93<listitem><simpara>Never downgrade unless the priority of an available
94version exceeds 1000. ("Downgrading" is installing a less recent version
95of a package in place of a more recent version. Note that none of APT's
96default priorities exceeds 1000; such high priorities can only be set in
97the preferences file. Note also that downgrading a package
98can be risky.)</simpara></listitem>
99<listitem><simpara>Install the highest priority version.</simpara></listitem>
100<listitem><simpara>If two or more versions have the same priority,
101install the most recent one (that is, the one with the higher version
102number).</simpara></listitem>
103<listitem><simpara>If two or more versions have the same priority and
104version number but either the packages differ in some of their metadata or the
24f6490f 105<literal>--reinstall</literal> option is given, install the uninstalled one.</simpara></listitem>
ec2853a7
AL
106</itemizedlist>
107</para>
108
24f6490f 109<para>In a typical situation, the installed version of a package (priority 100)
5b9d504e
AL
110is not as recent as one of the versions available from the sources listed in
111the &sources-list; file (priority 500 or 990). Then the package will be upgraded
112when <command>apt-get install <replaceable>some-package</replaceable></command>
113or <command>apt-get upgrade</command> is executed.
ec2853a7
AL
114</para>
115
24f6490f 116<para>More rarely, the installed version of a package is <emphasis>more</emphasis> recent
5b9d504e
AL
117than any of the other available versions. The package will not be downgraded
118when <command>apt-get install <replaceable>some-package</replaceable></command>
24f6490f 119or <command>apt-get upgrade</command> is executed.</para>
ec2853a7 120
24f6490f 121<para>Sometimes the installed version of a package is more recent than the
ec2853a7 122version belonging to the target release, but not as recent as a version
5b9d504e
AL
123belonging to some other distribution. Such a package will indeed be upgraded
124when <command>apt-get install <replaceable>some-package</replaceable></command>
125or <command>apt-get upgrade</command> is executed,
24f6490f
AL
126because at least <emphasis>one</emphasis> of the available versions has a higher
127priority than the installed version.</para>
128</refsect2>
ec2853a7 129
24f6490f 130<refsect2><title>The Effect of APT Preferences</title>
ec2853a7 131
24f6490f 132<para>The APT preferences file allows the system administrator to control the
5b9d504e
AL
133assignment of priorities. The file consists of one or more multi-line records
134separated by blank lines. Records can have one of two forms, a specific form
135and a general form.
ec2853a7
AL
136<itemizedlist>
137<listitem>
24f6490f 138<simpara>The specific form assigns a priority (a "Pin-Priority") to a
5b9d504e
AL
139specified package and specified version or version range. For example,
140the following record assigns a high priority to all versions of
24f6490f 141the <filename>perl</filename> package whose version number begins with "<literal>5.8</literal>".</simpara>
ec2853a7
AL
142
143<programlisting>
144Package: perl
145Pin: version 5.8*
146Pin-Priority: 1001
147</programlisting>
148</listitem>
149
24f6490f 150<listitem><simpara>The general form assigns a priority to all of the package versions in a
ec2853a7 151given distribution (that is, to all the versions of packages that are
24f6490f 152listed in a certain <filename>Release</filename> file) or to all of the package
5b9d504e 153versions coming from a particular Internet site, as identified by the
24f6490f 154site's fully qualified domain name.</simpara>
ec2853a7 155
24f6490f 156<simpara>This general-form entry in the APT preferences file applies only
5b9d504e 157to groups of packages. For example, the following record assigns a high
24f6490f 158priority to all package versions available from the local site.</simpara>
ec2853a7
AL
159
160<programlisting>
161Package: *
162Pin: origin ""
163Pin-Priority: 999
164</programlisting>
165
24f6490f 166<simpara>A note of caution: the keyword used here is "<literal>origin</literal>".
5b9d504e 167This should not be confused with the Origin of a distribution as
24f6490f
AL
168specified in a <filename>Release</filename> file. What follows the "Origin:" tag
169in a <filename>Release</filename> file is not an Internet address
170but an author or vendor name, such as "Debian" or "Ximian".</simpara>
ec2853a7 171
24f6490f
AL
172<simpara>The following record assigns a low priority to all package versions
173belonging to any distribution whose Archive name is "<literal>unstable</literal>".</simpara>
ec2853a7
AL
174
175<programlisting>
176Package: *
177Pin: release a=unstable
178Pin-Priority: 50
179</programlisting>
180
24f6490f
AL
181<simpara>The following record assigns a high priority to all package versions
182belonging to any release whose Archive name is "<literal>stable</literal>"
183and whose release Version number is "<literal>3.0</literal>".</simpara>
ec2853a7
AL
184
185<programlisting>
186Package: *
187Pin: release a=unstable, v=3.0
188Pin-Priority: 50
189</programlisting>
190</listitem>
191</itemizedlist>
192</para>
193
24f6490f 194</refsect2>
ec2853a7 195
24f6490f
AL
196<refsect2>
197<title>How APT Interprets Priorities</title>
ec2853a7 198
5b9d504e
AL
199<para>
200Priorities (P) assigned in the APT preferences file must be positive
ec2853a7
AL
201or negative integers. They are interpreted as follows (roughly speaking):
202
203<variablelist>
5b9d504e
AL
204<varlistentry>
205<term>P &gt; 1000</term>
206<listitem><simpara>causes a version to be installed even if this
207constitutes a downgrade of the package</simpara></listitem>
ec2853a7 208</varlistentry>
5b9d504e
AL
209<varlistentry>
210<term>990 &lt; P &lt;=1000</term>
211<listitem><simpara>causes a version to be installed
ec2853a7 212even if it does not come from the target release,
5b9d504e 213unless the installed version is more recent</simpara></listitem>
ec2853a7 214</varlistentry>
5b9d504e
AL
215<varlistentry>
216<term>500 &lt; P &lt;=990</term>
217<listitem><simpara>causes a version to be installed
218unless there is a version available belonging to the target release
219or the installed version is more recent</simpara></listitem>
ec2853a7 220</varlistentry>
5b9d504e
AL
221<varlistentry>
222<term>100 &lt; P &lt;=500</term>
223<listitem><simpara>causes a version to be installed
224unless there is a version available belonging to some other
225distribution or the installed version is more recent</simpara></listitem>
24f6490f 226</varlistentry>
5b9d504e 227<varlistentry>
56298634 228<term>0 &lt; P &lt;=100</term>
5b9d504e
AL
229<listitem><simpara>causes a version to be installed
230only if there is no installed version of the package</simpara></listitem>
ec2853a7 231</varlistentry>
5b9d504e
AL
232<varlistentry>
233<term>P &lt; 0</term>
234<listitem><simpara>prevents the version from being installed</simpara></listitem>
ec2853a7
AL
235</varlistentry>
236</variablelist>
237</para>
238
24f6490f 239<para>If any specific-form records match an available package version then the
5b9d504e
AL
240first such record determines the priority of the package version.
241Failing that,
242if any general-form records match an available package version then the
24f6490f 243first such record determines the priority of the package version.</para>
ec2853a7 244
24f6490f
AL
245<para>For example, suppose the APT preferences file contains the three
246records presented earlier:</para>
ec2853a7
AL
247
248<programlisting>
249Package: perl
250Pin: version 5.8*
b2e465d6 251Pin-Priority: 1001
ec2853a7 252
b2e465d6 253Package: *
ec2853a7
AL
254Pin: origin ""
255Pin-Priority: 999
256
257Package: *
258Pin: release unstable
259Pin-Priority: 50
260</programlisting>
261
24f6490f 262<para>Then:
ec2853a7 263<itemizedlist>
24f6490f 264<listitem><simpara>The most recent available version of the <literal>perl</literal>
ec2853a7 265package will be installed, so long as that version's version number begins
24f6490f
AL
266with "<literal>5.8</literal>". If <emphasis>any</emphasis> 5.8* version of <literal>perl</literal> is
267available and the installed version is 5.9*, then <literal>perl</literal> will be
ec2853a7 268downgraded.</simpara></listitem>
24f6490f 269<listitem><simpara>A version of any package other than <literal>perl</literal>
5b9d504e
AL
270that is available from the local system has priority over other versions,
271even versions belonging to the target release.
ec2853a7 272</simpara></listitem>
5b9d504e
AL
273<listitem><simpara>A version of a package whose origin is not the local
274system but some other site listed in &sources-list; and which belongs to
24f6490f 275an <literal>unstable</literal> distribution is only installed if it is selected
5b9d504e 276for installation and no version of the package is already installed.
ec2853a7
AL
277</simpara></listitem>
278</itemizedlist>
279</para>
24f6490f 280</refsect2>
ec2853a7 281
24f6490f
AL
282<refsect2>
283<title>Determination of Package Version and Distribution Properties</title>
ec2853a7 284
24f6490f 285<para>The locations listed in the &sources-list; file should provide
ec2853a7 286<filename>Packages</filename> and <filename>Release</filename> files
24f6490f 287to describe the packages available at that location. </para>
ec2853a7 288
24f6490f 289<para>The <filename>Packages</filename> file is normally found in the directory
ec2853a7
AL
290<filename>.../dists/<replaceable>dist-name</replaceable>/<replaceable>component</replaceable>/<replaceable>arch</replaceable></filename>:
291for example, <filename>.../dists/stable/main/binary-i386/Packages</filename>.
292It consists of a series of multi-line records, one for each package available
293in that directory. Only two lines in each record are relevant for setting
294APT priorities:
295<variablelist>
296<varlistentry>
24f6490f 297<term>the <literal>Package:</literal> line</term>
ec2853a7
AL
298<listitem><simpara>gives the package name</simpara></listitem>
299</varlistentry>
300<varlistentry>
24f6490f 301<term>the <literal>Version:</literal> line</term>
ec2853a7
AL
302<listitem><simpara>gives the version number for the named package</simpara></listitem>
303</varlistentry>
304</variablelist>
305</para>
306
24f6490f 307<para>The <filename>Release</filename> file is normally found in the directory
ec2853a7
AL
308<filename>.../dists/<replaceable>dist-name</replaceable></filename>:
309for example, <filename>.../dists/stable/Release</filename>,
310or <filename>.../dists/woody/Release</filename>.
24f6490f 311It consists of a single multi-line record which applies to <emphasis>all</emphasis> of
5b9d504e 312the packages in the directory tree below its parent. Unlike the
24f6490f 313<filename>Packages</filename> file, nearly all of the lines in a <filename>Release</filename>
ec2853a7
AL
314file are relevant for setting APT priorities:
315
316<variablelist>
317<varlistentry>
24f6490f 318<term>the <literal>Archive:</literal> line</term>
5b9d504e 319<listitem><simpara>names the archive to which all the packages
ec2853a7 320in the directory tree belong. For example, the line
5b9d504e
AL
321"Archive: stable"
322specifies that all of the packages in the directory
24f6490f
AL
323tree below the parent of the <filename>Release</filename> file are in a
324<literal>stable</literal> archive. Specifying this value in the APT preferences file
ec2853a7
AL
325would require the line:
326</simpara>
ec2853a7
AL
327<programlisting>
328Pin: release a=stable
329</programlisting>
330</listitem>
331</varlistentry>
332
333<varlistentry>
24f6490f 334<term>the <literal>Version:</literal> line</term>
ec2853a7 335<listitem><simpara>names the release version. For example, the
5b9d504e
AL
336packages in the tree might belong to Debian GNU/Linux release
337version 3.0. Note that there is normally no version number for the
24f6490f 338<literal>testing</literal> and <literal>unstable</literal> distributions because they
5b9d504e
AL
339have not been released yet. Specifying this in the APT preferences
340file would require one of the following lines.
ec2853a7
AL
341</simpara>
342
343<programlisting>
344Pin: release v=3.0
f6271220 345Pin: release a=stable, v=3.0
ec2853a7
AL
346Pin: release 3.0
347</programlisting>
348
349</listitem>
350</varlistentry>
351
352<varlistentry>
24f6490f 353<term>the <literal>Component:</literal> line</term>
ec2853a7 354<listitem><simpara>names the licensing component associated with the
24f6490f 355packages in the directory tree of the <filename>Release</filename> file.
5b9d504e 356For example, the line "Component: main" specifies that
24f6490f 357all the packages in the directory tree are from the <literal>main</literal>
5b9d504e
AL
358component, which entails that they are licensed under terms listed
359in the Debian Free Software Guidelines. Specifying this component
360in the APT preferences file would require the line:
ec2853a7 361</simpara>
ec2853a7
AL
362<programlisting>
363Pin: release c=main
364</programlisting>
365</listitem>
366</varlistentry>
367
368<varlistentry>
24f6490f 369<term>the <literal>Origin:</literal> line</term>
5b9d504e 370<listitem><simpara>names the originator of the packages in the
24f6490f
AL
371directory tree of the <filename>Release</filename> file. Most commonly, this is
372<literal>Debian</literal>. Specifying this origin in the APT preferences file
ec2853a7
AL
373would require the line:
374</simpara>
ec2853a7
AL
375<programlisting>
376Pin: release o=Debian
377</programlisting>
378</listitem>
379</varlistentry>
380
381<varlistentry>
24f6490f 382<term>the <literal>Label:</literal> line</term>
5b9d504e 383<listitem><simpara>names the label of the packages in the directory tree
24f6490f
AL
384of the <filename>Release</filename> file. Most commonly, this is
385<literal>Debian</literal>. Specifying this label in the APT preferences file
ec2853a7
AL
386would require the line:
387</simpara>
ec2853a7
AL
388<programlisting>
389Pin: release l=Debian
390</programlisting>
391</listitem>
392</varlistentry>
393</variablelist>
394</para>
395
24f6490f 396<para>All of the <filename>Packages</filename> and <filename>Release</filename>
5b9d504e 397files retrieved from locations listed in the &sources-list; file are stored
ec2853a7 398in the directory <filename>/var/lib/apt/lists</filename>, or in the file named
24f6490f 399by the variable <literal>Dir::State::Lists</literal> in the <filename>apt.conf</filename> file.
ec2853a7
AL
400For example, the file
401<filename>debian.lcs.mit.edu_debian_dists_unstable_contrib_binary-i386_Release</filename>
402contains the <filename>Release</filename> file retrieved from the site
24f6490f
AL
403<literal>debian.lcs.mit.edu</literal> for <literal>binary-i386</literal> architecture
404files from the <literal>contrib</literal> component of the <literal>unstable</literal>
405distribution.</para>
406</refsect2>
ec2853a7 407
24f6490f
AL
408<refsect2>
409<title>Optional Lines in an APT Preferences Record</title>
ec2853a7 410
24f6490f
AL
411<para>Each record in the APT preferences file can optionally begin with
412one or more lines beginning with the word <literal>Explanation:</literal>.
413This provides a place for comments.</para>
ec2853a7 414
24f6490f 415<para>The <literal>Pin-Priority:</literal> line in each APT preferences record is
ec2853a7 416optional. If omitted, APT assigs a priority of 1 less than the last value
24f6490f
AL
417specified on a line beginning with <literal>Pin-Priority: release ...</literal>.</para>
418</refsect2>
419</refsect1>
ec2853a7 420
24f6490f
AL
421<refsect1>
422<title>Examples</title>
423<refsect2>
424<title>Tracking Stable</title>
ec2853a7 425
24f6490f 426<para>The following APT preferences file will cause APT to assign a
ec2853a7 427priority higher than the default (500) to all package versions belonging
24f6490f
AL
428to a <literal>stable</literal> distribution and a prohibitively low priority to
429package versions belonging to other <literal>Debian</literal> distributions.
ec2853a7
AL
430
431<programlisting>
5b9d504e
AL
432Explanation: Uninstall or do not install any Debian-originated
433Explanation: package versions other than those in the stable distro
ec2853a7
AL
434Package: *
435Pin: release a=stable
436Pin-Priority: 900
437
ec2853a7
AL
438Package: *
439Pin: release o=Debian
440Pin-Priority: -10
441</programlisting>
442</para>
443
24f6490f 444<para>With a suitable &sources-list; file and the above preferences file,
ec2853a7 445any of the following commands will cause APT to upgrade to the
24f6490f 446latest <literal>stable</literal> version(s).
ec2853a7
AL
447
448<programlisting>
449apt-get install <replaceable>package-name</replaceable>
450apt-get upgrade
451apt-get dist-upgrade
452</programlisting>
453</para>
454
24f6490f
AL
455<para>The following command will cause APT to upgrade the specified
456package to the latest version from the <literal>testing</literal> distribution;
5b9d504e
AL
457the package will not be upgraded again unless this command is given
458again.
ec2853a7
AL
459
460<programlisting>
461apt-get install <replaceable>package</replaceable>/testing
462</programlisting>
24f6490f
AL
463</para>
464</refsect2>
ec2853a7 465
24f6490f
AL
466 <refsect2>
467 <title>Tracking Testing or Unstable</title>
ec2853a7 468
24f6490f
AL
469<para>The following APT preferences file will cause APT to assign
470a high priority to package versions from the <literal>testing</literal>
5b9d504e 471distribution, a lower priority to package versions from the
24f6490f
AL
472<literal>unstable</literal> distribution, and a prohibitively low priority
473to package versions from other <literal>Debian</literal> distributions.
ec2853a7
AL
474
475<programlisting>
476Package: *
477Pin: release a=testing
478Pin-Priority: 900
479
480Package: *
481Pin: release a=unstable
482Pin-Priority: 800
483
484Package: *
485Pin: release o=Debian
486Pin-Priority: -10
487</programlisting>
488</para>
489
24f6490f 490<para>With a suitable &sources-list; file and the above preferences file,
5b9d504e 491any of the following commands will cause APT to upgrade to the latest
24f6490f 492<literal>testing</literal> version(s).
ec2853a7
AL
493
494<programlisting>
495apt-get install <replaceable>package-name</replaceable>
496apt-get upgrade
497apt-get dist-upgrade
498</programlisting>
499</para>
500
501<para>The following command will cause APT to upgrade the specified
24f6490f 502package to the latest version from the <literal>unstable</literal> distribution.
5b9d504e 503Thereafter, <command>apt-get upgrade</command> will upgrade
24f6490f 504the package to the most recent <literal>testing</literal> version if that is
5b9d504e 505more recent than the installed version, otherwise, to the most recent
24f6490f 506<literal>unstable</literal> version if that is more recent than the installed
5b9d504e 507version.
ec2853a7
AL
508
509<programlisting>
510apt-get install <replaceable>package</replaceable>/unstable
511</programlisting>
512</para>
513
24f6490f
AL
514</refsect2>
515</refsect1>
ec2853a7 516
24f6490f
AL
517<refsect1>
518<title>See Also</title>
ec2853a7
AL
519<para>
520&apt-get; &apt-cache; &apt-conf; &sources-list;
5b9d504e 521</para>
24f6490f 522</refsect1>
b2e465d6
AL
523
524 &manbugs;
525 &manauthor;
ec2853a7 526
b2e465d6 527</refentry>
24f6490f 528