1APT_PREFERENCES(5)                    APT                   APT_PREFERENCES(5)
2
3
4

NAME

6       apt_preferences - Preference control file for APT
7

DESCRIPTION

9       The APT preferences file /etc/apt/preferences and the fragment files in
10       the /etc/apt/preferences.d/ folder can be used to control which
11       versions of packages will be selected for installation.
12
13       Several versions of a package may be available for installation when
14       the sources.list(5) file contains references to more than one
15       distribution (for example, stable and testing). APT assigns a priority
16       to each version that is available. Subject to dependency constraints,
17       apt-get selects the version with the highest priority for installation.
18       The APT preferences override the priorities that APT assigns to package
19       versions by default, thus giving the user control over which one is
20       selected for installation.
21
22       Several instances of the same version of a package may be available
23       when the sources.list(5) file contains references to more than one
24       source. In this case apt-get downloads the instance listed earliest in
25       the sources.list(5) file. The APT preferences do not affect the choice
26       of instance, only the choice of version.
27
28       Preferences are a strong power in the hands of a system administrator
29       but they can become also their biggest nightmare if used without care!
30       APT will not question the preferences, so wrong settings can lead to
31       uninstallable packages or wrong decisions while upgrading packages.
32       Even more problems will arise if multiple distribution releases are
33       mixed without a good understanding of the following paragraphs.
34       Packages included in a specific release aren't tested in (and therefore
35       don't always work as expected in) older or newer releases, or together
36       with other packages from different releases. You have been warned.
37
38       Note that the files in the /etc/apt/preferences.d directory are parsed
39       in alphanumeric ascending order and need to obey the following naming
40       convention: The files have either no or "pref" as filename extension
41       and only contain alphanumeric, hyphen (-), underscore (_) and period
42       (.) characters. Otherwise APT will print a notice that it has ignored a
43       file, unless that file matches a pattern in the
44       Dir::Ignore-Files-Silently configuration list - in which case it will
45       be silently ignored.
46
47   APT's Default Priority Assignments
48       If there is no preferences file or if there is no entry in the file
49       that applies to a particular version then the priority assigned to that
50       version is the priority of the distribution to which that version
51       belongs. It is possible to single out a distribution, "the target
52       release", which receives a higher priority than other distributions do
53       by default. The target release can be set on the apt-get command line
54       or in the APT configuration file /etc/apt/apt.conf. Note that this has
55       precedence over any general priority you set in the
56       /etc/apt/preferences file described later, but not over specifically
57       pinned packages. For example,
58
59           apt-get install -t testing some-package
60
61
62
63           APT::Default-Release "stable";
64
65       If the target release has been specified then APT uses the following
66       algorithm to set the priorities of the versions of a package. Assign:
67
68       priority 1
69           to the versions coming from archives which in their Release files
70           are marked as "NotAutomatic: yes" but not as "ButAutomaticUpgrades:
71           yes" like the Debian experimental archive.
72
73       priority 100
74           to the version that is already installed (if any) and to the
75           versions coming from archives which in their Release files are
76           marked as "NotAutomatic: yes" and "ButAutomaticUpgrades: yes" like
77           the Debian backports archive since squeeze-backports.
78
79       priority 500
80           to the versions that do not belong to the target release.
81
82       priority 990
83           to the versions that belong to the target release.
84       The highest of those priorities whose description matches the version
85       is assigned to the version.
86
87       If the target release has not been specified then APT simply assigns
88       priority 100 to all installed package versions and priority 500 to all
89       uninstalled package versions, except versions coming from archives
90       which in their Release files are marked as "NotAutomatic: yes" - these
91       versions get the priority 1 or priority 100 if it is additionally
92       marked as "ButAutomaticUpgrades: yes".
93
94       APT then applies the following rules, listed in order of precedence, to
95       determine which version of a package to install.
96
97       ·   Never downgrade unless the priority of an available version exceeds
98           1000. ("Downgrading" is installing a less recent version of a
99           package in place of a more recent version. Note that none of APT's
100           default priorities exceeds 1000; such high priorities can only be
101           set in the preferences file. Note also that downgrading a package
102           can be risky.)
103
104       ·   Install the highest priority version.
105
106       ·   If two or more versions have the same priority, install the most
107           recent one (that is, the one with the higher version number).
108
109       ·   If two or more versions have the same priority and version number
110           but either the packages differ in some of their metadata or the
111           --reinstall option is given, install the uninstalled one.
112
113       In a typical situation, the installed version of a package (priority
114       100) is not as recent as one of the versions available from the sources
115       listed in the sources.list(5) file (priority 500 or 990). Then the
116       package will be upgraded when apt-get install some-package or apt-get
117       upgrade is executed.
118
119       More rarely, the installed version of a package is more recent than any
120       of the other available versions. The package will not be downgraded
121       when apt-get install some-package or apt-get upgrade is executed.
122
123       Sometimes the installed version of a package is more recent than the
124       version belonging to the target release, but not as recent as a version
125       belonging to some other distribution. Such a package will indeed be
126       upgraded when apt-get install some-package or apt-get upgrade is
127       executed, because at least one of the available versions has a higher
128       priority than the installed version.
129
130   The Effect of APT Preferences
131       The APT preferences file allows the system administrator to control the
132       assignment of priorities. The file consists of one or more multi-line
133       records separated by blank lines. Records can have one of two forms, a
134       specific form and a general form.
135
136       ·   The specific form assigns a priority (a "Pin-Priority") to one or
137           more specified packages with a specified version or version range.
138           For example, the following record assigns a high priority to all
139           versions of the perl package whose version number begins with
140           "5.20". Multiple packages can be separated by spaces.
141
142               Package: perl
143               Pin: version 5.20*
144               Pin-Priority: 1001
145
146       ·   The general form assigns a priority to all of the package versions
147           in a given distribution (that is, to all the versions of packages
148           that are listed in a certain Release file) or to all of the package
149           versions coming from a particular Internet site, as identified by
150           the site's fully qualified domain name.
151
152           This general-form entry in the APT preferences file applies only to
153           groups of packages. For example, the following record assigns a
154           high priority to all package versions available from the local
155           site.
156
157               Package: *
158               Pin: origin ""
159               Pin-Priority: 999
160
161           A note of caution: the keyword used here is "origin" which can be
162           used to match a hostname. The following record will assign a high
163           priority to all versions available from the server identified by
164           the hostname "ftp.de.debian.org"
165
166               Package: *
167               Pin: origin "ftp.de.debian.org"
168               Pin-Priority: 999
169
170           This should not be confused with the Origin of a distribution as
171           specified in a Release file. What follows the "Origin:" tag in a
172           Release file is not an Internet address but an author or vendor
173           name, such as "Debian" or "Ximian".
174
175           The following record assigns a low priority to all package versions
176           belonging to any distribution whose Archive name is "unstable".
177
178               Package: *
179               Pin: release a=unstable
180               Pin-Priority: 50
181
182           The following record assigns a high priority to all package
183           versions belonging to any distribution whose Codename is
184           "bullseye".
185
186               Package: *
187               Pin: release n=bullseye
188               Pin-Priority: 900
189
190           The following record assigns a high priority to all package
191           versions belonging to any release whose Archive name is "stable"
192           and whose release Version number is "10".
193
194               Package: *
195               Pin: release a=stable, v=10
196               Pin-Priority: 500
197
198       The effect of the comma operator is similar to an "and" in logic: All
199       conditions must be satisfied for the pin to match. There is one
200       exception: For any type of condition (such as two "a" conditions), only
201       the last such condition is checked.
202
203   Regular expressions and glob(7) syntax
204       APT also supports pinning by glob(7) expressions, and regular
205       expressions surrounded by slashes. For example, the following example
206       assigns the priority 500 to all packages from experimental where the
207       name starts with gnome (as a glob(7)-like expression) or contains the
208       word kde (as a POSIX extended regular expression surrounded by
209       slashes).
210
211           Package: gnome* /kde/
212           Pin: release a=experimental
213           Pin-Priority: 500
214
215       The rule for those expressions is that they can occur anywhere where a
216       string can occur. Thus, the following pin assigns the priority 990 to
217       all packages from a release starting with focal.
218
219           Package: *
220           Pin: release n=focal*
221           Pin-Priority: 990
222
223       If a regular expression occurs in a Package field, the behavior is the
224       same as if this regular expression were replaced with a list of all
225       package names it matches. It is undecided whether this will change in
226       the future; thus you should always list wild-card pins first, so later
227       specific pins override it. The pattern "*" in a Package field is not
228       considered a glob(7) expression in itself.
229
230   Pinning by source package
231       APT supports pinning by source packages. To pin by a source package,
232       prepend "src:" to the package name.
233
234       For example, to pin all binaries produced by the apt source package of
235       this APT's version to 990, you can do:
236
237           Package: src:apt
238           Pin: version 2.0.2
239           Pin-Priority: 990
240
241       Source package pinning can be combined with regular expressions and
242       glob patterns, and can also take a binary architecture.
243
244       For example, let's pin all binaries for all architectures produced by
245       any source package containing apt in its name to 990:
246
247           Package: src:*apt*:any
248           Pin: version *
249           Pin-Priority: 990
250
251   How APT Interprets Priorities
252       Priorities (P) assigned in the APT preferences file must be positive or
253       negative integers. They are interpreted as follows (roughly speaking):
254
255       P >= 1000
256           causes a version to be installed even if this constitutes a
257           downgrade of the package
258
259       990 <= P < 1000
260           causes a version to be installed even if it does not come from the
261           target release, unless the installed version is more recent
262
263       500 <= P < 990
264           causes a version to be installed unless there is a version
265           available belonging to the target release or the installed version
266           is more recent
267
268       100 <= P < 500
269           causes a version to be installed unless there is a version
270           available belonging to some other distribution or the installed
271           version is more recent
272
273       0 < P < 100
274           causes a version to be installed only if there is no installed
275           version of the package
276
277       P < 0
278           prevents the version from being installed
279
280       P = 0
281           has undefined behaviour, do not use it.
282
283       The first specific-form record matching an available package version
284       determines the priority of the package version. Failing that, the
285       priority of the package is defined as the maximum of all priorities
286       defined by generic-form records matching the version. Records defined
287       using patterns in the Pin field other than "*" are treated like
288       specific-form records.
289
290       For example, suppose the APT preferences file contains the three
291       records presented earlier:
292
293           Package: perl
294           Pin: version 5.20*
295           Pin-Priority: 1001
296
297           Package: *
298           Pin: origin ""
299           Pin-Priority: 999
300
301           Package: *
302           Pin: release unstable
303           Pin-Priority: 50
304
305       Then:
306
307       ·   The most recent available version of the perl package will be
308           installed, so long as that version's version number begins with
309           "5.20". If any 5.20* version of perl is available and the installed
310           version is 5.24*, then perl will be downgraded.
311
312       ·   A version of any package other than perl that is available from the
313           local system has priority over other versions, even versions
314           belonging to the target release.
315
316       ·   A version of a package whose origin is not the local system but
317           some other site listed in sources.list(5) and which belongs to an
318           unstable distribution is only installed if it is selected for
319           installation and no version of the package is already installed.
320
321
322   Determination of Package Version and Distribution Properties
323       The locations listed in the sources.list(5) file should provide
324       Packages and Release files to describe the packages available at that
325       location.
326
327       The Packages file is normally found in the directory
328       .../dists/dist-name/component/arch: for example,
329       .../dists/stable/main/binary-i386/Packages. It consists of a series of
330       multi-line records, one for each package available in that directory.
331       Only two lines in each record are relevant for setting APT priorities:
332
333       the Package: line
334           gives the package name
335
336       the Version: line
337           gives the version number for the named package
338
339       The Release file is normally found in the directory
340       .../dists/dist-name: for example, .../dists/stable/Release, or
341       .../dists/buster/Release. It consists of a single multi-line record
342       which applies to all of the packages in the directory tree below its
343       parent. Unlike the Packages file, nearly all of the lines in a Release
344       file are relevant for setting APT priorities:
345
346       the Archive: or Suite: line
347           names the archive to which all the packages in the directory tree
348           belong. For example, the line "Archive: stable" or "Suite: stable"
349           specifies that all of the packages in the directory tree below the
350           parent of the Release file are in a stable archive. Specifying this
351           value in the APT preferences file would require the line:
352
353               Pin: release a=stable
354
355       the Codename: line
356           names the codename to which all the packages in the directory tree
357           belong. For example, the line "Codename: bullseye" specifies that
358           all of the packages in the directory tree below the parent of the
359           Release file belong to a version named bullseye. Specifying this
360           value in the APT preferences file would require the line:
361
362               Pin: release n=bullseye
363
364       the Version: line
365           names the release version. For example, the packages in the tree
366           might belong to Debian release version 10. Note that there is
367           normally no version number for the testing and unstable
368           distributions because they have not been released yet. Specifying
369           this in the APT preferences file would require one of the following
370           lines.
371
372               Pin: release v=10
373               Pin: release a=stable, v=10
374               Pin: release 10
375
376       the Component: line
377           names the licensing component associated with the packages in the
378           directory tree of the Release file. For example, the line
379           "Component: main" specifies that all the packages in the directory
380           tree are from the main component, which entails that they are
381           licensed under terms listed in the Debian Free Software Guidelines.
382           Specifying this component in the APT preferences file would require
383           the line:
384
385               Pin: release c=main
386
387       the Origin: line
388           names the originator of the packages in the directory tree of the
389           Release file. Most commonly, this is Debian. Specifying this origin
390           in the APT preferences file would require the line:
391
392               Pin: release o=Debian
393
394       the Label: line
395           names the label of the packages in the directory tree of the
396           Release file. Most commonly, this is Debian. Specifying this label
397           in the APT preferences file would require the line:
398
399               Pin: release l=Debian
400
401       All of the Packages and Release files retrieved from locations listed
402       in the sources.list(5) file are stored in the directory
403       /var/lib/apt/lists, or in the file named by the variable
404       Dir::State::Lists in the apt.conf file. For example, the file
405       debian.lcs.mit.edu_debian_dists_unstable_contrib_binary-i386_Release
406       contains the Release file retrieved from the site debian.lcs.mit.edu
407       for binary-i386 architecture files from the contrib component of the
408       unstable distribution.
409
410   Optional Lines in an APT Preferences Record
411       Each record in the APT preferences file can optionally begin with one
412       or more lines beginning with the word Explanation:. This provides a
413       place for comments.
414

