]> git.saurik.com Git - apt.git/blame - doc/guide.dbk
make test_unauthenticated_to_invalid_inrelease work
[apt.git] / doc / guide.dbk
CommitLineData
271733ee
GJ
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- -*- DocBook -*- -->
3<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
5<!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
6]>
7
8<book lang="en">
9
10<title>APT User's Guide</title>
11
12<bookinfo>
13
14<authorgroup>
15 <author>
16 <personname>Jason Gunthorpe</personname><email>jgg@debian.org</email>
17 </author>
18</authorgroup>
19
20<releaseinfo>Version &apt-product-version;</releaseinfo>
21
22<abstract>
23<para>
24This document provides an overview of how to use the the APT package manager.
25</para>
26</abstract>
27
28<copyright><year>1998</year><holder>Jason Gunthorpe</holder></copyright>
29
30<legalnotice>
31<title>License Notice</title>
32<para>
33"APT" and this document are free software; you can redistribute them and/or
34modify them under the terms of the GNU General Public License as published by
35the Free Software Foundation; either version 2 of the License, or (at your
36option) any later version.
37</para>
38</legalnotice>
39
40<legalnotice>
41<para>
42For more details, on Debian systems, see the file
43/usr/share/common-licenses/GPL for the full license.
44</para>
45</legalnotice>
46
47</bookinfo>
48
49<chapter id="ch1"><title>General</title>
50<para>
51The APT package currently contains two sections, the APT
52<command>dselect</command> method and the <command>apt-get</command> command
53line user interface. Both provide a way to install and remove packages as well
54as download new packages from the Internet.
55</para>
56
57<section id="s1.1"><title>Anatomy of the Package System</title>
58<para>
59The Debian packaging system has a large amount of information associated with
60each package to help assure that it integrates cleanly and easily into the
61system. The most prominent of its features is the dependency system.
62</para>
63<para>
64The dependency system allows individual programs to make use of shared elements
65in the system such as libraries. It simplifies placing infrequently used
66portions of a program in separate packages to reduce the number of things the
67average user is required to install. Also, it allows for choices in mail
68transport agents, X servers and so on.
69</para>
70<para>
71The first step to understanding the dependency system is to grasp the concept
72of a simple dependency. The meaning of a simple dependency is that a package
73requires another package to be installed at the same time to work properly.
74</para>
75<para>
76For instance, mailcrypt is an emacs extension that aids in encrypting email
77with GPG. Without GPGP installed mailcrypt is useless, so mailcrypt has a
78simple dependency on GPG. Also, because it is an emacs extension it has a
79simple dependency on emacs, without emacs it is completely useless.
80</para>
81<para>
82The other important dependency to understand is a conflicting dependency. It
83means that a package, when installed with another package, will not work and
84may possibly be extremely harmful to the system. As an example consider a mail
85transport agent such as sendmail, exim or qmail. It is not possible to have
86two mail transport agents installed because both need to listen to the network
87to receive mail. Attempting to install two will seriously damage the system so
88all mail transport agents have a conflicting dependency with all other mail
89transport agents.
90</para>
91<para>
92As an added complication there is the possibility for a package to pretend to
93be another package. Consider that exim and sendmail for many intents are
94identical, they both deliver mail and understand a common interface. Hence,
95the package system has a way for them to declare that they are both
96mail-transport-agents. So, exim and sendmail both declare that they provide a
97mail-transport-agent and other packages that need a mail transport agent depend
98on mail-transport-agent. This can add a great deal of confusion when trying to
99manually fix packages.
100</para>
101<para>
102At any given time a single dependency may be met by packages that are already
103installed or it may not be. APT attempts to help resolve dependency issues by
104providing a number of automatic algorithms that help in selecting packages for
105installation.
106</para>
107</section>
108
109</chapter>
110
111<chapter id="ch2"><title>apt-get</title>
112<para>
113<command>apt-get</command> provides a simple way to install packages from the
114command line. Unlike <command>dpkg</command>, <command>apt-get</command> does
115not understand .deb files, it works with the package's proper name and can only
116install .deb archives from a <emphasis>Source</emphasis>.
117</para>
118<para>
119The first <footnote><para> If you are using an http proxy server you must set
120the http_proxy environment variable first, see sources.list(5) </para>
121</footnote> thing that should be done before using <command>apt-get</command>
122is to fetch the package lists from the <emphasis>Sources</emphasis> so that it
123knows what packages are available. This is done with <literal>apt-get
124update</literal>. For instance,
125</para>
126<screen>
127# apt-get update
128Get http://ftp.de.debian.org/debian-non-US/ stable/binary-i386/ Packages
129Get http://llug.sep.bnl.gov/debian/ testing/contrib Packages
130Reading Package Lists... Done
131Building Dependency Tree... Done
132</screen>
133<para>
134Once updated there are several commands that can be used:
135</para>
136<variablelist>
137<varlistentry>
138<term>upgrade</term>
139<listitem>
140<para>
141Upgrade will attempt to gently upgrade the whole system. Upgrade will never
142install a new package or remove an existing package, nor will it ever upgrade a
143package that might cause some other package to break. This can be used daily
144to relatively safely upgrade the system. Upgrade will list all of the packages
145that it could not upgrade, this usually means that they depend on new packages
146or conflict with some other package. <command>dselect</command> or
147<literal>apt-get install</literal> can be used to force these packages to
148install.
149</para>
150</listitem>
151</varlistentry>
152<varlistentry>
153<term>install</term>
154<listitem>
155<para>
156Install is used to install packages by name. The package is automatically
157fetched and installed. This can be useful if you already know the name of the
158package to install and do not want to go into a GUI to select it. Any number
159of packages may be passed to install, they will all be fetched. Install
160automatically attempts to resolve dependency problems with the listed packages
161and will print a summary and ask for confirmation if anything other than its
162arguments are changed.
163</para>
164</listitem>
165</varlistentry>
166<varlistentry>
167<term>dist-upgrade</term>
168<listitem>
169<para>
170Dist-upgrade is a complete upgrader designed to simplify upgrading between
171releases of Debian. It uses a sophisticated algorithm to determine the best
172set of packages to install, upgrade and remove to get as much of the system to
173the newest release. In some situations it may be desired to use dist-upgrade
174rather than spend the time manually resolving dependencies in
175<command>dselect</command>. Once dist-upgrade has completed then
176<command>dselect</command> can be used to install any packages that may have
177been left out.
178</para>
179<para>
180It is important to closely look at what dist-upgrade is going to do, its
181decisions may sometimes be quite surprising.
182</para>
183</listitem>
184</varlistentry>
185</variablelist>
186<para>
187<command>apt-get</command> has several command line options that are detailed
188in its man page,
189<citerefentry><refentrytitle>apt-get</refentrytitle><manvolnum>8</manvolnum></citerefentry>. The
190most useful option is <literal>-d</literal> which does not install the
191fetched files. If the system has to download a large number of package it
192would be undesired to start installing them in case something goes wrong. When
193<literal>-d</literal> is used the downloaded archives can be installed by
194simply running the command that caused them to be downloaded again without
195<literal>-d</literal>.
196</para>
197</chapter>
198
199<chapter id="ch3"><title>DSelect</title>
200<para>
201The APT <command>dselect</command> method provides the complete
202APT system with the <command>dselect</command> package selection
203GUI. <command>dselect</command> is used to select the packages to be
204installed or removed and APT actually installs them.
205</para>
206<para>
207To enable the APT method you need to select [A]ccess in
208<command>dselect</command> and then choose the APT method. You will be
209prompted for a set of <emphasis>Sources</emphasis> which are places to fetch
210archives from. These can be remote Internet sites, local Debian mirrors or
211CD-ROMs. Each source can provide a fragment of the total Debian archive, APT
212will automatically combine them to form a complete set of packages. If you
213have a CD-ROM then it is a good idea to specify it first and then specify a
214mirror so that you have access to the latest bug fixes. APT will automatically
215use packages on your CD-ROM before downloading from the Internet.
216</para>
217<screen>
218 Set up a list of distribution source locations
219
220 Please give the base URL of the debian distribution.
221 The access schemes I know about are: http file
222
223 For example:
224 file:/mnt/debian,
225 ftp://ftp.debian.org/debian,
226 http://ftp.de.debian.org/debian,
227
228
229 URL [http://llug.sep.bnl.gov/debian]:
230</screen>
231<para>
232The <emphasis>Sources</emphasis> setup starts by asking for the base of the
233Debian archive, defaulting to a HTTP mirror. Next it asks for the distribution
234to get.
235</para>
236<screen>
237 Please give the distribution tag to get or a path to the
238 package file ending in a /. The distribution
239 tags are typically something like: stable unstable testing non-US
240
241 Distribution [stable]:
242</screen>
243<para>
244The distribution refers to the Debian version in the archive,
245<emphasis>stable</emphasis> refers to the latest released version
246and <emphasis>unstable</emphasis> refers to the developmental
247version. <emphasis>non-US</emphasis> is only available on some mirrors
248and refers to packages that contain encryption technology or other
249things that cannot be exported from the United States. Importing these
250packages into the US is legal however.
251</para>
252<screen>
253 Please give the components to get
254 The components are typically something like: main contrib non-free
255
256 Components [main contrib non-free]:
257</screen>
258<para>
259The components list refers to the list of sub distributions to fetch. The
260distribution is split up based on software licenses, main being DFSG free
261packages while contrib and non-free contain things that have various
262restrictions placed on their use and distribution.
263</para>
264<para>
265Any number of sources can be added, the setup script will continue to prompt
266until you have specified all that you want.
267</para>
268<para>
269Before starting to use <command>dselect</command> it is necessary to update
270the available list by selecting [U]pdate from the menu. This is a superset of
271<literal>apt-get update</literal> that makes the fetched information available
272to <command>dselect</command>. [U]pdate must be performed even if
273<literal>apt-get update</literal> has been run before.
274</para>
275<para>
276You can then go on and make your selections using [S]elect and then perform
277the installation using [I]nstall. When using the APT method the [C]onfig and
278[R]emove commands have no meaning, the [I]nstall command performs both of
279them together.
280</para>
281<para>
282By default APT will automatically remove the package (.deb) files once they
283have been successfully installed. To change this behavior place
284<literal>Dselect::clean "prompt";</literal> in /etc/apt/apt.conf.
285</para>
286</chapter>
287
288<chapter id="ch4"><title>The Interface</title>
289<para>
290Both that APT <command>dselect</command> method and <command>apt-get</command>
291share the same interface. It is a simple system that generally tells you what
292it will do and then goes and does it. <footnote><para> The
293<command>dselect</command> method actually is a set of wrapper scripts to
294<command>apt-get</command>. The method actually provides more functionality
295than is present in <command>apt-get</command> alone. </para> </footnote> After
296printing out a summary of what will happen APT then will print out some
297informative status messages so that you can estimate how far along it is and
298how much is left to do.
299</para>
300
301<section id="s4.1"><title>Startup</title>
302<para>
303Before all operations except update, APT performs a number of actions
304to prepare its internal state. It also does some checks of the system's
305state. At any time these operations can be performed by running
306<literal>apt-get check</literal>.
307</para>
308<screen>
309# apt-get check
310Reading Package Lists... Done
311Building Dependency Tree... Done
312</screen>
313<para>
314The first thing it does is read all the package files into memory. APT uses a
315caching scheme so this operation will be faster the second time it is run. If
316some of the package files are not found then they will be ignored and a
317warning will be printed when apt-get exits.
318</para>
319<para>
320The final operation performs a detailed analysis of the system's
321dependencies. It checks every dependency of every installed or unpacked
322package and considers if it is OK. Should this find a problem then a report
323will be printed out and <command>apt-get</command> will refuse to run.
324</para>
325<screen>
326# apt-get check
327Reading Package Lists... Done
328Building Dependency Tree... Done
329You might want to run apt-get -f install' to correct these.
330Sorry, but the following packages have unmet dependencies:
331 9fonts: Depends: xlib6g but it is not installed
332 uucp: Depends: mailx but it is not installed
333 blast: Depends: xlib6g (&gt;= 3.3-5) but it is not installed
334 adduser: Depends: perl-base but it is not installed
335 aumix: Depends: libgpmg1 but it is not installed
336 debiandoc-sgml: Depends: sgml-base but it is not installed
337 bash-builtins: Depends: bash (&gt;= 2.01) but 2.0-3 is installed
338 cthugha: Depends: svgalibg1 but it is not installed
339 Depends: xlib6g (&gt;= 3.3-5) but it is not installed
340 libreadlineg2: Conflicts:libreadline2 (&lt;&lt; 2.1-2.1)
341</screen>
342<para>
343In this example the system has many problems, including a serious problem with
344libreadlineg2. For each package that has unmet dependencies a line is printed
345out indicating the package with the problem and the dependencies that are
346unmet. A short explanation of why the package has a dependency problem is also
347included.
348</para>
349<para>
350There are two ways a system can get into a broken state like this. The
351first is caused by <command>dpkg</command> missing some subtle relationships
352between packages when performing upgrades. <footnote><para> APT however
353considers all known dependencies and attempts to prevent broken
354packages </para> </footnote>. The second is if a package installation
355fails during an operation. In this situation a package may have been
356unpacked without its dependents being installed.
357</para>
358<para>
359The second situation is much less serious than the first because APT places
360certain constraints on the order that packages are installed. In both cases
361supplying the <literal>-f</literal> option to <command>apt-get</command>
362will cause APT to deduce a possible solution to the problem and then
363continue on. The APT <command>dselect</command> method always supplies
364the <literal>-f</literal> option to allow for easy continuation of failed
365maintainer scripts.
366</para>
367<para>
368However, if the <literal>-f</literal> option is used to correct a seriously
369broken system caused by the first case then it is possible that it will either
370fail immediately or the installation sequence will fail. In either case it is
371necessary to manually use dpkg (possibly with forcing options) to correct the
372situation enough to allow APT to proceed.
373</para>
374</section>
375
376<section id="s4.2"><title>The Status Report</title>
377<para>
378Before proceeding <command>apt-get</command> will present a report on what will
379happen. Generally the report reflects the type of operation being performed
380but there are several common elements. In all cases the lists reflect the
381final state of things, taking into account the <literal>-f</literal> option
382and any other relevant activities to the command being executed.
383</para>
384
385<section id="s4.2.1"><title>The Extra Package list</title>
386<screen>
387The following extra packages will be installed:
388 libdbd-mysql-perl xlib6 zlib1 xzx libreadline2 libdbd-msql-perl
389 mailpgp xdpkg fileutils pinepgp zlib1g xlib6g perl-base
390 bin86 libgdbm1 libgdbmg1 quake-lib gmp2 bcc xbuffy
391 squake pgp-i python-base debmake ldso perl libreadlineg2
392 ssh
393</screen>
394<para>
395The Extra Package list shows all of the packages that will be installed or
396upgraded in excess of the ones mentioned on the command line. It is only
397generated for an <literal>install</literal> command. The listed packages are
398often the result of an Auto Install.
399</para>
400</section>
401
402<section id="s4.2.2"><title>The Packages to Remove</title>
403<screen>
404The following packages will be REMOVED:
405 xlib6-dev xpat2 tk40-dev xkeycaps xbattle xonix
406 xdaliclock tk40 tk41 xforms0.86 ghostview xloadimage xcolorsel
407 xadmin xboard perl-debug tkined xtetris libreadline2-dev perl-suid
408 nas xpilot xfig
409</screen>
410<para>
411The Packages to Remove list shows all of the packages that will be removed
412from the system. It can be shown for any of the operations and should be given
413a careful inspection to ensure nothing important is to be taken off. The
414<literal>-f</literal> option is especially good at generating packages to
415remove so extreme care should be used in that case. The list may contain
416packages that are going to be removed because they are only partially
417installed, possibly due to an aborted installation.
418</para>
419</section>
420
421<section id="s4.2.3"><title>The New Packages list</title>
422<screen>
423The following NEW packages will installed:
424 zlib1g xlib6g perl-base libgdbmg1 quake-lib gmp2 pgp-i python-base
425</screen>
426<para>
427The New Packages list is simply a reminder of what will happen. The packages
428listed are not presently installed in the system but will be when APT is done.
429</para>
430</section>
431
432<section id="s4.2.4"><title>The Kept Back list</title>
433<screen>
434The following packages have been kept back
435 compface man-db tetex-base msql libpaper svgalib1
436 gs snmp arena lynx xpat2 groff xscreensaver
437</screen>
438<para>
439Whenever the whole system is being upgraded there is the possibility that new
440versions of packages cannot be installed because they require new things or
441conflict with already installed things. In this case the package will appear
442in the Kept Back list. The best way to convince packages listed there to
443install is with <literal>apt-get install</literal> or by using
444<command>dselect</command> to resolve their problems.
445</para>
446</section>
447
448<section id="s4.2.5"><title>Held Packages warning</title>
449<screen>
450The following held packages will be changed:
451 cvs
452</screen>
453<para>
454Sometimes you can ask APT to install a package that is on hold, in such a case
455it prints out a warning that the held package is going to be changed. This
456should only happen during dist-upgrade or install.
457</para>
458</section>
459
460<section id="s4.2.6"><title>Final summary</title>
461<para>
462Finally, APT will print out a summary of all the changes that will occur.
463</para>
464<screen>
465206 packages upgraded, 8 newly installed, 23 to remove and 51 not upgraded.
46612 packages not fully installed or removed.
467Need to get 65.7M/66.7M of archives. After unpacking 26.5M will be used.
468</screen>
469<para>
470The first line of the summary simply is a reduced version of all of the lists
471and includes the number of upgrades - that is packages already installed that
472have new versions available. The second line indicates the number of poorly
473configured packages, possibly the result of an aborted installation. The final
474line shows the space requirements that the installation needs. The first pair
475of numbers refer to the size of the archive files. The first number indicates
476the number of bytes that must be fetched from remote locations and the second
477indicates the total size of all the archives required. The next number
478indicates the size difference between the presently installed packages and the
479newly installed packages. It is roughly equivalent to the space required in
480/usr after everything is done. If a large number of packages are being removed
481then the value may indicate the amount of space that will be freed.
482</para>
483<para>
484Some other reports can be generated by using the -u option to show packages to
485upgrade, they are similar to the previous examples.
486</para>
487</section>
488
489</section>
490
491<section id="s4.3"><title>The Status Display</title>
492<para>
493During the download of archives and package files APT prints out a series of
494status messages.
495</para>
496<screen>
497# apt-get update
498Get:1 http://ftp.de.debian.org/debian-non-US/ stable/non-US/ Packages
499Get:2 http://llug.sep.bnl.gov/debian/ testing/contrib Packages
500Hit http://llug.sep.bnl.gov/debian/ testing/main Packages
501Get:4 http://ftp.de.debian.org/debian-non-US/ unstable/binary-i386/ Packages
502Get:5 http://llug.sep.bnl.gov/debian/ testing/non-free Packages
50311% [5 testing/non-free `Waiting for file' 0/32.1k 0%] 2203b/s 1m52s
504</screen>
505<para>
506The lines starting with <emphasis>Get</emphasis> are printed out when APT
507begins to fetch a file while the last line indicates the progress of the
508download. The first percent value on the progress line indicates the total
509percent done of all files. Unfortunately since the size of the Package files
510is unknown <literal>apt-get update</literal> estimates the percent done which
511causes some inaccuracies.
512</para>
513<para>
514The next section of the status line is repeated once for each download
515thread and indicates the operation being performed and some useful
516information about what is happening. Sometimes this section will simply
517read <emphasis>Forking</emphasis> which means the OS is loading the download
518module. The first word after the [ is the fetch number as shown on the
519history lines. The next word is the short form name of the object being
520downloaded. For archives it will contain the name of the package that is
521being fetched.
522</para>
523<para>
524Inside of the single quote is an informative string indicating the progress of
525the negotiation phase of the download. Typically it progresses from
526<emphasis>Connecting</emphasis> to <emphasis>Waiting for file</emphasis> to
527<emphasis>Downloading</emphasis> or <emphasis>Resuming</emphasis>. The final
528value is the number of bytes downloaded from the remote site. Once the
529download begins this is represented as <literal>102/10.2k</literal> indicating
530that 102 bytes have been fetched and 10.2 kilobytes is expected. The total
531size is always shown in 4 figure notation to preserve space. After the size
532display is a percent meter for the file itself. The second last element is the
533instantaneous average speed. This values is updated every 5 seconds and
534reflects the rate of data transfer for that period. Finally is shown the
535estimated transfer time. This is updated regularly and reflects the time to
536complete everything at the shown transfer rate.
537</para>
538<para>
539The status display updates every half second to provide a constant feedback on
540the download progress while the Get lines scroll back whenever a new file is
541started. Since the status display is constantly updated it is unsuitable for
542logging to a file, use the <literal>-q</literal> option to remove the status
543display.
544</para>
545</section>
546
547<section id="s4.4"><title>Dpkg</title>
548<para>
549APT uses <command>dpkg</command> for installing the archives and will
550switch over to the <command>dpkg</command> interface once downloading is
551completed. <command>dpkg</command> will also ask a number of questions as
552it processes the packages and the packages themselves may also ask several
553questions. Before each question there is usually a description of what it
554is asking and the questions are too varied to discuss completely here.
555</para>
556</section>
557
558</chapter>
559
560</book>