info > APT.CONF

๐Ÿ“– NAME

apt.conf - Configuration file for APT

๐Ÿš€ Quick Reference

Use CaseCommandDescription
๐Ÿ“‹ Set default releaseAPT::Default-Release "stable";Install packages from a specific release
๐Ÿ”ง Set proxy for HTTPAcquire::http::Proxy "http://proxy:8080";Configure HTTP proxy for package downloads
๐Ÿงช Debug dependency resolverDebug::pkgProblemResolver "true";Enable debug output for dependency resolution
๐Ÿ”„ Force IPv4Acquire::ForceIPv4 "true";Force IPv4 for all downloads
๐Ÿ“ฆ Disable PDiffsAcquire::PDiffs "false";Download full index files instead of patches
๐Ÿ”’ Ignore security checksAcquire::AllowInsecureRepositories "true";Allow repositories without GPG signatures
๐Ÿ—‘๏ธ Clean cacheDSelect::Clean "auto";Auto-remove outdated package cache files
โฑ๏ธ Set retriesAcquire::Retries 3;Number of download retry attempts

๐Ÿ“ DESCRIPTION

/etc/apt/apt.conf is the main configuration file shared by all the tools in the APT suite of tools, though it is by no means the only place options can be set. The suite also shares a common command line parser to provide a uniform environment.

When an APT tool starts up it will read the configuration files in the following order:

  1. ๐Ÿ“„ the file specified by the APT_CONFIG environment variable (if any)
  2. ๐Ÿ“ all files in Dir::Etc::Parts in alphanumeric ascending order which have either no or "conf" as filename extension and which only contain alphanumeric, hyphen (-), underscore (_) and period (.) characters. Otherwise APT will print a notice that it has ignored a file, unless that file matches a pattern in the Dir::Ignore-Files-Silently configuration list - in which case it will be silently ignored.
  3. โš™๏ธ the main configuration file specified by Dir::Etc::main
  4. ๐Ÿ”€ all options set in the binary specific configuration subtree are moved into the root of the tree.
  5. ๐ŸŽฏ the command line options are applied to override the configuration directives or to load even more configuration files.

๐Ÿ”ค SYNTAX

The configuration file is organized in a tree with options organized into functional groups. Option specification is given with a double colon notation; for instance APT::Get::Assume-Yes is an option within the APT tool group, for the Get tool. Options do not inherit from their parent groups.

Syntactically the configuration language is modeled after what the ISC tools such as bind and dhcp use. Lines starting with // are treated as comments (ignored), as well as all text between /* and */, just like C/C++ comments. Lines starting with # are also treated as comments. Each line is of the form APT::Get::Assume-Yes "true";. The quotation marks and trailing semicolon are required. The value must be on one line, and there is no kind of string concatenation. Values must not include backslashes or extra quotation marks. Option names are made up of alphanumeric characters and the characters /-:._+. A new scope can be opened with curly braces, like this:

APT {
  Get {
    Assume-Yes "true";
    Fix-Broken "true";
  };
};

with newlines placed to make it more readable. Lists can be created by opening a scope and including a single string enclosed in quotes followed by a semicolon. Multiple entries can be included, separated by a semicolon.

DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};

In general the sample configuration file /usr/share/doc/apt/examples/configure-index.gz is a good guide for how it should look.

Case is not significant in names of configuration items, so in the previous example you could use dpkg::pre-install-pkgs.

Names for the configuration items are optional if a list is defined as can be seen in the DPkg::Pre-Install-Pkgs example above. If you don't specify a name a new entry will simply add a new option to the list. If you specify a name you can override the option in the same way as any other option by reassigning a new value to the option.

Two special commands are defined: #include (which is deprecated and not supported by alternative implementations) and #clear. #include will include the given file, unless the filename ends in a slash, in which case the whole directory is included. #clear is used to erase a part of the configuration tree. The specified element and all its descendants are erased. (Note that these lines also need to end with a semicolon.)

The #clear command is the only way to delete a list or a complete scope. Reopening a scope (or using the syntax described below with an appended ::) will not override previously written entries. Options can only be overridden by addressing a new value to them - lists and scopes can't be overridden, only cleared.

