]> git.saurik.com Git - apt-legacy.git/blame - doc/apt_preferences.5
Fixed Dl-Limit (long standing APT bug that they won't acknowledge), specified error...
[apt-legacy.git] / doc / apt_preferences.5
CommitLineData
da6ee469
JF
1.\" Title: apt_preferences
2.\" Author: APT team
3.\" Generator: DocBook XSL Stylesheets v1.71.0 <http://docbook.sf.net/>
4.\" Date: 29 February 2004
5.\" Manual:
6.\" Source: Linux
7.\"
8.TH "APT_PREFERENCES" "5" "29 February 2004" "Linux" ""
9.\" disable hyphenation
10.nh
11.\" disable justification (adjust text to left margin only)
12.ad l
13.SH "NAME"
14apt_preferences \- Preference control file for APT
15.SH "DESCRIPTION"
16.PP
17The APT preferences file
18\fI/etc/apt/preferences\fR
19can be used to control which versions of packages will be selected for installation.
20.PP
21Several versions of a package may be available for installation when the
22\fBsources.list\fR(5)
23file contains references to more than one distribution (for example,
24stable
25and
26testing). APT assigns a priority to each version that is available. Subject to dependency constraints,
27\fBapt\-get\fR
28selects 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.
29.PP
30Several instances of the same version of a package may be available when the
31\fBsources.list\fR(5)
32file contains references to more than one source. In this case
33\fBapt\-get\fR
34downloads the instance listed earliest in the
35\fBsources.list\fR(5)
36file. The APT preferences file does not affect the choice of instance, only the choice of version.
37.SS "APT's Default Priority Assignments"
38.PP
39If 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
40\fBapt\-get\fR
41command line or in the APT configuration file
42\fI/etc/apt/apt.conf\fR. For example,
43.sp
44.RS 3n
45.nf
46\fBapt\-get install \-t testing \fR\fB\fIsome\-package\fR\fR
47.fi
48.RE
49.sp
50
51.sp
52.RS 3n
53.nf
54APT::Default\-Release "stable";
55.fi
56.RE
57.sp
58.PP
59If the target release has been specified then APT uses the following algorithm to set the priorities of the versions of a package. Assign:
60.PP
61priority 100
62.RS 3n
63to the version that is already installed (if any).
64.RE
65.PP
66priority 500
67.RS 3n
68to the versions that are not installed and do not belong to the target release.
69.RE
70.PP
71priority 990
72.RS 3n
73to the versions that are not installed and belong to the target release.
74.RE
75.PP
76If 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.
77.PP
78APT then applies the following rules, listed in order of precedence, to determine which version of a package to install.
79.TP 3n
80\(bu
81Never 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.)
82.TP 3n
83\(bu
84Install the highest priority version.
85.TP 3n
86\(bu
87If two or more versions have the same priority, install the most recent one (that is, the one with the higher version number).
88.TP 3n
89\(bu
90If two or more versions have the same priority and version number but either the packages differ in some of their metadata or the
91\-\-reinstall
92option is given, install the uninstalled one.
93.sp
94.RE
95.PP
96In 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
97\fBsources.list\fR(5)
98file (priority 500 or 990). Then the package will be upgraded when
99\fBapt\-get install \fR\fB\fIsome\-package\fR\fR
100or
101\fBapt\-get upgrade\fR
102is executed.
103.PP
104More rarely, the installed version of a package is
105\fImore\fR
106recent than any of the other available versions. The package will not be downgraded when
107\fBapt\-get install \fR\fB\fIsome\-package\fR\fR
108or
109\fBapt\-get upgrade\fR
110is executed.
111.PP
112Sometimes 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
114or
115\fBapt\-get upgrade\fR
116is executed, because at least
117\fIone\fR
118of the available versions has a higher priority than the installed version.
119.SS "The Effect of APT Preferences"
120.PP
121The 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.
122.TP 3n
123\(bu
124The 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
125\fIperl\fR
126package whose version number begins with "5.8".
127.sp
128.RS 3n
129.nf
130Package: perl
131Pin: version 5.8*
132Pin\-Priority: 1001
133.fi
134.RE
135.TP 3n
136\(bu
137The 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
138\fIRelease\fR
139file) or to all of the package versions coming from a particular Internet site, as identified by the site's fully qualified domain name.
140.sp
141This 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.
142.sp
143.RS 3n
144.nf
145Package: *
146Pin: origin ""
147Pin\-Priority: 999
148.fi
149.RE
150A note of caution: the keyword used here is "origin". This should not be confused with the Origin of a distribution as specified in a
151\fIRelease\fR
152file. What follows the "Origin:" tag in a
153\fIRelease\fR
154file is not an Internet address but an author or vendor name, such as "Debian" or "Ximian".
155.sp
156The following record assigns a low priority to all package versions belonging to any distribution whose Archive name is "unstable".
157.sp
158.RS 3n
159.nf
160Package: *
161Pin: release a=unstable
162Pin\-Priority: 50
163.fi
164.RE
165The 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".
166.sp
167.RS 3n
168.nf
169Package: *
170Pin: release a=stable, v=3.0
171Pin\-Priority: 500
172.fi
173.RE
174.sp
175.RE
176.SS "How APT Interprets Priorities"
177.PP
178Priorities (P) assigned in the APT preferences file must be positive or negative integers. They are interpreted as follows (roughly speaking):
179.PP
180P > 1000
181.RS 3n
182causes a version to be installed even if this constitutes a downgrade of the package
183.RE
184.PP
185990 < P <=1000
186.RS 3n
187causes a version to be installed even if it does not come from the target release, unless the installed version is more recent
188.RE
189.PP
190500 < P <=990
191.RS 3n
192causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent
193.RE
194.PP
195100 < P <=500
196.RS 3n
197causes a version to be installed unless there is a version available belonging to some other distribution or the installed version is more recent
198.RE
199.PP
2000 < P <=100
201.RS 3n
202causes a version to be installed only if there is no installed version of the package
203.RE
204.PP
205P < 0
206.RS 3n
207prevents the version from being installed
208.RE
209.PP
210If 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.
211.PP
212For example, suppose the APT preferences file contains the three records presented earlier:
213.sp
214.RS 3n
215.nf
216Package: perl
217Pin: version 5.8*
218Pin\-Priority: 1001
219
220Package: *
221Pin: origin ""
222Pin\-Priority: 999
223
224Package: *
225Pin: release unstable
226Pin\-Priority: 50
227.fi
228.RE
229.PP
230Then:
231.TP 3n
232\(bu
233The most recent available version of the
234perl
235package will be installed, so long as that version's version number begins with "5.8". If
236\fIany\fR
2375.8* version of
238perl
239is available and the installed version is 5.9*, then
240perl
241will be downgraded.
242.TP 3n
243\(bu
244A version of any package other than
245perl
246that is available from the local system has priority over other versions, even versions belonging to the target release.
247.TP 3n
248\(bu
249A version of a package whose origin is not the local system but some other site listed in
250\fBsources.list\fR(5)
251and which belongs to an
252unstable
253distribution is only installed if it is selected for installation and no version of the package is already installed.
254.sp
255.RE
256.SS "Determination of Package Version and Distribution Properties"
257.PP
258The locations listed in the
259\fBsources.list\fR(5)
260file should provide
261\fIPackages\fR
262and
263\fIRelease\fR
264files to describe the packages available at that location.
265.PP
266The
267\fIPackages\fR
268file 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:
271.PP
272the Package: line
273.RS 3n
274gives the package name
275.RE
276.PP
277the Version: line
278.RS 3n
279gives the version number for the named package
280.RE
281.PP
282The
283\fIRelease\fR
284file 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
288\fIall\fR
289of the packages in the directory tree below its parent. Unlike the
290\fIPackages\fR
291file, nearly all of the lines in a
292\fIRelease\fR
293file are relevant for setting APT priorities:
294.PP
295the Archive: line
296.RS 3n
297names 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
298\fIRelease\fR
299file are in a
300stable
301archive. Specifying this value in the APT preferences file would require the line:
302.sp
303.RS 3n
304.nf
305Pin: release a=stable
306.fi
307.RE
308.RE
309.PP
310the Version: line
311.RS 3n
312names 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
313testing
314and
315unstable
316distributions because they have not been released yet. Specifying this in the APT preferences file would require one of the following lines.
317.sp
318.RS 3n
319.nf
320Pin: release v=3.0
321Pin: release a=stable, v=3.0
322Pin: release 3.0
323.fi
324.RE
325.RE
326.PP
327the Component: line
328.RS 3n
329names the licensing component associated with the packages in the directory tree of the
330\fIRelease\fR
331file. For example, the line "Component: main" specifies that all the packages in the directory tree are from the
332main
333component, 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:
334.sp
335.RS 3n
336.nf
337Pin: release c=main
338.fi
339.RE
340.RE
341.PP
342the Origin: line
343.RS 3n
344names the originator of the packages in the directory tree of the
345\fIRelease\fR
346file. Most commonly, this is
347Debian. Specifying this origin in the APT preferences file would require the line:
348.sp
349.RS 3n
350.nf
351Pin: release o=Debian
352.fi
353.RE
354.RE
355.PP
356the Label: line
357.RS 3n
358names the label of the packages in the directory tree of the
359\fIRelease\fR
360file. Most commonly, this is
361Debian. Specifying this label in the APT preferences file would require the line:
362.sp
363.RS 3n
364.nf
365Pin: release l=Debian
366.fi
367.RE
368.RE
369.PP
370All of the
371\fIPackages\fR
372and
373\fIRelease\fR
374files retrieved from locations listed in the
375\fBsources.list\fR(5)
376file are stored in the directory
377\fI/var/lib/apt/lists\fR, or in the file named by the variable
378Dir::State::Lists
379in the
380\fIapt.conf\fR
381file. For example, the file
382\fIdebian.lcs.mit.edu_debian_dists_unstable_contrib_binary\-i386_Release\fR
383contains the
384\fIRelease\fR
385file retrieved from the site
386debian.lcs.mit.edu
387for
388binary\-i386
389architecture files from the
390contrib
391component of the
392unstable
393distribution.
394.SS "Optional Lines in an APT Preferences Record"
395.PP
396Each record in the APT preferences file can optionally begin with one or more lines beginning with the word
397Explanation:. This provides a place for comments.
398.PP
399The
400Pin\-Priority:
401line 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
402Pin\-Priority: release ....
403.SH "EXAMPLES"
404.SS "Tracking Stable"
405.PP
406The following APT preferences file will cause APT to assign a priority higher than the default (500) to all package versions belonging to a
407stable
408distribution and a prohibitively low priority to package versions belonging to other
409Debian
410distributions.
411.sp
412.RS 3n
413.nf
414Explanation: Uninstall or do not install any Debian\-originated
415Explanation: package versions other than those in the stable distro
416Package: *
417Pin: release a=stable
418Pin\-Priority: 900
419
420Package: *
421Pin: release o=Debian
422Pin\-Priority: \-10
423.fi
424.RE
425.sp
426.PP
427With a suitable
428\fBsources.list\fR(5)
429file and the above preferences file, any of the following commands will cause APT to upgrade to the latest
430stable
431version(s).
432.sp
433.RS 3n
434.nf
435apt\-get install \fIpackage\-name\fR
436apt\-get upgrade
437apt\-get dist\-upgrade
438.fi
439.RE
440.sp
441.PP
442The following command will cause APT to upgrade the specified package to the latest version from the
443testing
444distribution; the package will not be upgraded again unless this command is given again.
445.sp
446.RS 3n
447.nf
448apt\-get install \fIpackage\fR/testing
449.fi
450.RE
451.sp
452.SS "Tracking Testing or Unstable"
453.PP
454The following APT preferences file will cause APT to assign a high priority to package versions from the
455testing
456distribution, a lower priority to package versions from the
457unstable
458distribution, and a prohibitively low priority to package versions from other
459Debian
460distributions.
461.sp
462.RS 3n
463.nf
464Package: *
465Pin: release a=testing
466Pin\-Priority: 900
467
468Package: *
469Pin: release a=unstable
470Pin\-Priority: 800
471
472Package: *
473Pin: release o=Debian
474Pin\-Priority: \-10
475.fi
476.RE
477.sp
478.PP
479With a suitable
480\fBsources.list\fR(5)
481file and the above preferences file, any of the following commands will cause APT to upgrade to the latest
482testing
483version(s).
484.sp
485.RS 3n
486.nf
487apt\-get install \fIpackage\-name\fR
488apt\-get upgrade
489apt\-get dist\-upgrade
490.fi
491.RE
492.sp
493.PP
494The following command will cause APT to upgrade the specified package to the latest version from the
495unstable
496distribution. Thereafter,
497\fBapt\-get upgrade\fR
498will upgrade the package to the most recent
499testing
500version if that is more recent than the installed version, otherwise, to the most recent
501unstable
502version if that is more recent than the installed version.
503.sp
504.RS 3n
505.nf
506apt\-get install \fIpackage\fR/unstable
507.fi
508.RE
509.sp
510.SH "SEE ALSO"
511.PP
512\fBapt\-get\fR(8)
513\fBapt\-cache\fR(8)
514\fBapt.conf\fR(5)
515\fBsources.list\fR(5)
516.SH "BUGS"
517.PP
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
520or the
521\fBreportbug\fR(1)
522command.
523.SH "AUTHOR"
524.PP
525\fBAPT team\fR
526.sp -1n
527.IP "" 3n
528Author.
529.SH "REFERENCES"
530.TP 3
5311.\ APT bug page
532\%http://bugs.debian.org/src:apt