EXAMPLES

416   Tracking Stable
417       The following APT preferences file will cause APT to assign a priority
418       higher than the default (500) to all package versions belonging to a
419       stable distribution and a prohibitively low priority to package
420       versions belonging to other Debian distributions.
421
422           Explanation: Uninstall or do not install any Debian-originated
423           Explanation: package versions other than those in the stable distro
424           Package: *
425           Pin: release a=stable
426           Pin-Priority: 900
427
428           Package: *
429           Pin: release o=Debian
430           Pin-Priority: -10
431
432       With a suitable sources.list(5) file and the above preferences file,
433       any of the following commands will cause APT to upgrade to the latest
434       stable version(s).
435
436           apt-get install package-name
437           apt-get upgrade
438           apt-get dist-upgrade
439
440       The following command will cause APT to upgrade the specified package
441       to the latest version from the testing distribution; the package will
442       not be upgraded again unless this command is given again.
443
444           apt-get install package/testing
445
446
447   Tracking Testing or Unstable
448       The following APT preferences file will cause APT to assign a high
449       priority to package versions from the testing distribution, a lower
450       priority to package versions from the unstable distribution, and a
451       prohibitively low priority to package versions from other Debian
452       distributions.
453
454           Package: *
455           Pin: release a=testing
456           Pin-Priority: 900
457
458           Package: *
459           Pin: release a=unstable
460           Pin-Priority: 800
461
462           Package: *
463           Pin: release o=Debian
464           Pin-Priority: -10
465
466       With a suitable sources.list(5) file and the above preferences file,
467       any of the following commands will cause APT to upgrade to the latest
468       testing version(s).
469
470           apt-get install package-name
471           apt-get upgrade
472           apt-get dist-upgrade
473
474       The following command will cause APT to upgrade the specified package
475       to the latest version from the unstable distribution. Thereafter,
476       apt-get upgrade will upgrade the package to the most recent testing
477       version if that is more recent than the installed version, otherwise,
478       to the most recent unstable version if that is more recent than the
479       installed version.
480
481           apt-get install package/unstable
482
483
484   Tracking the evolution of a codename release
485       The following APT preferences file will cause APT to assign a priority
486       higher than the default (500) to all package versions belonging to a
487       specified codename of a distribution and a prohibitively low priority
488       to package versions belonging to other Debian distributions, codenames
489       and archives. Note that with this APT preference APT will follow the
490       migration of a release from the archive testing to stable and later
491       oldstable. If you want to follow for example the progress in testing
492       notwithstanding the codename changes you should use the example
493       configurations above.
494
495           Explanation: Uninstall or do not install any Debian-originated package versions
496           Explanation: other than those in the distribution codenamed with bullseye or sid
497           Package: *
498           Pin: release n=bullseye
499           Pin-Priority: 900
500
501           Explanation: Debian unstable is always codenamed with sid
502           Package: *
503           Pin: release n=sid
504           Pin-Priority: 800
505
506           Package: *
507           Pin: release o=Debian
508           Pin-Priority: -10
509
510       With a suitable sources.list(5) file and the above preferences file,
511       any of the following commands will cause APT to upgrade to the latest
512       version(s) in the release codenamed with bullseye.
513
514           apt-get install package-name
515           apt-get upgrade
516           apt-get dist-upgrade
517
518       The following command will cause APT to upgrade the specified package
519       to the latest version from the sid distribution. Thereafter, apt-get
520       upgrade will upgrade the package to the most recent bullseye version if
521       that is more recent than the installed version, otherwise, to the most
522       recent sid version if that is more recent than the installed version.
523
524           apt-get install package/sid
525
526

FILES

528       /etc/apt/preferences
529           Version preferences file. This is where you would specify
530           "pinning", i.e. a preference to get certain packages from a
531           separate source or from a different version of a distribution.
532           Configuration Item: Dir::Etc::Preferences.
533
534       /etc/apt/preferences.d/
535           File fragments for the version preferences. Configuration Item:
536           Dir::Etc::PreferencesParts.
537

SEE ALSO

539       apt-get(8) apt-cache(8) apt.conf(5) sources.list(5)
540

BUGS

542       APT bug page[1]. If you wish to report a bug in APT, please see
543       /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.
544

AUTHOR

546       APT team
547

NOTES

549        1. APT bug page
550           http://bugs.debian.org/src:apt
551
552
553
554APT 2.0.2                       17 January 2020             APT_PREFERENCES(5)
Impressum