All of the APT tools take an -o option which allows an arbitrary configuration directive to be specified on the command line. The syntax is a full option name (APT::Get::Assume-Yes for instance) followed by an equals sign then the new value of the option. To append a new element to a list, add a trailing :: to the name of the list. (As you might suspect, the scope syntax can't be used on the command line.)

Note that appending items to a list using :: only works for one item per line, and that you should not use it in combination with the scope syntax (which adds :: implicitly). Using both syntaxes together will trigger a bug which some users unfortunately depend on: an option with the unusual name "::" which acts like every other option with a name. This introduces many problems; for one thing, users who write multiple lines in this wrong syntax in the hope of appending to a list will achieve the opposite, as only the last assignment for this option "::" will be used. Future versions of APT will raise errors and stop working if they encounter this misuse, so please correct such statements now while APT doesn't explicitly complain about them.

๐Ÿ“ฆ THE APT GROUP

This group of options controls general APT behavior as well as holding the options for all of the tools.

APT::Compressor::rev {
    Name "rev";
    Extension ".reversed";
    Binary "rev";
    CompressArg {};
    UncompressArg {};
    Cost "10";
};

The immediate configuration marker is also applied in the potentially problematic case of circular dependencies, since a dependency with the immediate flag is equivalent to a Pre-Dependency. In theory this allows APT to recognise a situation in which it is unable to perform immediate configuration, abort, and suggest to the user that the option should be temporarily deactivated in order to allow the operation to proceed. Note the use of the word "theory" here; in the real world this problem has rarely been encountered, in non-stable distribution versions, and was caused by wrong dependencies of the package in question or by a system in an already broken state; so you should not blindly disable this option, as the scenario mentioned above is not the only problem it can help to prevent in the first place.

Before a big operation like dist-upgrade is run with this option disabled you should try to explicitly install the package APT is unable to configure immediately; but please make sure you also report your problem to your distribution and to the APT team with the bug link below, so they can work on improving or correcting the upgrade process.

๐Ÿ“ฅ THE ACQUIRE GROUP

The Acquire group of options controls the download of packages as well as the various "acquire methods" responsible for the download itself (see also sources.list(5)).

Two sub-options to limit the use of PDiffs are also available: FileLimit can be used to specify a maximum number of PDiff files should be downloaded to update a file. SizeLimit on the other hand is the maximum percentage of the size of all patches compared to the size of the targeted file. If one of these limits is exceeded the complete file is downloaded instead of the patches.

The option timeout sets the timeout timer used by the method; this value applies to the connection as well as the data timeout.

Several settings are provided to control passive mode. Generally it is safe to leave passive mode on; it works in nearly every environment. However, some situations require that passive mode be disabled and port mode FTP used instead. This can be done globally or for connections that go through a proxy or for a specific host (see the sample config file for examples).

It is possible to proxy FTP over HTTP by setting the ftp_proxy environment variable to an HTTP URL - see the discussion of the http method above for syntax. You cannot set this in the configuration file and it is not recommended to use FTP over HTTP due to its low efficiency.

The setting ForceExtended controls the use of RFC2428 EPSV and EPRT commands. The default is false, which means these commands are only used if the control connection is IPv6. Setting this to true forces their use even on IPv4 connections. Note that most FTP servers do not support RFC2428.

/cdrom/::Mount "foo";

within the cdrom block. It is important to have the trailing slash. Unmount commands can be specified using UMount.

Acquire::CompressionTypes::FileExtension "Methodname";

Also, the Order subgroup can be used to define in which order the acquire system will try to download the compressed files. The acquire system will try the first and proceed with the next compression type in this list on error, so to prefer one over the other type simply add the preferred type first - types not already added will be implicitly appended to the end of the list, so e.g.

Acquire::CompressionTypes::Order:: "gz";

can be used to prefer gzip compressed files over all other compression formats. If xz should be preferred over gzip and bzip2 the configure setting should look like this:

Acquire::CompressionTypes::Order { "xz"; "gz"; };

It is not needed to add bz2 to the list explicitly as it will be added automatically.

Note that the Dir::Bin::Methodname will be checked at run time. If this option has been set and support for this format isn't directly built into apt, the method will only be used if this file exists; e.g. for the bzip2 method (the inbuilt) setting is:

Dir::Bin::bzip2 "/bin/bzip2";

Note also that list entries specified on the command line will be added at the end of the list specified in the configuration files, but before the default entries. To prefer a type in this case over the ones specified in the configuration files you can set the option direct - not in list style. This will not override the defined list; it will only prefix the list with this type.

The special type uncompressed can be used to give uncompressed files a preference, but note that most archives don't provide uncompressed files so this is mostly only usable for local mirrors.

The default list includes "environment" and "en". "environment" has a special meaning here: it will be replaced at runtime with the language codes extracted from the LC_MESSAGES environment variable. It will also ensure that these codes are not included twice in the list. If LC_MESSAGES is set to "C" only the Translation-en file (if available) will be used. To force APT to use no Translation file use the setting Acquire::Languages=none. "none" is another special meaning code which will stop the search for a suitable Translation file. This tells APT to download these translations too, without actually using them unless the environment specifies the languages. So the following example configuration will result in the order "en, de" in an English locale or "de, en" in a German one. Note that "fr" is downloaded, but not used unless APT is used in a French locale (where the order would be "fr, de, en").

Acquire::Languages { "environment"; "de"; "en"; "none"; "fr"; };

Note: To prevent problems resulting from APT being executed in different environments (e.g. by different users or by other programs) all Translation files which are found in /var/lib/apt/lists/ will be added to the end of the list (after an implicit "none").

๐Ÿ”ง BINARY SPECIFIC CONFIGURATION

Especially with the introduction of the apt binary it can be useful to set certain options only for a specific binary as even options which look like they would effect only a certain binary like APT::Get::Show-Versions effect apt-get as well as apt.

Setting an option for a specific binary only can be achieved by setting the option inside the Binary::specific-binary scope. Setting the option APT::Get::Show-Versions for the apt only can e.g. by done by setting Binary::apt::APT::Get::Show-Versions instead.

Note that as seen in the DESCRIPTION section further above you can't set binary-specific options on the commandline itself nor in configuration files loaded via the commandline.

๐Ÿ“ DIRECTORIES

The Dir::State section has directories that pertain to local state information. lists is the directory to place downloaded package lists in and status is the name of the dpkg(1) status file. preferences is the name of the APT preferences file. Dir::State contains the default directory to prefix on all sub-items if they do not start with / or ./.

Dir::Cache contains locations pertaining to local cache information, such as the two package caches srcpkgcache and pkgcache as well as the location to place downloaded archives, Dir::Cache::archives. Generation of caches can be turned off by setting pkgcache or srcpkgcache to "". This will slow down startup but save disk space. It is probably preferable to turn off the pkgcache rather than the srcpkgcache. Like Dir::State the default directory is contained in Dir::Cache

Dir::Etc contains the location of configuration files, sourcelist gives the location of the sourcelist and main is the default configuration file (setting has no effect, unless it is done from the config file specified by APT_CONFIG).

The Dir::Parts setting reads in all the config fragments in lexical order from the directory specified. After this is done then the main config file is loaded.

Binary programs are pointed to by Dir::Bin. Dir::Bin::Methods specifies the location of the method handlers and gzip, bzip2, lzma, dpkg, apt-get dpkg-source dpkg-buildpackage and apt-cache specify the location of the respective programs.

The configuration item RootDir has a special meaning. If set, all paths will be relative to RootDir, even paths that are specified absolutely. So, for instance, if RootDir is set to /tmp/staging and Dir::State::status is set to /var/lib/dpkg/status, then the status file will be looked up in /tmp/staging/var/lib/dpkg/status. If you want to prefix only relative paths, set Dir instead.

The Ignore-Files-Silently list can be used to specify which files APT should silently ignore while parsing the files in the fragment directories. Per default a file which ends with .disabled, ~, .bak or .dpkg-[a-z]+ is silently ignored. As seen in the last default value these patterns can use regular expression syntax.

๐ŸŽฏ APT IN DSELECT

When APT is used as a dselect(1) method several configuration directives control the default behavior. These are in the DSelect section.

๐Ÿ”จ HOW APT CALLS DPKG(1)

Several configuration directives control how APT invokes dpkg(1). These are in the DPkg section.

Version 2 of this protocol sends more information through the requested file descriptor: a line with the text VERSION 2, the APT configuration space, and a list of package actions with filename and version information.

Each configuration directive line has the form key=value. Special characters (equal signs, newlines, nonprintable characters, quotation marks, and percent signs in key and newlines, nonprintable characters, and percent signs in value) are %-encoded. Lists are represented by multiple key::=value lines with the same key. The configuration section ends with a blank line.

Package action lines consist of five fields in Version 2: package name (without architecture qualification even if foreign), old version, direction of version change (< for upgrades, > for downgrades, = for no change), new version, action. The version fields are "-" for no version at all (for example when installing a package for the first time; no version is treated as earlier than any real version, so that is an upgrade, indicated as - < 1.23.4). The action field is "**CONFIGURE**" if the package is being configured, "**REMOVE**" if it is being removed, or the filename of a .deb file if it is being unpacked.

In Version 3 after each version field follows the architecture of this version, which is "-" if there is no version, and a field showing the MultiArch type "same", "foreign", "allowed" or "none". Note that "none" is an incorrect typename which is just kept to remain compatible, it should be read as "no" and users are encouraged to support both.

The version of the protocol to be used for the command cmd can be chosen by setting DPkg::Tools::options::cmd::Version accordingly, the default being version 1. If APT isn't supporting the requested version it will send the information in the highest version it has support for instead.

The file descriptor to be used to send the information can be requested with DPkg::Tools::options::cmd::InfoFD which defaults to 0 for standard input and is available since version 0.9.11. Support for the option can be detected by looking for the environment variable APT_HOOK_INFO_FD which contains the number of the used file descriptor as a confirmation.

๐Ÿ”„ PERIODIC AND ARCHIVES OPTIONS

APT::Periodic and APT::Archives groups of options configure behavior of apt periodic updates, which is done by the /usr/lib/apt/apt.systemd.daily script. See the top of this script for the brief documentation of these options.

๐Ÿ› DEBUG OPTIONS

Enabling options in the Debug:: section will cause debugging information to be sent to the standard error stream of the program utilizing the apt libraries, or enable special program modes that are primarily useful for debugging the behavior of apt. Most of these options are not interesting to a normal user, but a few may be:

A full list of debugging options to apt follows.

๐Ÿ“‹ EXAMPLES

/usr/share/doc/apt/examples/configure-index.gz is a configuration file showing example values for all possible options.

๐Ÿ“ FILES

๐Ÿ“š SEE ALSO

apt-cache(8), apt-config(8), apt_preferences(5).

๐Ÿ› BUGS

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

โœ๏ธ AUTHORS

Jason Gunthorpe

APT team

Daniel Burrows <dburrows AT debian.org> โ€” Initial documentation of Debug::*.

๐Ÿ“ NOTES

  1. APT bug page: http://bugs.debian.org/src:apt

APT 2.4.14 โ€” 03 January 2016 โ€” APT.CONF(5)

APT.CONF
๐Ÿ“– NAME ๐Ÿš€ Quick Reference ๐Ÿ“ DESCRIPTION ๐Ÿ”ค SYNTAX ๐Ÿ“ฆ THE APT GROUP ๐Ÿ“ฅ THE ACQUIRE GROUP ๐Ÿ”ง BINARY SPECIFIC CONFIGURATION ๐Ÿ“ DIRECTORIES ๐ŸŽฏ APT IN DSELECT ๐Ÿ”จ HOW APT CALLS DPKG(1) ๐Ÿ”„ PERIODIC AND ARCHIVES OPTIONS ๐Ÿ› DEBUG OPTIONS ๐Ÿ“‹ EXAMPLES ๐Ÿ“ FILES ๐Ÿ“š SEE ALSO ๐Ÿ› BUGS โœ๏ธ AUTHORS ๐Ÿ“ NOTES

Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-24 03:43 @216.73.216.102
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!