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, as well as versions that
72           are not phased on this systems.
73
74       priority 100
75           to the version that is already installed (if any) and to the
76           versions coming from archives which in their Release files are
77           marked as "NotAutomatic: yes" and "ButAutomaticUpgrades: yes" like
78           the Debian backports archive since squeeze-backports.
79
80       priority 500
81           to the versions that do not belong to the target release.
82
83       priority 990
84           to the versions that belong to the target release.
85       The highest of those priorities whose description matches the version
86       is assigned to the version.
87
88       If the target release has not been specified then APT simply assigns
89       priority 100 to all installed package versions and priority 500 to all
90       uninstalled package versions, except versions coming from archives
91       which in their Release files are marked as "NotAutomatic: yes" - these
92       versions get the priority 1 or priority 100 if it is additionally
93       marked as "ButAutomaticUpgrades: yes".
94
95       APT then applies the following rules, listed in order of precedence, to
96       determine which version of a package to install.
97
98       •   Never downgrade unless the priority of an available version exceeds
99           1000. ("Downgrading" is installing a less recent version of a
100           package in place of a more recent version. Note that none of APT's
101           default priorities exceeds 1000; such high priorities can only be
102           set in the preferences file. Note also that downgrading a package
103           can be risky.)
104
105       •   Install the highest priority version.
106
107       •   If two or more versions have the same priority, install the most
108           recent one (that is, the one with the higher version number).
109
110       •   If two or more versions have the same priority and version number
111           but either the packages differ in some of their metadata or the
112           --reinstall option is given, install the uninstalled one.
113
114       In a typical situation, the installed version of a package (priority
115       100) is not as recent as one of the versions available from the sources
116       listed in the sources.list(5) file (priority 500 or 990). Then the
117       package will be upgraded when apt-get install some-package or apt-get
118       upgrade is executed.
119
120       More rarely, the installed version of a package is more recent than any
121       of the other available versions. The package will not be downgraded
122       when apt-get install some-package or apt-get upgrade is executed.
123
124       Sometimes the installed version of a package is more recent than the
125       version belonging to the target release, but not as recent as a version
126       belonging to some other distribution. Such a package will indeed be
127       upgraded when apt-get install some-package or apt-get upgrade is
128       executed, because at least one of the available versions has a higher
129       priority than the installed version.
130
131   Phased Updates
132       APT understands a field called Phased-Update-Percentage which can be
133       used to control the rollout of a new version. It is an integer between
134       0 and 100.
135
136       A system's eligibility to a phased update is determined by seeding
137       random number generator with the package source name, the version
138       number, and /etc/machine-id, and then calculating an integer in the
139       range [0, 100]. If this integer is larger than the
140       Phased-Update-Percentage, the version is pinned to 1, and thus held
141       back. Otherwise, normal policy rules apply.
142
143       In case you have multiple systems that you want to receive the same set
144       of updates, you can set APT::Machine-ID to a UUID such that they all
145       phase the same, or set APT::Get::Never-Include-Phased-Updates or
146       APT::Get::Always-Include-Phased-Updates to true such that APT will
147       never/always consider phased updates.
148
149   The Effect of APT Preferences
150       The APT preferences file allows the system administrator to control the
151       assignment of priorities. The file consists of one or more multi-line
152       records separated by blank lines. Records can have one of two forms, a
153       specific form and a general form.
154
155       •   The specific form assigns a priority (a "Pin-Priority") to one or
156           more specified packages with a specified version or version range.
157           For example, the following record assigns a high priority to all
158           versions of the perl package whose version number begins with
159           "5.32". Multiple packages can be separated by spaces.
160
161               Package: perl
162               Pin: version 5.32*
163               Pin-Priority: 1001
164
165       •   The general form assigns a priority to all of the package versions
166           in a given distribution (that is, to all the versions of packages
167           that are listed in a certain Release file) or to all of the package
168           versions coming from a particular Internet site, as identified by
169           the site's fully qualified domain name.
170
171           This general-form entry in the APT preferences file applies only to
172           groups of packages. For example, the following record assigns a
173           high priority to all package versions available from the local
174           site.
175
176               Package: *
177               Pin: origin ""
178               Pin-Priority: 999
179
180           A note of caution: the keyword used here is "origin" which can be
181           used to match a hostname. The following record will assign a high
182           priority to all versions available from the server identified by
183           the hostname "ftp.de.debian.org"
184
185               Package: *
186               Pin: origin "ftp.de.debian.org"
187               Pin-Priority: 999
188
189           This should not be confused with the Origin of a distribution as
190           specified in a Release file. What follows the "Origin:" tag in a
191           Release file is not an Internet address but an author or vendor
192           name, such as "Debian" or "Ximian".
193
194           The following record assigns a low priority to all package versions
195           belonging to any distribution whose Archive name is "unstable".
196
197               Package: *
198               Pin: release a=unstable
199               Pin-Priority: 50
200
201           The following record assigns a high priority to all package
202           versions belonging to any distribution whose Codename is "trixie".
203
204               Package: *
205               Pin: release n=trixie
206               Pin-Priority: 900
207
208           The following record assigns a high priority to all package
209           versions belonging to any release whose Archive name is "stable"
210           and whose release Version number is "12".
211
212               Package: *
213               Pin: release a=stable, v=12
214               Pin-Priority: 500
215
216       The effect of the comma operator is similar to an "and" in logic: All
217       conditions must be satisfied for the pin to match. There is one
218       exception: For any type of condition (such as two "a" conditions), only
219       the last such condition is checked.
220
221   Matching packages in the Package field
222       The Package field specifies the package that a pinning priority is
223       applied to. The field can either contain a binary package name, a
224       source package name (prefixed with "src:"), a glob(7) expression or a
225       regular expression (surrounded by slashes). Multiple package names,
226       glob(7) expressions and regular expressions can be listed separated by
227       whitespace in which case the record will match any of the matched
228       packages.
229
230       By default, only packages of the native architecture are matched. To
231       match binary packages of any architecture, add the :any suffix to the
232       package name. You can also limit matching to a specific architecture by
233       appending the architecture name to the package name, separated by a
234       colon character.
235
236       For example, the following example uses a glob expression and a regular
237       expression to assign the priority 500 to all packages from experimental
238       where the name starts with gnome (as a glob(7)-like expression) or
239       contains the word kde (as a POSIX extended regular expression
240       surrounded by slashes).
241
242           Package: gnome* /kde/
243           Pin: release a=experimental
244           Pin-Priority: 500
245
246       The rule for those expressions is that they can occur anywhere where a
247       string can occur. Thus, the following pin assigns the priority 990 to
248       all packages from a release starting with lunar.
249
250           Package: *
251           Pin: release n=lunar*
252           Pin-Priority: 990
253
254       If a regular expression occurs in a Package field, the behavior is the
255       same as if this regular expression were replaced with a list of all
256       package names it matches. It is undecided whether this will change in
257       the future; thus you should always list wild-card pins first, so later
258       specific pins override it. The pattern "*" in a Package field is not
259       considered a glob(7) expression in itself.
260
261       To pin all binaries produced by the apt source package of this APT's
262       version to 990, you can do:
263
264           Package: src:apt
265           Pin: version 2.7.6
266           Pin-Priority: 990
267
268       Source package pinning can be combined with regular expressions and
269       glob patterns, and can also take a binary architecture.
270
271       For example, let's pin all binaries for all architectures produced by
272       any source package containing apt in its name to 990:
273
274           Package: src:*apt*:any
275           Pin: version *
276           Pin-Priority: 990
277
278       The :any suffix makes sure to select binary packages from any
279       architecture. Without that suffix, apt implicitly assumes the :native
280       suffix which would only select packages from the native architecture.
281
282   How APT Interprets Priorities
283       Priorities (P) assigned in the APT preferences file must be positive or
284       negative integers. They are interpreted as follows (roughly speaking):
285
286       P >= 1000
287           causes a version to be installed even if this constitutes a
288           downgrade of the package
289
290       990 <= P < 1000
291           causes a version to be installed even if it does not come from the
292           target release, unless the installed version is more recent
293
294       500 <= P < 990
295           causes a version to be installed unless there is a version
296           available belonging to the target release or the installed version
297           is more recent
298
299       100 <= P < 500
300           causes a version to be installed unless there is a version
301           available belonging to some other distribution or the installed
302           version is more recent
303
304       0 < P < 100
305           causes a version to be installed only if there is no installed
306           version of the package
307
308       P < 0
309           prevents the version from being installed
310
311       P = 0
312           has undefined behaviour, do not use it.
313
314       The first specific-form record matching an available package version
315       determines the priority of the package version. Failing that, the
316       priority of the package is defined as the maximum of all priorities
317       defined by generic-form records matching the version. Records defined
318       using patterns in the Pin field other than "*" are treated like
319       specific-form records.
320
321       For example, suppose the APT preferences file contains the three
322       records presented earlier:
323
324           Package: perl
325           Pin: version 5.32*
326           Pin-Priority: 1001
327
328           Package: *
329           Pin: origin ""
330           Pin-Priority: 999
331
332           Package: *
333           Pin: release unstable
334           Pin-Priority: 50
335
336       Then:
337
338       •   The most recent available version of the perl package will be
339           installed, so long as that version's version number begins with
340           "5.32". If any 5.32* version of perl is available and the installed
341           version is 5.36*, then perl will be downgraded.
342
343       •   A version of any package other than perl that is available from the
344           local system has priority over other versions, even versions
345           belonging to the target release.
346
347       •   A version of a package whose origin is not the local system but
348           some other site listed in sources.list(5) and which belongs to an
349           unstable distribution is only installed if it is selected for
350           installation and no version of the package is already installed.
351
352
353   Determination of Package Version and Distribution Properties
354       The locations listed in the sources.list(5) file should provide
355       Packages and Release files to describe the packages available at that
356       location.
357
358       The Packages file is normally found in the directory
359       .../dists/dist-name/component/arch: for example,
360       .../dists/stable/main/binary-i386/Packages. It consists of a series of
361       multi-line records, one for each package available in that directory.
362       Only two lines in each record are relevant for setting APT priorities:
363
364       the Package: line
365           gives the package name
366
367       the Version: line
368           gives the version number for the named package
369
370       The Release file is normally found in the directory
371       .../dists/dist-name: for example, .../dists/stable/Release, or
372       .../dists/bookworm/Release. It consists of a single multi-line record
373       which applies to all of the packages in the directory tree below its
374       parent. Unlike the Packages file, nearly all of the lines in a Release
375       file are relevant for setting APT priorities:
376
377       the Archive: or Suite: line
378           names the archive to which all the packages in the directory tree
379           belong. For example, the line "Archive: stable" or "Suite: stable"
380           specifies that all of the packages in the directory tree below the
381           parent of the Release file are in a stable archive. Specifying this
382           value in the APT preferences file would require the line:
383
384               Pin: release a=stable
385
386       the Codename: line
387           names the codename to which all the packages in the directory tree
388           belong. For example, the line "Codename: trixie" specifies that all
389           of the packages in the directory tree below the parent of the
390           Release file belong to a version named trixie. Specifying this
391           value in the APT preferences file would require the line:
392
393               Pin: release n=trixie
394
395       the Version: line
396           names the release version. For example, the packages in the tree
397           might belong to Debian release version 12. Note that there is
398           normally no version number for the testing and unstable
399           distributions because they have not been released yet. Specifying
400           this in the APT preferences file would require one of the following
401           lines.
402
403               Pin: release v=12
404               Pin: release a=stable, v=12
405               Pin: release 12
406
407       the Component: line
408           names the licensing component associated with the packages in the
409           directory tree of the Release file. For example, the line
410           "Component: main" specifies that all the packages in the directory
411           tree are from the main component, which entails that they are
412           licensed under terms listed in the Debian Free Software Guidelines.
413           Specifying this component in the APT preferences file would require
414           the line:
415
416               Pin: release c=main
417
418       the Origin: line
419           names the originator of the packages in the directory tree of the
420           Release file. Most commonly, this is Debian. Specifying this origin
421           in the APT preferences file would require the line:
422
423               Pin: release o=Debian
424
425       the Label: line
426           names the label of the packages in the directory tree of the
427           Release file. Most commonly, this is Debian. Specifying this label
428           in the APT preferences file would require the line:
429
430               Pin: release l=Debian
431
432       All of the Packages and Release files retrieved from locations listed
433       in the sources.list(5) file are stored in the directory
434       /var/lib/apt/lists, or in the file named by the variable
435       Dir::State::Lists in the apt.conf file. For example, the file
436       debian.lcs.mit.edu_debian_dists_unstable_contrib_binary-i386_Release
437       contains the Release file retrieved from the site debian.lcs.mit.edu
438       for binary-i386 architecture files from the contrib component of the
439       unstable distribution.
440
441   Optional Lines in an APT Preferences Record
442       Each record in the APT preferences file can optionally begin with one
443       or more lines beginning with the word Explanation:. This provides a
444       place for comments.
445

