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