EXAMPLES

447   Tracking Stable
448       The following APT preferences file will cause APT to assign a priority
449       higher than the default (500) to all package versions belonging to a
450       stable distribution and a prohibitively low priority to package
451       versions belonging to other Debian distributions.
452
453           Explanation: Uninstall or do not install any Debian-originated
454           Explanation: package versions other than those in the stable distro
455           Package: *
456           Pin: release a=stable
457           Pin-Priority: 900
458
459           Package: *
460           Pin: release o=Debian
461           Pin-Priority: -10
462
463       With a suitable sources.list(5) file and the above preferences file,
464       any of the following commands will cause APT to upgrade to the latest
465       stable version(s).
466
467           apt-get install package-name
468           apt-get upgrade
469           apt-get dist-upgrade
470
471       The following command will cause APT to upgrade the specified package
472       to the latest version from the testing distribution; the package will
473       not be upgraded again unless this command is given again.
474
475           apt-get install package/testing
476
477
478   Tracking Testing or Unstable
479       The following APT preferences file will cause APT to assign a high
480       priority to package versions from the testing distribution, a lower
481       priority to package versions from the unstable distribution, and a
482       prohibitively low priority to package versions from other Debian
483       distributions.
484
485           Package: *
486           Pin: release a=testing
487           Pin-Priority: 900
488
489           Package: *
490           Pin: release a=unstable
491           Pin-Priority: 800
492
493           Package: *
494           Pin: release o=Debian
495           Pin-Priority: -10
496
497       With a suitable sources.list(5) file and the above preferences file,
498       any of the following commands will cause APT to upgrade to the latest
499       testing version(s).
500
501           apt-get install package-name
502           apt-get upgrade
503           apt-get dist-upgrade
504
505       The following command will cause APT to upgrade the specified package
506       to the latest version from the unstable distribution. Thereafter,
507       apt-get upgrade will upgrade the package to the most recent testing
508       version if that is more recent than the installed version, otherwise,
509       to the most recent unstable version if that is more recent than the
510       installed version.
511
512           apt-get install package/unstable
513
514
515   Tracking the evolution of a codename release
516       The following APT preferences file will cause APT to assign a priority
517       higher than the default (500) to all package versions belonging to a
518       specified codename of a distribution and a prohibitively low priority
519       to package versions belonging to other Debian distributions, codenames
520       and archives. Note that with this APT preference APT will follow the
521       migration of a release from the archive testing to stable and later
522       oldstable. If you want to follow for example the progress in testing
523       notwithstanding the codename changes you should use the example
524       configurations above.
525
526           Explanation: Uninstall or do not install any Debian-originated package versions
527           Explanation: other than those in the distribution codenamed with trixie or sid
528           Package: *
529           Pin: release n=trixie
530           Pin-Priority: 900
531
532           Explanation: Debian unstable is always codenamed with sid
533           Package: *
534           Pin: release n=sid
535           Pin-Priority: 800
536
537           Package: *
538           Pin: release o=Debian
539           Pin-Priority: -10
540
541       With a suitable sources.list(5) file and the above preferences file,
542       any of the following commands will cause APT to upgrade to the latest
543       version(s) in the release codenamed with trixie.
544
545           apt-get install package-name
546           apt-get upgrade
547           apt-get dist-upgrade
548
549       The following command will cause APT to upgrade the specified package
550       to the latest version from the sid distribution. Thereafter, apt-get
551       upgrade will upgrade the package to the most recent trixie version if
552       that is more recent than the installed version, otherwise, to the most
553       recent sid version if that is more recent than the installed version.
554
555           apt-get install package/sid
556
557

FILES

559       /etc/apt/preferences
560           Version preferences file. This is where you would specify
561           "pinning", i.e. a preference to get certain packages from a
562           separate source or from a different version of a distribution.
563           Configuration Item: Dir::Etc::Preferences.
564
565       /etc/apt/preferences.d/
566           File fragments for the version preferences. Configuration Item:
567           Dir::Etc::PreferencesParts.
568

SEE ALSO

570       apt-get(8) apt-cache(8) apt.conf(5) sources.list(5)
571

BUGS

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

AUTHOR

577       APT team
578

NOTES

580        1. APT bug page
581           http://bugs.debian.org/src:apt
582
583
584
585APT 2.7.6                       03 January 2022             APT_PREFERENCES(5)
Impressum