/[ddp]/manuals/trunk/quick-reference/asciidoc/02_package.txt
ViewVC logotype

Contents of /manuals/trunk/quick-reference/asciidoc/02_package.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6910 - (show annotations) (download)
Sun Aug 30 16:50:39 2009 UTC (3 years, 8 months ago) by osamu
File MIME type: text/plain
File size: 114817 byte(s)
URL reviewed and HOWTO
1 == Debian package management
2
3 // vim: set sts=2 expandtab:
4 // Use ":set nowrap" to edit table
5
6 NOTE: This chapter is written assuming the latest stable release is codename: `@-@codename-stable@-@`.
7
8 http://www.debian.org[Debian] is a volunteer organization which builds **consistent** distributions of pre-compiled binary packages of free software and distributes them from its archive.
9
10 http://ftp.us.debian.org/debian/[The Debian archive] is offered by http://www.debian.org/mirror/[many remote mirror sites] for access through HTTP and FTP methods. It is also available as http://www.debian.org/CD/[CD-ROM/DVD].
11
12 The Debian package management system, **when used properly**, offers the user to install **consistent sets of binary packages** to the system from the archive. Currently, there are @-@all-packages@-@ packages available for the @-@arch@-@ architecture.
13
14 The Debian package management system has a rich history and many choices for the front end user program and back end archive access method to be used. Currently, we recommend `aptitude`(8) as the main front end program for the Debian package management activity.
15
16 .List of Debian package management tools
17 [grid="all"]
18 `---------------------`-------------`------------`----------------------------------------------------------------------------------------
19 package popcon size description
20 ------------------------------------------------------------------------------------------------------------------------------------------
21 `aptitude` @-@popcon1@-@ @-@psize1@-@ terminal-based package manager (current standard, front-end for `apt`)
22 `apt` @-@popcon1@-@ @-@psize1@-@ Advanced Packaging Tool (APT), front-end for `dpkg` providing "`http`", "`ftp`", and "`file`" archive access methods (`apt-get`/`apt-cache` commands included)
23 `tasksel` @-@popcon1@-@ @-@psize1@-@ tool for selecting tasks for installation on Debian system (front-end for APT)
24 `unattended-upgrades` @-@popcon1@-@ @-@psize1@-@ enhancement package for APT to enable automatic installation of security upgrades
25 `dselect` @-@popcon1@-@ @-@psize1@-@ terminal-based package manager (previous standard, front-end for APT and other old access methods)
26 `dpkg` @-@popcon1@-@ @-@psize1@-@ package management system for Debian
27 `dpkg-ftp` @-@popcon1@-@ @-@psize1@-@ older ftp method for `dselect`
28 `synaptic` @-@popcon1@-@ @-@psize1@-@ graphical package manager (GNOME front-end for APT)
29 `kpackage` @-@popcon1@-@ @-@psize1@-@ graphical package manager (KDE front-end for APT)
30 `apt-utils` @-@popcon1@-@ @-@psize1@-@ APT utility programs: `apt-extracttemplates`(1), `apt-ftparchive`(1), and `apt-sortpkgs`(1)
31 `apt-listchanges` @-@popcon1@-@ @-@psize1@-@ package change history notification tool
32 `apt-listbugs` @-@popcon1@-@ @-@psize1@-@ lists critical bugs before each APT installation
33 `apt-file` @-@popcon1@-@ @-@psize1@-@ APT package searching utility -- command-line interface
34 `apt-rdepends` @-@popcon1@-@ @-@psize1@-@ recursively lists package dependencies
35 ------------------------------------------------------------------------------------------------------------------------------------------
36
37 // Removed
38 // || {{{adept-manager}}} || || - || graphical package manager (KDE front-end for APT) ||
39
40 NOTE: The annoying http://bugs.debian.org/411123[bug #411123] for the mixed use of `aptitude`(8) and `apt-get`(8) commands has been resolved. If this kept you from using `aptitude`, please reconsider.
41
42 === Debian package management prerequisites
43
44 ==== Package configuration
45
46 Here are some key points for package configuration on the Debian system.
47
48 - The manual configuration by the system administrator is respected. In other words, the package configuration system makes no intrusive configuration for the sake of convenience.
49 - Each package comes with its own configuration script with standardized user interface called `debconf`(7) to help initial installation process of the package.
50 - Debian Developers try their best to make your upgrade experience flawless with package configuration scripts.
51 - Full functionalities of packaged software are available to the system administrator. But ones with security risks are disabled in the default installation.
52 - If you manually activate a service with some security risks, you are responsible for the risk containment.
53 - Esoteric configuration may be manually enabled by the system administrator. This may creates interference with popular generic helper programs for the system configuration.
54
55 // Some warning for configuration script and their limitation under customized environment.
56 // /!\ There are some system configuration programs packaged. They require invocation by the system administrator. The system administrator should be aware of the possibility of interferences once administrator made his own customization to the package.
57
58 ==== Basic precautions
59
60 WARNING: Do not install packages from random mixture of suites. It probably breaks the package consistency which requires deep system management knowledge, such as compiler http://en.wikipedia.org/wiki/Application_binary_interface[ABI], http://en.wikipedia.org/wiki/Library_(computing)[library] version, interpreter features, etc.
61
62 The http://en.wikipedia.org/wiki/Newbie[newbie] Debian system administrator should stay with the **`stable`** release of Debian while applying only security updates. I mean that some of the following valid actions are better avoided, as a precaution, until you understand the Debian system very well. Here are some reminders.
63
64 - Do not include **`testing`** or **`unstable`** in "`/etc/apt/sources.list`".
65 - Do not mix standard Debian with other non-Debian archives such as Ubuntu in "`/etc/apt/sources.list`".
66 - Do not create "`/etc/apt/preferences`".
67 - Do not change default behavior of package management tools through configuration files without knowing their full impacts.
68 - Do not install random packages by "`dpkg -i <random_package>`".
69 - Do not ever install random packages by "`dpkg --force-all -i <random_package>`".
70 - Do not erase or alter files in "`/var/lib/dpkg/`".
71 - Do not overwrite system files by installing software programs directly compiled from source.
72 * Install them into "`/usr/local`" or "`/opt`", if needed.
73
74 The non-compatible effects caused by above actions to the Debian package management system may leave your system unusable.
75
76 The serious Debian system administrator who runs mission critical servers, should use extra precautions.
77
78 - Do not install any packages including security updates from Debian without thoroughly testing them with your particular configuration under safe conditions.
79 * You as the system administrator are responsible for your system in the end.
80 * The long stability history of Debian system is no guarantee by itself.
81
82 ==== Life with eternal upgrades
83
84 Despite my warnings above, I know many readers of this document wish to run the `testing` or `unstable` suites of Debian as their main system for **self-administered Desktop environments**. This is because they work very well, are updated frequently, and offer the latest features.
85
86 CAUTION: For your **production server**, the `stable` suite with the security updates is recommended. The same can be said for desktop PCs on which you can spend limited administration efforts, e.g. for your mother@@@sq@@@s PC.
87
88 It takes no more than simply setting the distribution string in the "`/etc/apt/sources.list`" to the suite name: "`testing`" or "`unstable`"; or the codename: "`@-@codename-testing@-@`" or "`@-@codename-unstable@-@`". This makes you live **the life of eternal upgrades**.
89
90 The use of `testing` or `unstable` is **a lot of fun** but comes with some risks. Even though the `unstable` suite of Debian system looks very stable for most of the times, there have been some package problems on the `testing` and `unstable` suite of Debian system and a few of them were not so trivial to resolve. It may be **quite painful** for you. Sometimes, you may have a broken package or missing functionality for a few weeks.
91
92 Here are some ideas to ensure quick and easy recovery from bugs in Debian packages.
93
94 - Make the system **dual bootable** by installing the `stable` suite of Debian system to another partition
95 - Make the installation CD handy for the **rescue boot**
96 - Consider installing `apt-listbugs` to check the http://www.debian.org/Bugs/[Debian Bug Tracking System (BTS)] information before the upgrade
97 - Learn the package system infrastructure enough to work around the problem
98 - Create a chroot or similar environment and run the latest system in it in advance (optional)
99
100 (If you can not do any one of these precautionary actions, you are probably not ready for the `testing` and `unstable` suites.)
101
102 http://en.wikipedia.org/wiki/Bodhi[Enlightenment] with the following saves a person from the eternal http://en.wikipedia.org/wiki/Karma[karmic] struggle of upgrade http://en.wikipedia.org/wiki/Naraka[hell] and let him reach Debian http://en.wikipedia.org/wiki/Nirvana[nirvana].
103
104 ==== Debian archive basics
105
106 Let@@@sq@@@s look into http://ftp.us.debian.org/debian/[the Debian archive] from a system user@@@sq@@@s perspective.
107
108 TIP: Official policy of the Debian archive is defined at http://www.debian.org/doc/debian-policy/ch-archive[Debian Policy Manual, Chapter 2 - The Debian Archive].
109
110 For the typical HTTP access, the archive is specified in the "`/etc/apt/sources.list`" file as the following, e.g. for the current `stable` = `@-@codename-stable@-@` system.
111
112 --------------------
113 deb http://ftp.XX.debian.org/debian/ @-@codename-stable@-@ main contrib non-free
114 deb-src http://ftp.XX.debian.org/debian/ @-@codename-stable@-@ main contrib non-free
115
116 deb http://security.debian.org/ @-@codename-stable@-@/updates main contrib
117 deb-src http://security.debian.org/ @-@codename-stable@-@/updates main contrib
118 --------------------
119
120 Please note "`ftp.XX.debian.org`" must be replaced with appropriate mirror site URL for your location, for USA "`ftp.us.debian.org`", which can be found in http://www.debian.org/mirror/list[the list of Debian worldwide mirror sites]. The status of these servers can be checked at http://www.de.debian.org/dmc/[Debian Mirror Checker site].
121
122 Here, I tend to use codename "`@-@codename-stable@-@`" instead of suite name "`stable`" to avoid surprises when the next `stable` is released.
123
124 The meaning of "`/etc/apt/sources.list`" is described in `sources.list`(5) and key points are followings.
125
126 - The "`deb`" line defines for the binary packages.
127 - The "`deb-src`" line defines for the source packages.
128 - The 1st argument is the root URL of the Debian archive.
129 - The 2nd argument is the distribution name: either the suite name or the codename.
130 - The 3rd and following arguments are the list of valid archive component names of the Debian archive.
131
132 The "`deb-src`" lines can safely be omitted (or commented out by placing "#" at the start of the line) if it is just for `aptitude` which does not access source related meta data. It speeds up the updates of the archive meta data. The URL can be "`http://`", "`ftp://`", "`file://`", ....
133
134 TIP: If "`sid`" is used in the above example instead of "`@-@codename-stable@-@`", the "`deb: http://security.debian.org/ ...`" line for security updates in the "`/etc/apt/sources.list`" is not required. Security updates are only available for `stable` and `testing` (i.e., `@-@codename-stable@-@` and `@-@codename-testing@-@`).
135
136 Here is the list of URL of the Debian archive sites and suite name or codename used in the configuration file.
137
138 .List of Debian archive sites
139 [grid="all"]
140 `----------------------------------------------------------------------------------------`--------------------------------------`------------------
141 archive URL suite name (codename) purpose
142 ---------------------------------------------------------------------------------------------------------------------------------------------------
143 http://ftp.us.debian.org/debian/[http://ftp.XX.debian.org/debian/] `stable` (`@-@codename-stable@-@`) stable (@-@codename-stable@-@) release
144 http://ftp.us.debian.org/debian/[http://ftp.XX.debian.org/debian/] `testing` (`@-@codename-testing@-@`) testing (@-@codename-testing@-@) release
145 http://ftp.us.debian.org/debian/[http://ftp.XX.debian.org/debian/] `unstable` (`@-@codename-unstable@-@`) unstable (@-@codename-unstable@-@) release
146 http://ftp.us.debian.org/debian/[http://ftp.XX.debian.org/debian/] `experimental` experimental pre-release (optional, only for developer)
147 http://ftp.us.debian.org/debian/[http://ftp.XX.debian.org/debian/] `stable-proposed-updates` Updates for the next stable point release (optional)
148 http://security.debian.org/[http://security.debian.org/] `stable/updates` security updates for stable release (important)
149 http://security.debian.org/[http://security.debian.org/] `testing/updates` security updates for testing release (important)
150 http://volatile.debian.org/debian-volatile/[http://volatile.debian.org/debian-volatile/] `volatile` compatible updates for spam filter, IM clients, etc.
151 http://volatile.debian.org/debian-volatile/[http://volatile.debian.org/debian-volatile/] `volatile-sloppy` non-compatible updates for spam filter, IM clients, etc.
152 http://backports.org/debian/[http://backports.org/debian/] `@-@codename-stable@-@-backports` newer backported packages for @-@codename-stable@-@ (non-official, optional)
153 ---------------------------------------------------------------------------------------------------------------------------------------------------
154
155 CAUTION: Only pure **`stable`** release with security updates provides the best stability. Running mostly **`stable`** release mixed with some packages from **`testing`** or **`unstable`** release is riskier than running pure **`unstable`** release. If you really need the latest version of some programs under **`stable`** release, please use packages from http://www.debian.org/volatile/[the debian-volatile project] and http://backports.org[backports.org] (see <<_volatile_and_backports_org>>) services. These services must be used with extra care.
156
157 CAUTION: You should basically list only one of `stable`, `testing`, or `unstable` suites in the "`deb`" line. If you list any combination of `stable`, `testing`, and `unstable` suites in the "`deb`" line, APT programs slow down while only the latest archive is effective. Multiple listing makes sense for these when the "`/etc/apt/preferences`" file is used with clear objectives (see <<_tweaking_candidate_version>>).
158
159 NOTE: For the Debian system with the `stable` and `testing` suites, it is a good idea to include lines with "`http://security.debian.org/`" in the "`/etc/apt/sources.list`" to enable security updates as in the example above.
160
161 // Here, I changed from section to "component" following the Release file notation.
162
163 Each Debian archive consists of 3 components. Components are alternatively called http://www.debian.org/doc/debian-policy/ch-archive#s-sections[categories in "Debian Policy"] or areas in http://www.debian.org/social_contract["Debian Social Contract"]. The component is grouped by the compliance to http://www.debian.org/social_contract#guidelines["The Debian Free Software Guidelines" (DFSG)].
164
165 .List of Debian archive components
166 [grid="all"]
167 `----------`-----------------------`-------------------------------------------------
168 component number of packages criteria of package
169 -------------------------------------------------------------------------------------
170 `main` @-@main-packages@-@ DSFG compliant and no dependency to `non-free`
171 `contrib` @-@contrib-packages@-@ DSFG compliant but having dependency to `non-free`
172 `non-free` @-@non-free-packages@-@ not DSFG compliant
173 -------------------------------------------------------------------------------------
174
175 Here the number of packages in the above is for the @-@arch@-@ architecture. Strictly speaking, only the `main` component archive shall be considered as the Debian system.
176
177 The Debian archive organization can be studied best by pointing your browser to the each archive URL appended with `dists` or `pool`.
178
179 // the next section seems very complicated ... I know but this is life. I keep then indirect reference for easier XML update with new release. Please see generated HTML how they are translated.
180
181 The distribution is referred by two ways, the suite or http://www.debian.org/doc/manuals/developers-reference/resources.html#codenames[codename]. The word distribution is alternatively used as the synonym to the suite in many documentations. The relationship between the suite and the codename can be summarized as the following.
182
183 .The relationship between suite and codename
184 [grid="all"]
185 `------------------------------------------`-----------------------------------`---------------------------------------`------------------
186 Timing suite = `stable` suite = `testing` suite = `unstable`
187 ------------------------------------------------------------------------------------------------------------------------------------------
188 after the `@-@codename-stable@-@` release codename = `@-@codename-stable@-@` codename = `@-@codename-testing@-@` codename = `sid`
189 after the `@-@codename-testing@-@` release codename = `@-@codename-testing@-@` codename = `@-@codename-nexttesting@-@` codename = `sid`
190 ------------------------------------------------------------------------------------------------------------------------------------------
191
192 // Intentinally changed for lenny release
193 // || current (as of @-@build-date@-@) || codename = {{{@-@codename-stable@-@}}} || codename = {{{@-@codename-testing@-@}}} || codename = {{{sid}}} ||
194
195 The history of codenames are described in http://www.debian.org/doc/manuals/debian-faq/ch-ftparchives#s-oldcodenames[Debian FAQ: 6.3.1 Which other codenames have been used in the past?]
196
197 In the stricter Debian archive terminology, the word "section" is specifically used for the categorization of packages by the application area. (Although, the word "main section" may sometimes be used to describe the Debian archive section which provides the main component.)
198
199 Every time a new upload is done by the Debian developer (DD) to the `unstable` archive (via http://incoming.debian.org/[incoming] processing), DD is required to ensure uploaded packages to be compatible with the latest set of packages in the latest `unstable` archive.
200
201 If DD breaks this compatibility intentionally for important library upgrade etc, there is usually announcement to http://lists.debian.org/debian-devel/[the debian-devel mailing list] etc.
202
203 Before a set of packages are moved by the Debian archive maintenance script from the `unstable` archive to the `testing` archive, the archive maintenance script not only checks the maturity (about 10 days old) and the status of the RC bug reports for the packages but also tries to ensure them to be compatible with the latest set of packages in the `testing` archive. This process makes the `testing` archive very current and usable.
204
205 Through the gradual archive freeze process led by the release team, the `testing` archive is matured to make it completely consistent and bug free with some manual interventions. Then the new `stable` release is created by assigning the codename for the old `testing` archive to the new `stable` archive and creating the new codename for the new `testing` archive. The initial contents of the new `testing` archive is exactly the same as that of the newly released `stable` archive.
206
207 Both the `unstable` and the `testing` archives may suffer temporary glitches due to several factors.
208
209 - Broken package upload to the archive (mostly for `unstable`)
210 - Delay of accepting the new packages to the archive (mostly for `unstable`)
211 - Archive synchronization timing issue (both for `testing` and `unstable`)
212 - Manual intervention to the archive such as package removal (more for `testing`) etc.
213
214 So if you ever decide to use these archives, you should be able to fix or work around these kinds of glitches.
215
216 CAUTION: For about few months after a new `stable` release, most desktop users should use the `stable` archive with its security updates even if they usually use `unstable` or `testing` archives. For this transition period, both `unstable` and `testing` archives are not good for most people. Your system is difficult to keep in good working condition with the `unstable` archive since it suffers surges of major upgrades for core packages. The `testing` archive is not useful either since it contains mostly the same content as the `stable` archive without its security support (http://lists.debian.org/debian-testing-security-announce/2008/12/msg00019.html[Debian testing-security-announce 2008-12]). After a month or so, the `unstable` archive may be usable if you are careful.
217
218 TIP: When tracking the `testing` archive, problem caused by a removed package is usually worked around by installing corresponding package from the `unstable` archive which is uploaded for bug fix.
219
220 // Testing usability discussion may be too complicated here.
221 // {i} See discussion on [http://lists.debian.org/debian-devel/ debian-devel mailing list]
222 // [http://lists.debian.org/debian-devel/2008/06/msg00048.html how manual intervention are managed].
223
224 See http://www.debian.org/doc/debian-policy/[Debian Policy Manual] for archive definitions.
225
226 - "http://www.debian.org/doc/debian-policy/ch-archive#s-subsections[Sections]"
227 - "http://www.debian.org/doc/debian-policy/ch-archive#s-priorities[Priorities]"
228 - "http://www.debian.org/doc/debian-policy/ch-binary#s3.7[Base system]"
229 - "http://www.debian.org/doc/debian-policy/ch-binary#s3.8[Essential packages]"
230
231 ==== Package dependencies
232
233 The Debian system offers a consistent set of binary packages through its versioned binary dependency declaration mechanism in the control file fields. Here is a bit over simplified definition for them.
234
235 - "Depends"
236 * This declares an absolute dependency and all of the packages listed in this field must be installed at the same time or in advance.
237 - "Pre-Depends"
238 * This is like Depends, except that it requires completed installation of the listed packages in advance.
239 - "Recommends"
240 * This declares a strong, but not absolute, dependency. Most users would not want the package unless all of the packages listed in this field are installed.
241 - "Suggests"
242 * This declares a weak dependency. Many users of this package may benefit from installing packages listed in this field but can have reasonable functions without them.
243 - "Enhances"
244 * This declares a week dependency like Suggests but works in the opposite direction.
245 - "Conflicts"
246 * This declares an absolute incompatibility. All of the packages listed in this field must be removed to install this package.
247 - "Replaces"
248 * This is declared when files installed by this package replace files in the listed packages.
249 - "Provides"
250 * This is declared when this package provide all of the files and functionality in the listed packages.
251
252 NOTE: Please note that defining, "Provides", "Conflicts" and "Replaces" simultaneously to an virtual package is the sane configuration. This ensures that only one real package providing this virtual package can be installed at any one time.
253
254 The official definition including source dependency can be found in http://www.debian.org/doc/debian-policy/ch-relationships[the Policy Manual: Chapter 7 - Declaring relationships between packages].
255
256 ==== The event flow of the package management
257
258 Here is a summary of the simplified event flow of the package management by APT.
259
260 - **Update** ("`aptitude update`" or "`apt-get update`"):
261 1. Fetch archive metadata from remote archive
262 2. Reconstruct and update local metadata for use by APT
263
264 - **Upgrade** ("`aptitude safe-upgrade`" and "`aptitude full-upgrade`", or "`apt-get upgrade`" and "`apt-get dist-upgrade`"):
265 1. Chose candidate version which is usually the latest available version for all installed packages (see <<_tweaking_candidate_version>> for exception)
266 2. Make package dependency resolution
267 3. Fetch selected binary packages from remote archive if candidate version is different from installed version
268 4. Unpack fetched binary packages
269 5. Run **preinst** script
270 6. Install binary files
271 7. Run **postinst** script
272
273 - **Install** ("`aptitude install ...`" or "`apt-get install ...`"):
274 1. Chose packages listed on the command line
275 2. Make package dependency resolution
276 3. Fetch selected binary packages from remote archive
277 4. Unpack fetched binary packages
278 5. Run **preinst** script
279 6. Install binary files
280 7. Run **postinst** script
281
282 - **Remove** ("`aptitude remove ...`" or "`apt-get remove ...`"):
283 1. Chose packages listed on the command line
284 2. Make package dependency resolution
285 3. Run **prerm** script
286 4. Remove installed files **except** configuration files
287 5. Run **postrm** script
288
289 - **Purge** ("`aptitude purge ...`" or "`apt-get purge ...`"):
290 1. Chose packages listed on the command line
291 2. Make package dependency resolution
292 3. Run **prerm** script
293 4. Remove installed files **including** configuration files
294 5. Run **postrm** script
295
296 Here, I intentionally skipped technical details for the sake of big picture.
297
298 ==== First response to package management troubles
299
300 You should read the fine official documentation. The first document to read is the Debian specific "`/usr/share/doc/<package_name>/README.Debian`". Other documentation in "`/usr/share/doc/<package_name>/`" should be consulted too. If you set shell as <<_customizing_bash>>, type the following.
301
302 --------------------
303 $ cd <package_name>
304 $ pager README.Debian
305 $ mc
306 --------------------
307
308 You may need to install the corresponding documentation package named with "`-doc`" suffix for detailed information.
309
310 If you are experiencing problems with a specific package, make sure to check out http://bugs.debian.org/[the Debian bug tracking system (BTS)] sites, first.
311
312 .List of key web site to resolving problems with a specific package
313 [grid="all"]
314 `--------------------------------------------------------------------------`----------------------------------------------------------
315 web site command
316 --------------------------------------------------------------------------------------------------------------------------------------
317 Home page of http://bugs.debian.org/[the Debian bug tracking system (BTS)] `sensible-browser "http://bugs.debian.org/"`
318 The bug report of a known package name `sensible-browser "http://bugs.debian.org/<package_name>"`
319 The bug report of known bug number `sensible-browser "http://bugs.debian.org/<bug_number>"`
320 --------------------------------------------------------------------------------------------------------------------------------------
321
322 Search http://www.google.com[Google] with search words including "`site:debian.org`", "`site:wiki.debian.org`", "`site:lists.debian.org`", etc.
323
324 When you file a bug report, please use `reportbug`(1) command.
325
326 === Basic package management operations
327
328 Aptitude is the current preferred package management tool for the Debian system. It can be used as the commandline alternative to `apt-get` / `apt-cache` and also as the full screen interactive package management tool.
329
330 For the package management operation which involves package installation or updates package metadata, you need to have root privilege.
331
332 ==== Basic package management operations with commandline
333
334 Here are basic package management operations with commandline using `aptitude`(8) and `apt-get`(8) /`apt-cache`(8).
335
336 .Basic package management operations with commandline using `aptitude`(8) and `apt-get`(8) /`apt-cache`(8)
337 [grid="all"]
338 `--------------------------`--------------------------------`-----------------------------------------------------------------------------
339 `aptitude` syntax `apt-get`/`apt-cache` syntax description
340 ------------------------------------------------------------------------------------------------------------------------------------------
341 `aptitude update` `apt-get update` update package archive metadata
342 `aptitude install foo` `apt-get install foo` install candidate version of "`foo`" package with its dependencies
343 `aptitude safe-upgrade` `apt-get upgrade` install candidate version of installed packages without removing any other packages
344 `aptitude full-upgrade` `apt-get dist-upgrade <package>` install candidate version of installed packages while removing other packages if needed
345 `aptitude remove foo` `apt-get remove foo` remove "`foo`" package while leaving its configuration files
346 N/A `apt-get autoremove` remove auto-installed packages which is no longer required
347 `aptitude purge foo` `apt-get purge foo` purge "`foo`" package with its configuration files
348 `aptitude clean` `apt-get clean` clear out the local repository of retrieved package files completely
349 `aptitude autoclean` `apt-get autoclean` clear out the local repository of retrieved package files for outdated packages
350 `aptitude show foo` `apt-cache show <package>` display detailed information about "`foo`" package
351 `aptitude search <regex>` `apt-cache search <regex>` search packages which match <regex>
352 `aptitude why <regex>` N/A explain the reason why <regex> matching packages should be installed
353 `aptitude why-not <regex>` N/A explain the reason why <regex> matching packages can not be installed
354 ------------------------------------------------------------------------------------------------------------------------------------------
355
356 // You may lose the advantage of `aptitude` keeping track of which packages you have deliberately installed if other package tools are used.
357
358 Although it is now safe to mix different package tools on the Debian system, it is best to continue using `aptitude` as much as possible.
359
360 The difference between "`safe-upgrade`"/"`upgrade`" and "`full-upgrade`"/"`dist-upgrade`" only appears when new versions of packages stand in different dependency relationships from old versions of those packages. The "`aptitude safe-upgrade`" command does not install new packages nor remove installed packages.
361
362 The "`aptitude why <regex>`" can list more information by "`aptitude -v why <regex>`". Similar information can be obtained by "`apt-cache rdepends <package>`".
363
364 When `aptitude` command is started in the commandline mode and faces some issues such as package conflicts, you can switch to the full screen interactive mode by pressing "`e`"-key later at the prompt.
365
366 You may provide command options right after "`aptitude`".
367
368 .Notable command options for `aptitude`(8)
369 [grid="all"]
370 `--------------`------------------------------------------------------------------------
371 command option description
372 ----------------------------------------------------------------------------------------
373 `-s` simulate the result of the command
374 `-d` download only but no install/upgrade
375 `-D` show brief explanations before the automatic installations and removals
376 ----------------------------------------------------------------------------------------
377
378 See `aptitude`(8) and "aptitude user@@@sq@@@s manual" at "`/usr/share/doc/aptitude/README`" for more.
379
380 TIP: The `dselect` package is still available and was the preferred full screen interactive package management tool in previous releases.
381
382 ==== Interactive use of aptitude
383
384 For the interactive package management, you start `aptitude` in interactive mode from the console shell prompt as follows.
385
386 --------------------
387 $ sudo aptitude -u
388 Password:
389 --------------------
390
391 This updates the local copy of the archive information and display the package list in the full screen with menu. Aptitude places its configuration at "`\~/.aptitude/config`".
392
393 TIP: If you want to use root@@@sq@@@s configuration instead of user@@@sq@@@s one, use "`sudo -H aptitude ...`" instead of "`sudo aptitude ...`" in the above expression.
394
395 TIP: `Aptitude` automatically sets **pending actions** as it is started interactively. If you do not like it, you can reset it from menu: "Action" -> "Cancel pending actions".
396
397 ==== Key bindings of aptitude
398
399 Notable key strokes to browse status of packages and to set "planned action" on them in this full screen mode are the following.
400
401 .List of key bindings for aptitude
402 [grid="all"]
403 `-------------------------------------`---------------------------------------------------------------
404 key key binding
405 -----------------------------------------------------------------------------------------------
406 `F10` or `Ctrl-t` menu
407 `?` display **help** for keystroke (more complete listing)
408 `F10` -> Help -> User@@@sq@@@s Manual display User@@@sq@@@s Manual
409 `u` update package archive information
410 `\+` mark the package for the **upgrade** or the **install**
411 `-` mark the package for the **remove** (keep configuration files)
412 `\_` mark the package for the **purge** (remove configuration files)
413 `=` place the package on **hold**
414 `U` mark all upgradable packages (function as **full-upgrade**)
415 `g` start **downloading** and **installing** selected packages
416 `q` quit current screen and save changes
417 `x` quit current screen and discard changes
418 `Enter` view information about a package
419 `C` view a package@@@sq@@@s changelog
420 `l` change the limit for the displayed packages
421 `/` search for the first match
422 `\` repeat the last search
423 ------------------------------------------------------------------------------------------------
424
425 The file name specification of the command line and the menu prompt after pressing "`l`" and "`//`" take the aptitude regex as described below. Aptitude regex can explicitly match a package name using a string started by "`\~n` and followed by the package name.
426
427 TIP: You need to press "`U`" to get all the installed packages upgraded to the **candidate version** in the visual interface. Otherwise only the selected packages and certain packages with versioned dependency to them are upgraded to the **candidate version**.
428
429 ==== Package views under aptitude
430
431 In the interactive full screen mode of `aptitude`(8), packages in the package list are displayed as the next example.
432
433 --------------------
434 idA libsmbclient -2220kB 3.0.25a-1 3.0.25a-2
435 --------------------
436
437 Here, this line means from the left as the following.
438
439 - The "current state" flag (the first letter)
440 - The "planned action" flag (the second letter)
441 - The "automatic" flag (the third letter)
442 - The Package name
443 - The change in disk space usage attributed to "planned action"
444 - The current version of the package
445 - The candidate version of the package
446
447 TIP: The full list of flags are given at the bottom of **Help** screen shown by pressing "`?`".
448
449 The **candidate version** is chosen according to the current local preferences (see `apt_preferences`(5) and <<_tweaking_candidate_version>>).
450
451 Several types of package views are available under the menu "`Views`".
452
453 .List of views for aptitude
454 [grid="all"]
455 `-----------------------`-------------`-----------------------------------------------------------------------------------------------
456 view status description of view
457 --------------------------------------------------------------------------------------------------------------------------------------
458 `Package View` Good see <<standard-package-views>> (default)
459 `Audit Recommendations` Good list packages which are recommended by some installed packages but not yet installed are listed
460 `Flat Package List` Good list packages without categorization (for use with regex)
461 `Debtags Browser` Very usable list packages categorized according to their http://debtags.alioth.debian.org/[debtags] entries
462 `Categorical Browser` Deprecated list packages categorized according to their category (use `Debtags Browser`, instead)
463 --------------------------------------------------------------------------------------------------------------------------------------
464
465 NOTE: Please help us http://debtags.alioth.debian.org/todo.html[improving tagging packages with debtags!]
466
467 The standard "`Package View`" categorizes packages somewhat like `dselect` with few extra features.
468
469 [[standard-package-views]]
470 .The categorization of standard package views
471 [grid="all"]
472 `---------------------------------------`--------------------------------------------------------------------------------
473 category description of view
474 -------------------------------------------------------------------------------------------------------------------------
475 `Upgradable Packages` list packages organized as `section` -> `component` -> `package`
476 `New Packages` , ,
477 `Installed Packages` , ,
478 `Not Installed Packages` , ,
479 `Obsolete and Locally Created Packages` , ,
480 `Virtual Packages` list packages with the same function
481 `Tasks` list packages with different functions generally needed for a task
482 -------------------------------------------------------------------------------------------------------------------------
483
484 TIP: `Tasks` view can be used to cherry pick packages for your task.
485
486 ==== Search method options with aptitude
487
488 Aptitude offers several options for you to search packages using its regex formula.
489
490 - Shell commandline:
491 * "`aptitude search \'<aptitude_regex>\'`" to list installation status, package name and short description of matching packages
492 * "`aptitude show \'<package_name>\'`" to list detailed description of the package
493 - Interactive full screen mode:
494 * "`l`" to limit package view to matching packages
495 * "`/`" for search to a matching package
496 * "`\`" for backward search to a matching package
497 * "`n`" for find-next
498 * "`N`" for find-next (backward)
499
500 TIP: The string for <package_name> is treated as the exact string match to the package name unless it is started explicitly with "`\~`" to be the regex formula.
501
502 ==== The aptitude regex formula
503
504 The aptitude regex formula is mutt-like extended **ERE** (see <<_regular_expressions>>) and the meanings of the `aptitude` specific special match rule extensions are as follows.
505
506 .List of the aptitude regex formula
507 [grid="all"]
508 `---------------------------------------------------------------------------------`-------------------------------------------------------
509 description of the extended match rule regex formula
510 ------------------------------------------------------------------------------------------------------------------------------------------
511 match on package name `\~n<regex_name>`
512 match on description `\~d<regex_description>`
513 match on task name `\~t<regex_task>`
514 match on debtag `\~G<regex_debtag>`
515 match on maintainer `\~m<regex_maintainer>`
516 match on package section `\~s<regex_section>`
517 match on package version `\~V<regex_version>`
518 match archive `\~A{sarge,etch,sid`}
519 match origin `\~O{debian,...`}
520 match priority `\~p{extra,important,optional,required,standard`}
521 match essential packages `\~E`
522 match virtual packages `\~v`
523 match new packages `\~N`
524 match with pending action `\~a{install,upgrade,downgrade,remove,purge,hold,keep`}
525 match installed packages `\~i`
526 match installed packages with **A**-mark (auto installed package) `\~M`
527 match installed packages without **A**-mark (administrator selected package) `\~i!\~M`
528 match installed and upgradable packages `\~U`
529 match removed but not purged packages `\~c`
530 match removed, purged or can-be-removed packages `\~g`
531 match packages with broken relation `\~b`
532 match packages with broken depends/predepends/conflict `\~B<type>`
533 match packages from which relation <type> is defined to <term> package `\~D[<type>:]<term>`
534 match packages from which **broken** relation <type> is defined to <term> package `\~DB[<type>:]<term>`
535 match packages to which the <term> package defines relation <type> `\~R[<type>:]<term>`
536 match packages to which the <term> package defines **broken** relation <type> `\~RB[<type>:]<term>`
537 match packages to which some other installed packages depend on `\~R\~i`
538 match packages to which no other installed packages depend on `!\~R\~i`
539 match packages to which some other installed packages depend or recommend on `\~R\~i|\~Rrecommends:\~i`
540 match <term> package with filtered version `\~S filter <term>`
541 match all packages (true) `\~T`
542 match no packages (false) `\~F`
543 ------------------------------------------------------------------------------------------------------------------------------------------
544
545 - The regex part is the same **ERE** as the one used in typical Unix-like text tools using "`\^`", "`.\*`", "`$`" etc. as in `egrep`(1), `awk`(1) and `perl`(1).
546 - The relation <type> is one of (depends, predepends, recommends, suggests, conflicts, replaces, provides).
547 - The default relation type is "depends".
548
549 TIP: When <regex_pattern> is a null string, place "`\~T`" immediately after the command.
550
551 Here are some short cuts.
552
553 - "`\~P<term>`" == "`\~Dprovides:<term>`"
554 - "`\~C<term>`" == "`\~Dconflicts:<term>`"
555 - "`...\~W term`" == "`(...|term)`"
556
557 Users familiar with `mutt` pick up quickly, as mutt was the inspiration for the expression syntax. See "SEARCHING, LIMITING, AND EXPRESSIONS" in the "User@@@sq@@@s Manual" "`/usr/share/doc/aptitude/README`".
558
559 NOTE: With the `lenny` version of `aptitude`(8), the new **long form** syntax such as "`?broken`" may be used for regex matching in place for its old **short form** equivalent "`\~b`". Now space character "` `" is considered as one of the regex terminating character in addition to tilde character "`\~`". See "User@@@sq@@@s Manual" for the new **long form** syntax.
560
561 ==== Dependency resolution of aptitude
562
563 The selection of a package in `aptitude` not only pulls in packages which are defined in its "`Depends:`" list but also defined in the "`Recommends:`" list if the menu "`F10` -> Options -> Dependency handling" is set accordingly. These auto installed packages are removed automatically if they are no longer needed under `aptitude`.
564
565 NOTE: Before the `lenny` release, `apt-get` and other standard APT tools did not offer the autoremove functionality.
566
567 ==== Package activity logs
568
569 You can check package activity history in the log files.
570
571 .The log files for package activities
572 [grid="all"]
573 `-----------------------`--------------------------------------------------------
574 file content
575 ---------------------------------------------------------------------------------
576 `/var/log/dpkg.log` Log of `dpkg` level activity for all package activities
577 `/var/log/apt/term.log` Log of generic APT activity
578 `/var/log/aptitude` Log of `aptitude` command activity
579 ---------------------------------------------------------------------------------
580
581 In reality, it is not so easy to get meaningful understanding quickly out from these logs. See <<_recording_changes_in_configuration_files>> for easier way.
582
583 ==== Aptitude advantages
584
585 Aptitude has advantages over other APT based packaging systems (apt-get, apt-cache, synaptic, ...).
586
587 - `aptitude` removes unused auto installed packages automatically using its own extra layer of package state file (`/var/lib/aptitude/pkgstates`). (For new "`lenny`", other APT does the same.)
588 - `aptitude` makes it easy to resolve package conflicts and to add recommended packages.
589 - `aptitude` makes it easy to keep track of obsolete software by listing under "Obsolete and Locally Created Packages".
590 - `aptitude` gives a log of its history in "`/var/log/aptitude`".
591 - `aptitude` offers access to all versions of the package if available.
592 - `aptitude` includes a fairly powerful regex based system for searching particular packages and limiting the package display.
593 - `aptitude` in the full screen mode has `su` functionality embedded and can be run from normal user until you really need administrative privileges.
594
595 For the old `etch` release version, `synaptic` also gives you the history log; `apt-get` did not but you can rely on the log of `dpkg`.
596
597 Anyway, `aptitude` is nice for interactive console use.
598
599 === Examples of aptitude operations
600
601 Here are few examples of `aptitude`(8) operations.
602
603 ==== Listing packages with regex matching on package names
604
605 The following command lists packages with regex matching on package names.
606
607 --------------------
608 $ aptitude search '~n(pam|nss).*ldap'
609 p libnss-ldap - NSS module for using LDAP as a naming service
610 p libpam-ldap - Pluggable Authentication Module allowing LDAP interfaces
611 --------------------
612
613 This is quite handy for you to find the exact name of a package.
614
615 ==== Browsing with the regex matching
616
617 The regex "`\~dipv6`" in the "New Flat Package List" view with "`l`" prompt, limits view to packages with the matching description and let you browse their information interactively.
618
619 ==== Purging removed packages for good
620
621 You can purge all remaining configuration files of removed packages.
622
623 Check results of the following command.
624
625 --------------------
626 # aptitude search '~c'
627 --------------------
628
629 If you think listed packages are OK to be purged, execute the following command.
630
631 --------------------
632 # aptitude purge '~c'
633 --------------------
634
635 You may want to do the similar in the interactive mode for fine grained control.
636
637 You provide the regex "`\~c`" in the "New Flat Package List" view with "`l`" prompt. This limits the package view only to regex matched packages, i.e., "removed but not purged". All these regex matched packages can be shown by pressing "`[`" at top level headings.
638
639 Then you press "`_`" at top level headings such as "Installed Packages". Only regex matched packages under the heading are marked to be purged by this. You can exclude some packages to be purged by pressing "`=`" interactively for each of them.
640
641 This technique is quite handy and works for many other command keys.
642
643 ==== Tidying auto/manual install status
644
645 Here is how I tidy auto/manual install status for packages (after using non-aptitude package installer etc.).
646
647 1. Start `aptitude` in interactive mode as root.
648 2. Type "`u`", "`U`", "`f`" and "`g`" to update and upgrade package list and packages.
649 3. Type "`l`" to enter the package display limit as "`\~i(\~R\~i|\~Rrecommends:\~i)`" and type "`M`" over "`Installed Packages`" as auto installed.
650 4. Type "`l`" to enter the package display limit as "`\~prequired|\~pimportant|\~pstandard|\~E`" and type "`m`" over "`Installed Packages`" as manual installed.
651 5. Type "`l`" to enter the package display limit as "`\~i!\~M`" and remove unused package by typing "`-`" over each of them after exposing them by typing "`[`" over "`Installed Packages`".
652 6. Type "`l`" to enter the package display limit as "`\~i`" and type "`m`" over "`Tasks`" as manual installed.
653 7. Exit `aptitude`.
654 8. Start "`apt-get -s autoremove|less`" as root to check what are not used.
655 9. Restart `aptitude` in interactive mode and mark needed packages as "`m`".
656 10. Restart "`apt-get -s autoremove|less`" as root to recheck REMOVED contain only expected packages.
657 11. Start "`apt-get autoremove|less`" as root to autoremove unused packages.
658
659 The "`m`" action over "`Tasks`" is an optional one to prevent mass package removal situation in future.
660
661 ==== System wide upgrade with aptitude
662
663 NOTE: When moving to a new release etc, you should consider to perform a clean installation of new system even though Debian is upgradable as described below. This provides you a chance to remove garbages collected and exposes you to the best combination of latest packages. Of course, you should make a full backup of system to a safe place (see <<_backup_and_recovery>>) before doing this. I recommend to make a dual boot configuration using different partition to have the smoothest transition.
664
665 You can perform system wide upgrade to a newer release by changing contents of the "`/etc/apt/sources.list`" file pointing to a new release and running the "`aptitude update; aptitude full-upgrade`" command.
666
667 To upgrade from `stable` to `testing` or `unstable`, you replace "`@-@codename-stable@-@`" in the "`/etc/apt/sources.list`" example of <<_debian_archive_basics>> with "`@-@codename-testing@-@`" or "`sid`".
668
669 In reality, you may face some complications due to some package transition issues, mostly due to package dependencies. The larger the difference of the upgrade, the more likely you face larger troubles. For the transition from the old `stable` to the new `stable` after its release, you can read its new http://www.debian.org/releases/stable/releasenotes[Release Notes] and follow the exact procedure described in it to minimize troubles.
670
671 When you decide to move from `stable` to `testing` before its formal release, there are no http://www.debian.org/releases/stable/releasenotes[Release Notes] to help you. The difference between `stable` and `testing` could have grown quite large after the previous `stable` release and makes upgrade situation complicated.
672
673 You should make precautionary moves for the full upgrade while gathering latest information from mailing list and using common senses.
674
675 1. Read previous "Release Notes".
676 2. Backup entire system (especially data and configuration information).
677 3. Have bootable media handy for broken bootloader.
678 4. Inform users on the system well in advance.
679 5. Record upgrade activity with `script`(1).
680 6. Apply "unmarkauto" to required packages, e.g., "`aptitude unmarkauto vim`", to prevent removal.
681 7. Minimize installed packages to reduce chance of package conflicts, e.g., remove desktop task packages.
682 8. Remove the "`/etc/apt/preferences`" file (disable apt-pinning).
683 9. Try to upgrade step wise: `oldstable` -> `stable` -> `testing` -> `unstable`.
684 10. Update the "`/etc/apt/sources.list`" file to point to new archive only and run "`aptitude update`".
685 11. Install, optionally, new **core packages** first, e.g., "`aptitude install perl`".
686 12. Run the "`aptitude full-upgrade -s`" command to assess impact.
687 13. Run the "`aptitude full-upgrade`" command at last.
688
689 CAUTION: It is not wise to skip major Debian release when upgrading between `stable` releases.
690
691 CAUTION: In previous "Release Notes", GCC, Linux Kernel, initrd-tools, Glibc, Perl, APT tool chain, etc. have required some special attention for system wide upgrade.
692
693 For daily upgrade in `unstable`, see <<_safeguarding_for_package_problems>>.
694
695 === Advanced package management operations
696
697 ==== Advanced package management operations with commandline
698
699 Here are list of other package management operations for which `aptitude` is too high-level or lacks required functionalities.
700
701 .List of advanced package management operations
702 [grid="all"]
703 `--------------------------------------------------------------`--------------------------------------------------------------------------
704 command action
705 ------------------------------------------------------------------------------------------------------------------------------------------
706 `COLUMNS=120 dpkg -l <package_name_pattern>` list status of an installed package for the bug report
707 `dpkg -L <package_name>` list contents of an installed package
708 `dpkg -L <package_name> | egrep \'/usr/share/man/man.\*/.+\'` list manpages for an installed package
709 `dpkg -S <file_name_pattern>` list installed packages which have matching file name
710 `apt-file search <file_name_pattern>` list packages in archive which have matching file name
711 `apt-file list <package_name_pattern>` list contents of matching packages in archive
712 `dpkg-reconfigure <package_name>` reconfigure the exact package
713 `dpkg-reconfigure -p=low <package_name>` reconfigure the exact package with the most detailed question
714 `configure-debian` reconfigure packages from the full screen menu
715 `dpkg --audit` audit system for partially installed packages
716 `dpkg --configure -a` configure all partially installed packages
717 `apt-cache policy <binary_package_name>` show available version, priority, and archive information of a binary package
718 `apt-cache madison <package_name>` show available version, archive information of a package
719 `apt-cache showsrc <binary_package_name>` show source package information of a binary package
720 `apt-get build-dep <package_name>` install required packages to build package
721 `apt-get source <package_name>` download a source (from standard archive)
722 `dget <URL for dsc file>` download a source packages (from other archive)
723 `dpkg-source -x <package_name>_<version>-<debian_version>.dsc` build a source tree from a set of source packages ("`\*.tar.gz`" and "`\*.diff.gz`")
724 `debuild binary` build package(s) from a local source tree
725 `make-kpkg kernel_image` build a kernel package from a kernel source tree
726 `make-kpkg --initrd kernel_image` build a kernel package from a kernel source tree with initramfs enabled
727 `dpkg -i <package_name>_<version>-<debian_version>_<arch>.deb` install a local package to the system
728 `debi <package_name>_<version>-<debian_version>_<arch>.dsc` install local package(s) to the system
729 `dpkg --get-selection \'\*\' >selection.txt` save `dpkg` level package selection state information
730 `dpkg --set-selection <selection.txt` set `dpkg` level package selection state information
731 ------------------------------------------------------------------------------------------------------------------------------------------
732
733 // removed this since it create package under the same version || download a source and rebuild package(s) locally. || {{{apt-get -b source <package_name>}}} ||
734
735 CAUTION: Lower level package tools such as "`dpkg -i ...`" and "`debi ...`" should be carefully used by the system administrator. It does not automatically take care required package dependencies. Dpkg@@@sq@@@s commandline options "`--force-all`" and similar (see `dpkg`(1)) are intended to be used by experts only. Using them without fully understanding their effects may break your whole system.
736
737 Please note the following.
738
739 - All system configuration and installation commands require to be run from root.
740 - Unlike `aptitude` which uses regex (see <<_regular_expressions>>), other package management commands use pattern like shell glob (see <<_shell_glob>>).
741 - `apt-file`(1) provided by the `apt-file` package must run "`apt-file update`" in advance.
742 - `configure-debian`(8) provided by the `configure-debian` package runs `dpkg-reconfigure`(8) as its backend.
743 - `dpkg-reconfigure`(8) runs package scripts using `debconf`(1) as its backend.
744 - "`apt-get build-dep`", "`apt-get source`" and "`apt-cache showsrc`" commands require "`deb-src`" entry in "`/etc/apt/sources.list`".
745 - `dget`(1), `debuild`(1), and `debi`(1) require `devscripts` package.
746 - See (re)packaging procedure using "`apt-get source`" in <<_porting_a_package_to_the_stable_system>>.
747 - `make-kpkg` command requires the `kernel-package` package (see <<_the_kernel>>).
748 - See <<_making_debian_package>> for general packaging.
749
750 TIP: The source package format described here as a set of source packages ("`\*.tar.gz`" and "`\*.diff.gz`") is format 1.0 which is still popular. See more on `dpkg-source`(1) for other newer formats.
751
752 ==== Verification of installed package files
753
754 The installation of `debsums` enables verification of installed package files against MD5sum values in the "`/var/lib/dpkg/info/\*.md5sums`" file with `debsums`(1). See <<_the_md5_sum>> for how MD5sum works.
755
756 NOTE: Because MD5sum database may be tampered by the intruder, `debsums`(1) is of limited use as a security tool. It is only good for checking local modifications by the administrator or damage due to media errors.
757
758 ==== Safeguarding for package problems
759
760 Many users prefer to follow the **unstable** release of the Debian system for its new features and packages. This makes the system more prone to be hit by the critical package bugs.
761
762 The installation of the `apt-listbugs` package safeguards your system against critical bugs by checking Debian BTS automatically for critical bugs when upgrading with APT system.
763
764 The installation of the `apt-listchanges` package provides important news in "`NEWS.Debian`" when upgrading with APT system.
765
766 ==== Searching on the package meta data
767
768 Although visiting Debian site http://packages.debian.org/[http://packages.debian.org/] facilitates easy ways to search on the package meta data these days, let@@@sq@@@s look into more traditional ways.
769
770 The `grep-dctrl`(1), `grep-status`(1), and `grep-available`(1) commands can be used to search any file which has the general format of a Debian package control file.
771
772 The "`dpkg -S <file_name_pattern>`" can be used search package names which contain files with the matching name installed by `dpkg`. But this overlooks files created by the maintainer scripts.
773
774 If you need to make more elaborate search on the dpkg meta data, you need to run "`grep -e regex_pattern \*`" command in the "`/var/lib/dpkg/info/`" directory. This makes you search words mentioned in package scrips and installation query texts.
775
776 If you wish to look up package dependency recursively, you should use `apt-rdepends`(8).
777
778 === Debian package management internals
779
780 Let@@@sq@@@s learn how the Debian package management system works internally. This should help you to create your own solution to some package problems.
781
782 ==== Archive meta data
783
784 Meta data files for each distribution are stored under "`dist/<codename>`" on each Debian mirror sites, e.g., "`http://ftp.us.debian.org/debian/`". Its archive structure can be browsed by the web browser. There are 6 types of key meta data.
785
786 .The content of the Debian archive meta data
787 [grid="all"]
788 `-------------------------`------------------------------------------------------------------`--------------------------------------------
789 file location content
790 ------------------------------------------------------------------------------------------------------------------------------------------
791 `Release` top of distribution archive description and integrity information
792 `Release.gpg` top of distribution signature file for the "`Release`" file signed with the archive key
793 `Contents-<architecture>` top of distribution list of all files for all the packages in the pertinent archive
794 `Release` top of each distribution/component/architecture combination archive description used for the rule of `apt_preferences`(5)
795 `Packages` top of each distribution/component/binary-architecture combination concatenated `debian/control` for binary packages
796 `Sources` top of each distribution/component/source combination concatenated `debian/control` for source packages
797 ------------------------------------------------------------------------------------------------------------------------------------------
798
799 In the recent archive, these meta data are stored as the compressed and differential files to reduce network traffic.
800
801 ==== Top level "Release" file and authenticity
802
803 TIP: The top level "`Release`" file is used for signing the archive under the **secure APT** system.
804
805 Each suite of the Debian archive has a top level "`Release`" file, e.g., "`http://ftp.us.debian.org/debian/dists/unstable/Release`", as follows.
806
807 --------------------
808 Origin: Debian
809 Label: Debian
810 Suite: unstable
811 Codename: sid
812 Date: Sat, 26 Jan 2008 20:13:58 UTC
813 Architectures: alpha amd64 arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc
814 Components: main contrib non-free
815 Description: Debian x.y Unstable - Not Released
816 MD5Sum:
817 e9f11bc50b12af7927d6583de0a3bd06 22788722 main/binary-alpha/Packages
818 43524d07f7fa21b10f472c426db66168 6561398 main/binary-alpha/Packages.gz
819 ...
820 --------------------
821
822 NOTE: Here, you can find my rationale to use the "suite", "codeneme", and "components" in <<_debian_archive_basics>>. The "distribution" is used when referring to both "suite" and "codeneme".
823
824 The integrity of the top level "`Release`" file is verified by cryptographic infrastructure called the http://wiki.debian.org/SecureApt[secure apt].
825
826 - The cryptographic signature file "`Release.gpg`" is created from the authentic top level "`Release`" file and the secret Debian archive key.
827 - The public Debian archive key can be seeded into "`/etc/apt/trusted.gpg`";
828 * automatically by installing the keyring with the latest `base-files` package, or
829 * manually by `gpg` or `apt-key` tool with http://ftp-master.debian.org/[the latest public archive key posted on the ftp-master.debian.org] .
830 - The **secure APT** system verifies the integrity of the downloaded top level "`Release`" file cryptographically by this "`Release.gpg`" file and the public Debian archive key in "`/etc/apt/trusted.gpg`".
831
832 The integrity of all the "`Packages`" and "`Sources`" files are verified by using MD5sum values in its top level "`Release`" file. The integrity of all package files are verified by using MD5sum values in the "`Packages`" and "`Sources`" files. See `debsums`(1) and <<_verification_of_installed_package_files>>.
833
834 Since the cryptographic signature verification is very CPU intensive process than the MD5sum value calculation, use of MD5sum value for each package while using cryptographic signature for the top level "`Release`" file provides http://www.infodrom.org/\~joey/Writing/Linux-Journal/secure-apt/[the good security with the performance] (see <<_data_security_infrastructure>>).
835
836 ==== Archive level "Release" files
837
838 TIP: The archive level "`Release`" files are used for the rule of `apt_preferences`(5).
839
840 There are archive level "`Release`" files for all archive locations specified by "`deb`" line in "`/etc/apt/sources.list`", such as "`http://ftp.us.debian.org/debian/dists/unstable/main/binary-amd64/Release`" or "`http://ftp.us.debian.org/debian/dists/sid/main/binary-amd64/Release`" as follows.
841
842 --------------------
843 Archive: unstable
844 Component: main
845 Origin: Debian
846 Label: Debian
847 Architecture: amd64
848 --------------------
849
850 CAUTION: For "`Archive:`" stanza, suite names ("`stable`", "`testing`", "`unstable`", ...) are used in http://ftp.us.debian.org/debian/[the Debian archive] while codenames ("`dapper`", "`feisty`", "`gutsy`", "`hardy`", "`intrepid`", ...) are used in http://archive.ubuntu.com/ubuntu/[the Ubuntu archive].
851
852 For some archives, such as `experimental`, `volatile-sloppy`, and `@-@codename-stable@-@-backports`, which contain packages which should not be installed automatically, there is an extra line, e.g., "`http://ftp.us.debian.org/debian/dists/experimental/main/binary-amd64/Release`" as follows.
853
854 --------------------
855 Archive: experimental
856 Component: main
857 Origin: Debian
858 Label: Debian
859 NotAutomatic: yes
860 Architecture: amd64
861 --------------------
862
863 Please note that for normal archives without "`NotAutomatic: yes`", the default Pin-Priority value is 500, while for special archives with "`NotAutomatic: yes`", the default Pin-Priority value is 1 (see `apt_preferences`(5) and <<_tweaking_candidate_version>>).
864
865 ==== Fetching of the meta data for the package
866
867 When APT tools, such as `aptitude`, `apt-get`, `synaptic`, `apt-file`, `auto-apt`..., are used, we need to update the local copies of the meta data containing the Debian archive information. These local copies have following file names corresponding to the specified `distribution`, `component`, and `architecture` names in the "`/etc/apt/sources.list`" (see <<_debian_archive_basics>>).
868
869 - "`/var/lib/apt/lists/ftp.us.debian.org_debian_dists_<distribution>_Release`"
870 - "`/var/lib/apt/lists/ftp.us.debian.org_debian_dists_<distribution>_Release.gpg`"
871 - "`/var/lib/apt/lists/ftp.us.debian.org_debian_dists_<distribution>_<component>_binary-<architecture>_Packages`"
872 - "`/var/lib/apt/lists/ftp.us.debian.org_debian_dists_<distribution>_<component>_source_Sources`"
873 - "`/var/cache/apt/apt-file/ftp.us.debian.org_debian_dists_<distribution>_Contents-<architecture>.gz`" (for `apt-file`)
874
875 First 4 types of files are shared by all the pertinent APT commands and updated from command line by "`apt-get update`" and "`aptitude update`". The "`Packages`" meta data are updated if there is the "`deb`" line in "`/etc/apt/sources.list`". The "`Sources`" meta data are updated if there is the "`deb-src`" line in "`/etc/apt/sources.list`".
876
877 The "`Packages`" and "`Sources`" meta data contain "`Filename:`" stanza pointing to the file location of the binary and source packages. Currently, these packages are located under the "`pool/`" directory tree for the improved transition over the releases.
878
879 Local copies of "`Packages`" meta data can be interactively searched with the help of `aptitude`. The specialized search command `grep-dctrl`(1) can search local copies of "`Packages`" and "`Sources`" meta data.
880
881 Local copy of "`Contents-<architecture>`" meta data can be updated by "`apt-file update`" and its location is different from other 4 ones. See `apt-file`(1). (The `auto-apt` uses different location for local copy of "`Contents-<architecture>.gz`" as default.)
882
883 ==== The package state for APT
884
885 In addition to the remotely fetched meta data, the APT tool after `lenny` stores its locally generated installation state information in the "`/var/lib/apt/extended_states`" which is used by all APT tools to track all auto installed packages.
886
887 ==== The package state for aptitude
888
889 In addition to the remotely fetched meta data, the `aptitude` command stores its locally generated installation state information in the "`/var/lib/aptitude/pkgstates`" which is used only by it.
890
891 ==== Local copies of the fetched packages
892
893 All the remotely fetched packages via APT mechanism are stored in the "`/var/cache/apt/packages`" until they are cleaned.
894
895 ==== Debian package file names
896
897 Debian package files have particular name structures.
898
899 .The name structure of Debian packages
900 [grid="all"]
901 `--------------------------------------------------------`--------------------------------------------------------------------------------
902 package type name structure
903 ------------------------------------------------------------------------------------------------------------------------------------------
904 The binary package (a.k.a deb) `<package-name>_<epoch>:<upstream-version>-<debian.version>-<architecture>.deb`
905 The binary package for the debian-installer (a.k.a udeb) `<package-name>_<epoch>:<upstream-version>-<debian.version>-<architecture>.udeb`
906 The source package (upstream source) `<package-name>_<epoch>:<upstream-version>-<debian.version>.tar.gz`
907 The source package (Debian changes) `<package-name>_<epoch>:<upstream-version>-<debian.version>.diff.gz`
908 The source package (description) `<package-name>_<epoch>:<upstream-version>-<debian.version>.dsc`
909 ------------------------------------------------------------------------------------------------------------------------------------------
910
911 .The usable characters for each component in the Debian package names
912 [grid="all"]
913 `--------------------`-------------------------`---------
914 name component usable characters (regex) existence
915 ---------------------------------------------------------
916 `<package-name>` `[a-z,A-Z,0-9,.,+,-]+` required
917 `<epoch>:` `[0-9]+:` optional
918 `<upstream-version>` `[a-z,A-Z,0-9,.,+,-,:]+` required
919 `<debian.version>` `[a-z,A-Z,0-9,.,+,\~]+` optional
920 ---------------------------------------------------------
921
922 NOTE: You can check package version order by `dpkg`(1), e.g., "`dpkg --compare-versions 7.0 gt 7.\~pre1 ; echo $?`" .
923
924 NOTE: http://www.debian.org/devel/debian-installer/[The debian-installer (d-i)] uses `udeb` as the file extension for its binary package instead of normal `deb`. An `udeb` package is a stripped down `deb` package which removes few non-essential contents such as documentation to save space while relaxing the package policy requirements. Both `deb` and `udeb` packages share the same package structure. The "`u`" stands for micro.
925
926 ==== The dpkg command
927
928 `dpkg`(1) is the lowest level tool for the Debian package management. This is very powerful and needs to be used with care.
929
930 While installing package called "`<package_name>`", `dpkg` process it in the following order.
931
932 1. Unpack the deb file ("`ar -x`" equivalent)
933 2. Execute "`<package_name>.preinst`" using `debconf`(1)
934 3. Install the package content to the system ("`tar -x`" equivalent)
935 4. Execute "`<package_name>.postinst`" using `debconf`(1)
936
937 The `debconf` system provides standardized user interaction with I18N and L10N (<<_i18n_and_l10n>>) supports.
938
939 .The notable files created by `dpkg`
940 [grid="all"]
941 `---------------------------------------------`--------------------------------------------------------------------------------
942 file description of contents
943 -------------------------------------------------------------------------------------------------------------------------------
944 `/var/lib/dpkg/info/<package_name>.conffiles` list of configuration files. (user modifiable)
945 `/var/lib/dpkg/info/<package_name>.list` list of files and directories installed by the package
946 `/var/lib/dpkg/info/<package_name>.md5sums` list of MD5 hash values for files installed by the package
947 `/var/lib/dpkg/info/<package_name>.preinst` package script run before the package installation
948 `/var/lib/dpkg/info/<package_name>.postinst` package script run after the package installation
949 `/var/lib/dpkg/info/<package_name>.prerm` package script run before the package removal
950 `/var/lib/dpkg/info/<package_name>.postrm` package script run after the package removal
951 `/var/lib/dpkg/info/<package_name>.config` package script for `debconf` system
952 `/var/lib/dpkg/alternatives/<package_name>` the alternative information used by the `update-alternatives` command
953 `/var/lib/dpkg/available` the availability information for all the package
954 `/var/lib/dpkg/diversions` the diversions information used by `dpkg`(1) and set by`dpkg-divert`(8)
955 `/var/lib/dpkg/statoverride` the stat override information used by `dpkg`(1) and set by`dpkg-statoverride`(8)
956 `/var/lib/dpkg/status` the status information for all the packages
957 `/var/lib/dpkg/status-old` the first-generation backup of the "`var/lib/dpkg/status`" file
958 `/var/backups/dpkg.status\*` the second-generation backup and older ones of the "`var/lib/dpkg/status`" file
959 -------------------------------------------------------------------------------------------------------------------------------
960
961 The "`status`" file is also used by the tools such as `dpkg`(1), "`dselect update`" and "`apt-get -u dselect-upgrade`".
962
963 The specialized search command `grep-dctrl`(1) can search the local copies of "`status`" and "`available`" meta data.
964
965 TIP: In http://www.debian.org/devel/debian-installer/[the debian-installer] environment, the `udpkg` command is used to open `udeb` packages. The `udpkg` command is a stripped down version of the `dpkg` command.
966
967 ==== The update-alternative command
968
969 The Debian system has mechanism to install somewhat overlapping programs peacefully using `update-alternatives`(8). For example, you can make the `vi` command select to run `vim` while installing both `vim` and `nvi` packages.
970
971 --------------------
972 $ ls -l $(type -p vi)
973 lrwxrwxrwx 1 root root 20 2007-03-24 19:05 /usr/bin/vi -> /etc/alternatives/vi
974 $ sudo update-alternatives --display vi
975 ...
976 $ sudo update-alternatives --config vi
977 Selection Command
978 ----------------------------------------------
979 1 /usr/bin/vim
980 *+ 2 /usr/bin/nvi
981
982 Enter to keep the default[*], or type selection number: 1
983 --------------------
984
985 The Debian alternatives system keeps its selection as symlinks in "`/etc/alternatives/`". The selection process uses corresponding file in "`/var/lib/dpkg/alternatives/`".
986
987 ==== The dpkg-statoverride command
988
989 **Stat overrides** provided by the `dpkg-statoverride`(8) command are a way to tell `dpkg`(1) to use a different owner or mode for a **file** when a package is installed. If "`--update`" is specified and file exists, it is immediately set to the new owner and mode.
990
991 CAUTION: The direct alteration of owner or mode for a **file** owned by the package using `chmod` or `chown` commands by the system administrator is reset by the next upgrade of the package.
992
993 NOTE: I use the word **file** here, but in reality this can be any filesystem object that `dpkg` handles, including directories, devices, etc.
994
995 ==== The dpkg-divert command
996
997 File **diversions** provided by the `dpkg-divert`(8) command are a way of forcing `dpkg`(1) not to install a file into its default location, but to a **diverted** location. The use of `dpkg-divert` is meant for the package maintenance scripts. Its casual use by the system administrator is deprecated.
998
999 === Recovery from a broken system
1000
1001 When running `unstable` system, the administrator is expected to recover from broken package management situation.
1002
1003 CAUTION: Some methods described here are high risk actions. You have been warned!
1004
1005 ==== Incompatibility with old user configuration
1006
1007 If a desktop GUI program experienced instability after significant upstream version upgrade, you should suspect interferences with old local configuration files created by it. If it is stable under newly created user account, this hypothesis is confirmed. (This is a bug of packaging and usually avoided by the packager.)
1008
1009 To recover stability, you should move corresponding local configuration files and restart the GUI program. You may need to read old configuration file contents to recover configuration information later. (Do not erase them too quickly.)
1010
1011 ==== Different packages with overlapped files
1012
1013 Archive level package management systems, such as `aptitude`(8) or `apt-get`(1), do not even try to install packages with overlapped files using package dependencies (see <<_package_dependencies>>).
1014
1015 Errors by the package maintainer or deployment of inconsistently mixed source of archives (see <<_packages_from_mixed_source_of_archives>>) by the system administrator may create situation with incorrectly defined package dependencies. When you install a package with overlapped files using `aptitude`(8) or `apt-get`(1) under such situation, `dpkg`(1) which unpacks package ensures to return error to the calling program without overwriting existing files.
1016
1017 CAUTION: The use of third party packages introduces significant system risks via maintainer scripts which are run with root privilege and can do anything to your system. The `dpkg`(1) command only protects against overwriting by the unpacking.
1018
1019 You can work around such broken installation by removing the old offending package, `<old-package>`, first.
1020
1021 --------------------
1022 $ sudo dpkg -P <old-package>
1023 --------------------
1024
1025 ==== Fixing broken package script
1026
1027 When a command in the package script returns error for some reason and the script exits with error, the package management system aborts their action and ends up with partially installed packages. When a package contains bugs in its removal scripts, the package may become impossible to remove and quite nasty.
1028
1029 For the package script problem of "`<package_name>`", you should look into following package scripts.
1030
1031 - "`/var/lib/dpkg/info/<package_name>.preinst`"
1032 - "`/var/lib/dpkg/info/<package_name>.postinst`"
1033 - "`/var/lib/dpkg/info/<package_name>.prerm`"
1034 - "`/var/lib/dpkg/info/<package_name>.postrm`"
1035
1036 Edit the offending package script from the root using following techniques.
1037
1038 - disable the offending line by preceding "`#`"
1039 - force to return success by appending the offending line with "`|| true`"
1040
1041 Configure all partially installed packages with the following command.
1042
1043 --------------------
1044 # dpkg --configure -a
1045 --------------------
1046
1047 ==== Rescue with the dpkg command
1048
1049 Since `dpkg` is very low level package tool, it can function under the very bad situation such as unbootable system without network connection. Let@@@sq@@@s assume `foo` package was broken and needs to be replaced.
1050
1051 You may still find cached copies of older bug free version of `foo` package in the package cache directory: "`/var/cache/apt/archives/`". (If not, you can download it from archive of http://snapshot.debian.net/ or copy it from package cache of a functioning machine.)
1052
1053 If you can boot the system, you may install it by the following command.
1054
1055 --------------------
1056 # dpkg -i /path/to/foo_<old_version>_<arch>.deb
1057 --------------------
1058
1059 TIP: If system breakage is minor, you may alternatively downgrade the whole system as <<_emergency_downgrading>> using the higher level APT system.
1060
1061 If your system is unbootable from hard disk, you should seek other ways to boot it.
1062
1063 1. Boot the system using the debian-installer CD in rescue mode.
1064 2. Mount the unbootable system on the hard disk to "`/target`".
1065 3. Install older version of `foo` package by the following.
1066
1067 --------------------
1068 # dpkg --root /target -i /path/to/foo_<old_version>_<arch>.deb
1069 --------------------
1070
1071 This example works even if the `dpkg` command on the hard disk is broken.
1072
1073 TIP: Any GNU/Linux system started by another system on hard disk, live GNU/Linux CD, bootable USB-key drive, or netboot can be used similarly to rescue broken system.
1074
1075 If attempting to install a package this way fails due to some dependency violations and you really need to do this as the last resort, you can override dependency using `dpkg`@@@sq@@@s "`--ignore-depends`", "`--force-depends`" and other options. If you do this, you need to make serious effort to restore proper dependency later. See `dpkg`(8) for details.
1076
1077 NOTE: When your system is seriously broken, you should make a full backup of system to a safe place (see <<_backup_and_recovery>>) and should perform a clean installation. This is less time consuming and produces better results in the end.
1078
1079 ==== Recovering package selection data
1080
1081 If "`/var/lib/dpkg/status`" becomes corrupt for any reason, the Debian system loses package selection data and suffers severely. Look for the old "`/var/lib/dpkg/status`" file at "`/var/lib/dpkg/status-old`" or "`/var/backups/dpkg.status.\*`".
1082
1083 Keeping "`/var/backups/`" in a separate partition may be a good idea since this directory contains lots of important system data.
1084
1085 For serious breakage, I recommend to make fresh re-install after making backup of the system. Even if everything in "`/var/`" is gone, you can still recover some information from directories in "`/usr/share/doc/`" to guide your new installation.
1086
1087 Reinstall minimal (desktop) system.
1088
1089 --------------------
1090 # mkdir -p /path/to/old/system
1091 --------------------
1092
1093 Mount old system at "`/path/to/old/system/`".
1094
1095 --------------------
1096 # cd /path/to/old/system/usr/share/doc
1097 # ls -1 >~/ls1.txt
1098 # cd /usr/share/doc
1099 # ls -1 >>~/ls1.txt
1100 # cd
1101 # sort ls1.txt | uniq | less
1102 --------------------
1103
1104 Then you are presented with package names to install. (There may be some non-package names such as "`texmf`".)
1105
1106 === Tips for the package management
1107
1108 ==== How to pick Debian packages
1109
1110 You can seek packages which satisfy your needs with `aptitude` from the package description or from the list under "Tasks".
1111
1112 When you encounter more than 2 similar packages and wonder which one to install without "trial and error" efforts, you should use some **common sense**. I consider following points are good indications of preferred packages.
1113
1114 - Essential: yes > no
1115 - Component: main > contrib > non-free
1116 - Priority: required > important > standard > optional > extra
1117 - Tasks: packages listed in tasks such as "Desktop environment"
1118 - Packages selected by the dependency package (e.g., `python2.4` by `python`)
1119 - Popcon: higher in the vote and install number
1120 - Changelog: regular updates by the maintainer
1121 - BTS: No RC bugs (no critical, no grave, and no serious bugs)
1122 - BTS: responsive maintainer to bug reports
1123 - BTS: higher number of the recently fixed bugs
1124 - BTS: lower number of remaining non-wishlist bugs
1125
1126 Debian being a volunteer project with distributed development model, its archive contains many packages with different focus and quality. You must make your own decision what to do with them.
1127
1128 ==== Packages from mixed source of archives
1129
1130 CAUTION: Installing packages from mixed source of archives is not supported by the official Debian distribution except for officially supported particular combinations of archives such as `stable` with http://www.debian.org/security/[security updates] and http://www.debian.org/volatile/[volatile updates].
1131
1132 Here is an example of operations to include specific newer upstream version packages found in `unstable` while tracking `testing` for single occasion.
1133
1134 1. Change the "`/etc/apt/sources.list`" file temporarily to single "`unstable`" entry.
1135 2. Run "`aptitude update`".
1136 3. Run "`aptitude install <package-name>`".
1137 4. Recover the original "`/etc/apt/sources.list`" file for `testing`.
1138 5. Run "`aptitude update`".
1139
1140 You do not create the "`/etc/apt/preferences`" file nor need to worry about apt-pinning with this manual approach. But this is very cumbersome.
1141
1142 CAUTION: When using mixed source of archives, you must ensure compatibility of packages by yourself since the Debian does not guarantee it. If package incompatibility exists, you may break system. You must be able to judge these technical requirements. The use of mixed source of random archives is completely optional operation and its use is not something I encourage you to use.
1143
1144 General rules for installing packages from different archives are followings.
1145
1146 - Non-binary packages ("`Architecture: all`") are **safer** to install.
1147 * documentation packages: no special requirements
1148 * interpreter program packages: compatible interpreter must be available
1149 - Binary packages (non "`Architecture: all`") usually face many road blocks and **unsafe** to install.
1150 * library version compatibility (including "`libc`")
1151 * related utility program version compatibility
1152 * Kernel http://en.wikipedia.org/wiki/Application_binary_interface[ABI] compatibility
1153 * C++ http://en.wikipedia.org/wiki/Application_binary_interface[ABI] compatibility
1154 * ...
1155
1156 NOTE: In order to make a package to be **safer** to install, some commercial non-free binary program packages may be provided with completely statically linked libraries. You should still check http://en.wikipedia.org/wiki/Application_binary_interface[ABI] compatibility issues etc. for them.
1157
1158 NOTE: Except to avoid broken package for a short term, installing binary packages from officially unsupported archives is generally bad idea. This is true even if you use apt-pinning (see <<_tweaking_candidate_version>>). You should consider chroot or similar techniques (see <<_virtualized_system>>) to run programs from different archives.
1159
1160 ==== Tweaking candidate version
1161
1162 WARNING: In `lenny`, `aptitude`(8) has a bug for handling "`/etc/apt/preferences`" file. (http://bugs.debian.org/514930[Bug#514930])
1163
1164 Without the "`/etc/apt/preferences`" file, APT system choses the latest available version as the **candidate version** using the version string. This is the normal state and most recommended usage of APT system. All officially supported combinations of archives do not require the "`/etc/apt/preferences`" file since some archives which should not be used as the automatic source of upgrades are marked as **NotAutomatic** and dealt properly.
1165
1166 TIP: The version string comparison rule can be verified with, e.g., "`dpkg --compare-versions ver1.1 gt ver1.1\~1; echo $?`" (see `dpkg`(1)).
1167
1168 When you install packages from mixed source of archives (see <<_packages_from_mixed_source_of_archives>>) regularly, you can automate these complicated operations by creating the "`/etc/apt/preferences`" file with proper entries and tweaking the package selection rule for **candidate version** as described in `apt_preferences`(5). This is called **apt-pinning**.
1169
1170 WARNING: Use of apt-pinning by a novice user is sure call for major troubles. You must avoid using apt-pinning except when you absolutely need it.
1171
1172 CAUTION: When using apt-pinning, you must ensure compatibility of packages by yourself since the Debian does not guarantee it. The apt-pinning is completely optional operation and its use is not something I encourage you to use.
1173
1174 CAUTION: Archive level Release files (see <<_archive_level_release_files>>) are used for the rule of `apt_preferences`(5). Thus apt-pinning works only with "suite" name for http://ftp.us.debian.org/debian/dists/[normal Debian archives] and http://security.debian.org/dists/[security Debian archives]. (This is different from http://www.ubuntu.com/[Ubuntu] archives). For example, you can do "`Pin: release a=unstable`" but can not do "`Pin: release a=sid`" in the "`/etc/apt/preferences`" file.
1175
1176 CAUTION: When you use non-Debian archive as a part of apt-pinning, you should check what they are intended for and also check their credibility. For example, Ubuntu and Debian are not meant to be mixed.
1177
1178 NOTE: Even if you do not create the "`/etc/apt/preferences`" file, you can do fairly complex system operations (see <<_rescue_with_the_dpkg_command>> and <<_packages_from_mixed_source_of_archives>>) without apt-pinning.
1179
1180 Here is a simplified explanation of **apt-pinning** technique.
1181
1182 APT system choses highest Pin-Priority **upgrading** package from available package sources defined in the "`/etc/apt/sources.list`" file as the **candidate version** package. If the Pin-Priority of the package is larger than 1000, this version restriction for **upgrading** is dropped to enable downgrading (see <<_emergency_downgrading>>).
1183
1184 Pin-Priority value of each package is defined by "Pin-Priority" entries in the "`/etc/apt/preferences`" file or uses its default value.
1185
1186 .List of the default Pin-Priority value for each package source type
1187 [grid="all"]
1188 `--------------------`----------------------------------
1189 default Pin-Priority package source type
1190 --------------------------------------------------------
1191 990 **target release** archive
1192 500 **normal** archive
1193 100 **installed** package
1194 1 **NotAutomatic** archive
1195 --------------------------------------------------------
1196
1197 The **target release** archive can be set by several methods.
1198
1199 - "`/etc/apt/apt.conf`" configuration file with "`APT::Default-Release "stable";`" line
1200 - command line option, e.g., "`apt-get install -t testing some-package`"
1201
1202 The **NotAutomatic** archive is set by archive server having its archive level Release file (see <<_archive_level_release_files>>) containing "`NotAutomatic: yes`".
1203
1204 The **apt-pinning situation** of <package> from multiple archive sources is displayed by "`apt-cache policy <package>`".
1205
1206 - A line started with "`Package pin:`" lists the package version of **pin** if association just with <package> is defined, e.g., "`Package pin: 0.190`".
1207 - No line with "`Package pin:`" exists if no association just with <package> is defined.
1208 - The Pin-Priority value associated just with <package> is listed right side of all version strings, e.g., "`0.181 700`".
1209 - "`0`" is listed right side of all version strings if no association just with <package> is defined, e.g., "`0.181 0`".
1210 - The Pin-Priority values of archives (defined as "`Package: \*`" in the "`/etc/apt/preferences`" file) are listed left side of all archive paths, e.g., "`200 http:@@@slash@@@/backports.org etch-backports/main Packages`".
1211
1212 Here is an example of **apt-pinning** technique to include specific newer upstream version packages found in `unstable` regularly upgraded while tracking `testing`. You list all required archives in the "`/etc/apt/sources.list`" file as the following.
1213
1214 --------------------
1215 deb http://ftp.us.debian.org/debian/ testing main contrib non-free
1216 deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
1217 deb http://security.debian.org/ testing/updates main contrib
1218 --------------------
1219
1220 Set the "`/etc/apt/preferences`" file as as the following.
1221
1222 --------------------
1223 Package: *
1224 Pin: release a=testing
1225 Pin-Priority: 500
1226
1227 Package: *
1228 Pin: release a=unstable
1229 Pin-Priority: 200
1230 --------------------
1231
1232 When you wish to install a package named "`<package-name>`" with its dependencies from `unstable` archive under this configuration, you issue the following command which switches target release with "`-t`" option (Pin-Priority of `unstable` becomes 990.).
1233
1234 --------------------
1235 $ sudo apt-get install -t unstable <package-name>
1236 --------------------
1237
1238 With this configuration, usual execution of "`apt-get upgrade`" and "`apt-get dist-upgrade`" (or "`aptitude safe-upgrade`" and "`aptitude full-upgrade`" for `squeeze`) upgrades packages which were installed from `testing` archive using current `testing` archive and packages which were installed from `unstable` archive using current `unstable` archive.
1239
1240 CAUTION: Be careful not to remove "`testing`" entry from the "`/etc/apt/sources.list`" file. Without "`testing`" entry in it, APT system upgrades packages using newer `unstable` archive.
1241
1242 TIP: I usually edit the "`/etc/apt/sources.list`" file to comment out "`unstable`" archive entry right after above operation. This avoids slow update process of having too many entries in the "`/etc/apt/sources.list`" file although this prevents upgrading packages which were installed from `unstable` archive using current `unstable` archive.
1243
1244 TIP: If "`Pin-Priority: 20`" is used instead of "`Pin-Priority: 200`" for the "`/etc/apt/preferences`" file, already installed packages having Pin-Priority value of 100 are not upgraded by `unstable` archive even if "`testing`" entry in the "`/etc/apt/sources.list`" file is removed.
1245
1246 If you wish to track particular packages in `unstable` automatically without initial "`-t unstable`" installation, you must create the "`/etc/apt/preferences`" file and explicitly list all those packages at the top of it as the following.
1247
1248 --------------------
1249 Package: <package-1>
1250 Pin: release a=unstable
1251 Pin-Priority: 700
1252
1253 Package: <package-2>
1254 Pin: release a=unstable
1255 Pin-Priority: 700
1256 --------------------
1257
1258 These set Pin-Priority value for each specific package. For example, in order to track the latest `unstable` version of this "Debian Reference" in English, you should have following entries in the "`/etc/apt/preferences`" file.
1259
1260 --------------------
1261 Package: debian-reference-en
1262 Pin: release a=unstable
1263 Pin-Priority: 700
1264
1265 Package: debian-reference-common
1266 Pin: release a=unstable
1267 Pin-Priority: 700
1268 --------------------
1269
1270 TIP: This apt-pinning technique is valid even when you are tracking `stable` archive. Documentation packages have been always safe to install from `unstable` archive in my experience, so far.
1271
1272 Here is another example of **apt-pinning** technique to include specific newer upstream version packages found in `experimental` while tracking `unstable`. You list all required archives in the "`/etc/apt/sources.list`" file as the following.
1273
1274 --------------------
1275 deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
1276 deb http://ftp.us.debian.org/debian/ experimental main contrib non-free
1277 deb http://security.debian.org/ testing/updates main contrib
1278 --------------------
1279
1280 The default Pin-Priority value for `experimental` archive is always 1 (@@@dlt@@@100) since it is **NotAutomatic** archive (see <<_archive_level_release_files>>). There is no need to set Pin-Priority value explicitly in the "`/etc/apt/preferences`" file just to use `experimental` archive unless you wish to track particular packages in it automatically for next upgrading.
1281
1282 ==== Volatile and Backports.org
1283
1284 There are http://www.debian.org/volatile/[debian-volatile project] and http://backports.org[backports.org] archives which provide updgrade packages for `stable`.
1285
1286 WARNING: Do not use all packages available in the **NotAutomatic** archives such as `@-@codename-stable@-@-backports` and `volatile-sloppy`. Use only selected packages which fits your needs.
1287
1288 CAUTION: http://backports.org[backports.org] is a non-Debian archive, although its packages are signed by Debian developers.
1289
1290 CAUTION: Archive level Release files (see <<_archive_level_release_files>>) are used for the rule of `apt_preferences`(5). Thus apt-pinning works only with "code" name for http://volatile.debian.org/debian-volatile/dists/[volatile Debian archives]. This is different from other Debian archives. For example, you can do "`Pin: release a=@-@codename-stable@-@`" but can not do "`Pin: release a=stable`" in the "`/etc/apt/preferences`" file for volatile Debian archives.
1291
1292 Here is an example of **apt-pinning** technique to include specific newer upstream version packages found in `@-@codename-stable@-@-backports` while tracking `@-@codename-stable@-@` and `volatile`. You list all required archives in the "`/etc/apt/sources.list`" file as the following.
1293
1294 --------------------
1295 deb http://ftp.us.debian.org/debian/ @-@codename-stable@-@ main contrib non-free
1296 deb http://security.debian.org/ @-@codename-stable@-@/updates main contrib
1297 deb http://volatile.debian.org/debian-volatile/ @-@codename-stable@-@/volatile main contrib non-free
1298 deb http://volatile.debian.org/debian-volatile/ @-@codename-stable@-@/volatile-sloppy main contrib non-free
1299 deb http://backports.org/debian/ @-@codename-stable@-@-backports main contrib non-free
1300 --------------------
1301
1302 The default Pin-Priority value for http://backports.org[backports.org] and `volatile-sloppy` archives are always 1 (@@@dlt@@@100) since they are **NotAutomatic** archive (see <<_archive_level_release_files>>). There is no need to set Pin-Priority value explicitly in the "`/etc/apt/preferences`" file just to use for http://backports.org[backports.org] and `volatile-sloppy` archive unless you wish to track packages automatically for next upgrading.
1303
1304 So whenever you wish to install a package named "`<package-name>`" with its dependency from `@-@codename-stable@-@-backports` archive, you use following command while switching target release with "`-t`" option.
1305
1306 --------------------
1307 $ sudo apt-get install -t @-@codename-stable@-@-backports <package-name>
1308 --------------------
1309
1310 If you wish to upgrade particular packages, you must create the "`/etc/apt/preferences`" file and explicitly lists all packages in it as the following.
1311
1312 --------------------
1313 Package: <package-1>
1314 Pin: release o=Backports.org archive
1315 Pin-Priority: 700
1316
1317 Package: <package-2>
1318 Pin: release o=volatile.debian.org
1319 Pin-Priority: 700
1320 --------------------
1321
1322 Alternatively, with the "`/etc/apt/preferences`" file as the following.
1323
1324 --------------------
1325 Package: *
1326 Pin: release a=stable , o=Debian
1327 Pin-Priority: 500
1328
1329 Package: *
1330 Pin: release a=@-@codename-stable@-@, o=volatile.debian.org
1331 Pin-Priority: 500
1332
1333 Package: *
1334 Pin: release a=@-@codename-stable@-@-backports, o=Backports.org archive
1335 Pin-Priority: 200
1336
1337 Package: *
1338 Pin: release a=@-@codename-stable@-@-sloppy, o=volatile.debian.org
1339 Pin-Priority: 200
1340 --------------------
1341
1342 Execution of "`apt-get upgrade`" and "`apt-get dist-upgrade`" (or "`aptitude safe-upgrade`" and "`aptitude full-upgrade`" for `squeeze`) upgrades packages which were installed from `stable` archive using current `stable` archive and packages which were installed from other archives using current corresponding archive for all archives in the "`/etc/apt/sources.list`" file.
1343
1344 ==== Automatic download and upgrade of packages
1345
1346 // APT package since 0.5.28 Ubuntu hoary and 0.5.29 Debian unstable (Sat, 13 Nov 2004)
1347 // has its own script /etc/cron.daily/apt
1348
1349 The `apt` package comes with its own cron script "`/etc/cron.daily/apt`" to support the automatic download of packages. This script can be enhanced to perform the automatic upgrade of packages by installing the `unattended-upgrades` package. These can be customized by parameters in "`/etc/apt/apt.conf.d/02backup`" and "`/etc/apt/apt.conf.d/50unattended-upgrades`" as described in "`/usr/share/doc/unattended-upgrades/README`".
1350
1351 The `unattended-upgrades` package is mainly intended for the security upgrade for the `stable` system. If the risk of breaking an existing `stable` system by the automatic upgrade is smaller than that of the system broken by the intruder using its security hole which has been closed by the security update, you should consider using this automatic upgrade with configuration parameters as the following.
1352
1353 --------------------
1354 APT::Periodic::Update-Package-Lists "1";
1355 APT::Periodic::Download-Upgradeable-Packages "1";
1356 APT::Periodic::Unattended-Upgrade "1";
1357 --------------------
1358
1359 If you are running an `unstable` system, you do not want to use the automatic upgrade since it certainly breaks system some day. Even for such `unstable` case, you may still want to download packages in advance to save time for the interactive upgrade with configuration parameters as the following.
1360
1361 --------------------
1362 APT::Periodic::Update-Package-Lists "1";
1363 APT::Periodic::Download-Upgradeable-Packages "1";
1364 APT::Periodic::Unattended-Upgrade "0";
1365 --------------------
1366
1367 // I changed mind. Maybe curent one is good enough.
1368 // {i} With an improved "/etc/cron.daily/apt" file (see [http://bugs.debian.org/478904]),
1369 // you can safely mark "Option -> Preferences -> [X] Remove obsolete package files
1370 // after downloading new package lists" in aptitude(8) while creating a file
1371 // with "APT::Periodic::BackupArchiveInterval=2;" in "/etc/apt/apt.conf.d/".
1372
1373
1374 ==== Limiting download bandwidth for APT
1375
1376 If you want to limit the download bandwidth for APT to e.g. 800Kib/sec (=100kiB/sec), you should configure APT with its configuration parameter as the following.
1377
1378 --------------------
1379 APT::Acquire::http::Dl-Limit "800";
1380 --------------------
1381
1382 ==== Emergency downgrading
1383
1384 CAUTION: Downgrading is not officially supported by the Debian by design. It should be done only as a part of emergency recovery process. Despite of this situation, it is known to work well in many incidents. For critical systems, You should backup all important data on the system after the recovery operation and re-install the new system from the scratch.
1385
1386 You may be lucky to downgrade from newer archive to older archive to recover from broken system upgrade by manipulating **candidate version** (see <<_tweaking_candidate_version>>). This is lazy alternative to tedious actions of many "`dpkg -i <broken-package>@@@ul@@@<old-version>.deb`" commands (see <<_rescue_with_the_dpkg_command>>).
1387
1388 Search lines in the "`/etc/apt/sources.list`" file tracking `unstable` as the following.
1389
1390 --------------------
1391 deb http://ftp.us.debian.org/debian/ @-@codename-unstable@-@ main contrib non-free
1392 --------------------
1393
1394 Replace it with the following to track `testing`.
1395
1396 --------------------
1397 deb http://ftp.us.debian.org/debian/ @-@codename-testing@-@ main contrib non-free
1398 --------------------
1399
1400 Set the "`/etc/apt/preferences`" file as the following.
1401
1402 --------------------
1403 Package: *
1404 Pin: release a=testing
1405 Pin-Priority: 1010
1406 --------------------
1407
1408 Run "`apt-get dist-upgrade`" to force downgrading of packages across the system.
1409
1410 Remove this special "`/etc/apt/preferences`" file after this emergency downgrading.
1411
1412 TIP: It is good idea to remove (not purge!) as much packages to minimize dependency problems. You may need to manually remove and install some packages to get system downgraded. Linux kernel, bootloader, udev, PAM, APT, and networking related packages and their configuration files require special attention.
1413
1414 ==== Who uploaded the package?
1415
1416 Although the maintainer name listed in "`/var/lib/dpkg/available`" and "`/usr/share/doc/package_name/changelog`" provide some information on "who is behind the packaging activity", the actual uploader of the package is somewhat obscure. `who-uploads`(1) in the `devscripts` package identifies the actual uploader of Debian source packages.
1417
1418 ==== The equivs package
1419
1420 If you are to compile a program from source to replace the Debian package, it is best to make it into a real local debianized package (`\*.deb`) and use private archive.
1421
1422 If you chose to compile a program from source and to install them under "`/usr/local`" instead, you may need to use `equivs` as a last resort to satisfy the missing package dependency.
1423
1424 --------------------
1425 Package: equivs
1426 Priority: extra
1427 Section: admin
1428 Description: Circumventing Debian package dependencies
1429 This is a dummy package which can be used to create Debian
1430 packages, which only contain dependency information.
1431 --------------------
1432
1433 ==== Porting a package to the stable system
1434
1435 For partial upgrades of the `stable` system, rebuilding a package within its environment using the source package is desirable. This avoids massive package upgrades due to their dependencies.
1436
1437 Add the following entries to the "`/etc/apt/sources.list`" of a `stable` system.
1438
1439 --------------------
1440 deb-src http://http.us.debian.org/debian unstable main contrib non-free
1441 --------------------
1442
1443 Install required packages for the compilation and download the source package as the following.
1444
1445 --------------------
1446 # apt-get update
1447 # apt-get dist-upgrade
1448 # apt-get install fakeroot devscripts build-essential
1449 $ apt-get build-dep foo
1450 $ apt-get source foo
1451 $ cd foo*
1452 --------------------
1453
1454 Adjust installed packages if needed.
1455
1456 Execute the following.
1457
1458 --------------------
1459 $ dch -i
1460 --------------------
1461
1462 Bump package version, e.g. one appended with "`+bp1`" in "`debian/changelog`"
1463
1464 Build packages and install them to the system as the following.
1465
1466 --------------------
1467 $ debuild
1468 $ cd ..
1469 # debi foo*.changes
1470 --------------------
1471
1472 ==== Proxy server for APT
1473
1474 Since mirroring whole subsection of Debian archive wastes disk space and network bandwidth, deployment of a local proxy server for APT is desirable consideration when you administer many systems on http://en.wikipedia.org/wiki/Local_area_network[LAN]. APT can be configure to use generic web (http) proxy servers such as `squid` (see <<_other_network_application_servers>>) as described in `apt.conf`(5) and in "`/usr/share/doc/apt/examples/configure-index.gz`". The "`$http_proxy`" environment variable can be used to override proxy server setting in the "`/etc/apt/apt.conf`" file.
1475
1476 There are proxy tools specially for Debian archive. You should check BTS before using them.
1477
1478 .List of the proxy tools specially for Debian archive
1479 [grid="all"]
1480 `---------------`-------------`------------`----------------------------------------------------------------------------------------------
1481 package popcon size description
1482 ------------------------------------------------------------------------------------------------------------------------------------------
1483 `approx` @-@popcon1@-@ @-@psize1@-@ caching proxy server for Debian archive files (compiled http://en.wikipedia.org/wiki/Objective_Caml[OCaml] program)
1484 `apt-proxy` @-@popcon1@-@ @-@psize1@-@ Debian archive proxy and partial mirror builder (Python program)
1485 `apt-cacher` @-@popcon1@-@ @-@psize1@-@ Caching proxy for Debian package and source files (Perl program)
1486 `apt-cacher-ng` @-@popcon1@-@ @-@psize1@-@ Caching proxy for distribution of software packages (compiled C++ program)
1487 `debtorrent` @-@popcon1@-@ @-@psize1@-@ Bittorrent proxy for downloading Debian packages (Python program)
1488 ------------------------------------------------------------------------------------------------------------------------------------------
1489
1490 CAUTION: When Debian reorganizes its archive structure, these specialized proxy tools tend to require code rewrites by the package maintainer and may not be functional for a while. On the other hand, generic web (http) proxy servers are more robust and easier to cope with such changes.
1491
1492 ==== Small public package archive
1493
1494 // Check out : http://people.connexer.com/~roberto/howtos/debrepository
1495
1496 Here is an example for creating a small public package archive compatible with the modern **secure APT** system (see <<_top_level_release_file_and_authenticity>>). Let@@@sq@@@s assume few things.
1497
1498 - Account name: "`foo`"
1499 - Host name: "`www.example.com`"
1500 - Required packages: `apt-utils`, `gnupg`, and other packages
1501 - URL: "`http://www.example.com/\~foo/`" ( -> "`/home/foo/public_html/index.html`")
1502 - Architecture of packages: "`amd64`"
1503
1504 Create an APT archive key of Foo on your server system as the following.
1505
1506 --------------------
1507 $ ssh foo@www.example.com
1508 $ gpg --gen-key
1509 ...
1510 $ gpg -K
1511 ...
1512 sec 1024D/3A3CB5A6 2008-08-14
1513 uid Foo (ARCHIVE KEY) <foo@www.example.com>
1514 ssb 2048g/6856F4A7 2008-08-14
1515 $ gpg --export -a 3A3CB5A6 >foo.public.key
1516 --------------------
1517
1518 Publish the archive key file "`foo.public.key`" with the key ID "`3A3CB5A6`" for Foo
1519
1520 Create an archive tree called "Origin: Foo" as the following.
1521
1522 --------------------
1523 $ umask 022
1524 $ mkdir -p ~/public_html/debian/pool/main
1525 $ mkdir -p ~/public_html/debian/dists/unstable/main/binary-amd64
1526 $ mkdir -p ~/public_html/debian/dists/unstable/main/source
1527 $ cd ~/public_html/debian
1528 $ cat > dists/unstable/main/binary-amd64/Release << EOF
1529 Archive: unstable
1530 Version: 4.0
1531 Component: main
1532 Origin: Foo
1533 Label: Foo
1534 Architecture: amd64
1535 EOF
1536 $ cat > dists/unstable/main/source/Release << EOF
1537 Archive: unstable
1538 Version: 4.0
1539 Component: main
1540 Origin: Foo
1541 Label: Foo
1542 Architecture: source
1543 EOF
1544 $ cat >aptftp.conf <<EOF
1545 APT::FTPArchive::Release {
1546 Origin "Foo";
1547 Label "Foo";
1548 Suite "unstable";
1549 Codename "sid";
1550 Architectures "amd64";
1551 Components "main";
1552 Description "Public archive for Foo";
1553 };
1554 EOF
1555 $ cat >aptgenerate.conf <<EOF
1556 Dir::ArchiveDir ".";
1557 Dir::CacheDir ".";
1558 TreeDefault::Directory "pool/";
1559 TreeDefault::SrcDirectory "pool/";
1560 Default::Packages::Extensions ".deb";
1561 Default::Packages::Compress ". gzip bzip2";
1562 Default::Sources::Compress "gzip bzip2";
1563 Default::Contents::Compress "gzip bzip2";
1564
1565 BinDirectory "dists/unstable/main/binary-amd64" {
1566 Packages "dists/unstable/main/binary-amd64/Packages";
1567 Contents "dists/unstable/Contents-amd64";
1568 SrcPackages "dists/unstable/main/source/Sources";
1569 };
1570
1571 Tree "dists/unstable" {
1572 Sections "main";
1573 Architectures "amd64 source";
1574 };
1575 EOF
1576 --------------------
1577
1578 You can automate repetitive updates of APT archive contents on your server system by configuring `dupload`.
1579
1580 Place all package files into "`\~foo/public_html/debian/pool/main/`" by executing "`dupload -t foo changes_file`" in client while having "`\~/.dupload.conf`" containing the following.
1581
1582 --------------------
1583 $cfg{'foo'} = {
1584 fqdn => "www.example.com",
1585 method => "scpb",
1586 incoming => "/home/foo/public_html/debian/pool/main",
1587 # The dinstall on ftp-master sends emails itself
1588 dinstall_runs => 1,
1589 };
1590
1591 $cfg{'foo'}{postupload}{'changes'} = "
1592 echo 'cd public_html/debian ;
1593 apt-ftparchive generate -c=aptftp.conf aptgenerate.conf;
1594 apt-ftparchive release -c=aptftp.conf dists/unstable >dists/unstable/Release ;
1595 rm -f dists/unstable/Release.gpg ;
1596 gpg -u 3A3CB5A6 -bao dists/unstable/Release.gpg dists/unstable/Release'|
1597 ssh foo@www.example.com 2>/dev/null ;
1598 echo 'Package archive created!'";
1599 --------------------
1600
1601 The **postupload** hook script initiated by `dupload`(1) creates updated archive files for each upload.
1602
1603 You can add this small public archive to the apt-line of your client system by the following.
1604
1605 --------------------
1606 $ sudo bash
1607 # echo "deb http://www.example.com/~foo/debian/ unstable main" \
1608 >> /etc/apt/sources.list
1609 # apt-key add foo.public.key
1610 --------------------
1611
1612 TIP: If the archive is located on the local filesystem, you can use "`deb file:/@@@slash@@@/home/foo/debian/ ...`" instead.
1613
1614 ==== Recording and copying system configuration
1615
1616 You can make a local copy of the package and debconf selection states by the following.
1617
1618 --------------------
1619 # dpkg --get-selections '*' > selection.dpkg
1620 # debconf-get-selections > selection.debconf
1621 --------------------
1622
1623 Here, "`\*`" makes "`selection.dpkg`" to include package entries for "purge" too.
1624
1625 You can transfer these 2 files to another computer, and install there with the following.
1626
1627 --------------------
1628 # dselect update
1629 # debconf-set-selections < myselection.debconf
1630 # dpkg --set-selections < myselection.dpkg
1631 # apt-get -u dselect-upgrade # or dselect install
1632 --------------------
1633
1634 If you are thinking about managing many servers in a cluster with practically the same configuration, you should consider to use specialized package such as `fai` to manage the whole system.
1635
1636 ==== Converting or installing an alien binary package
1637
1638 `alien`(1) enables the conversion of binary packages provided in Red Hat `rpm`, Stampede `slp`, Slackware `tgz`, and Solaris `pkg` file formats into a Debian `deb` package. If you want to use a package from another Linux distribution than the one you have installed on your system, you can use `alien` to convert it from your preferred package format and install it. `alien` also supports LSB packages.
1639
1640 WARNING: `alien`(1) should not be used to replace essential system packages, such as `sysvinit`, `libc6`, `libpam-modules`, etc. Practically, `alien`(1) should only used for **non-free** binary-only packages which are LSB compliant or statically linked. For free softwares, you should use their source packages to make real Debian packages.
1641
1642 ==== Extracting package without dpkg
1643
1644 The current "`\*.deb`" package contents can be extracted without using `dpkg`(1) on any http://en.wikipedia.org/wiki/Unix-like[Unix-like] environment using standard `ar`(1) and `tar`(1).
1645
1646 --------------------
1647 # ar x /path/to/dpkg_<version>_<arch>.deb
1648 # ls
1649 total 24
1650 -rw-r--r-- 1 bozo bozo 1320 2007-05-07 00:11 control.tar.gz
1651 -rw-r--r-- 1 bozo bozo 12837 2007-05-07 00:11 data.tar.gz
1652 -rw-r--r-- 1 bozo bozo 4 2007-05-07 00:11 debian-binary
1653 # mkdir control
1654 # mkdir data
1655 # tar xvzf control.tar.gz -C control
1656 # tar xvzf data.tar.gz -C data
1657 --------------------
1658
1659 You can also browse package content using the `mc` command.
1660
1661 ==== More readings for the package management
1662
1663 You can learn more on the package management from following documentations.
1664
1665 - Primary documentations on the package management:
1666 * `aptitude`(8), `dpkg`(1), `tasksel`(8), `apt-get`(8), `apt-config`(8), `apt-key`(8), `sources.list`(5), `apt.conf`(5), and `apt_preferences`(5);
1667 * "`/usr/share/doc/apt-doc/guide.html/index.html`" and "`/usr/share/doc/apt-doc/offline.html/index.html`" from the `apt-doc` package; and
1668 * "`/usr/share/doc/aptitude/html/en/index.html`" from the `aptitude-doc-en` package.
1669 - Official and detailed documentations on the Debian archive:
1670 * http://www.debian.org/doc/debian-policy/ch-archive["Debian Policy Manual Chapter 2 - The Debian Archive"],
1671 * http://www.debian.org/doc/manuals/developers-reference/resources.html#archive["Debian Developer@@@sq@@@s Reference, Chapter 4 - Resources for Debian Developers 4.6 The Debian archive"], and
1672 * http://www.debian.org/doc/FAQ/ch-ftparchives["The Debian GNU/Linux FAQ, Chapter 5 - The Debian FTP archives"].
1673 - Tutorial for building of a Debian package for Debian users:
1674 * http://www.debian.org/doc/manuals/maint-guide/["Debian New Maintainers' Guide"].
1675
1676 // APT HOWTO REMOVED FROM LENNY
1677 // * [http://www.debian.org/doc/manuals/apt-howto/ APT HOWTO]. (A very nice introduction for the user.)
1678

  ViewVC Help
Powered by ViewVC 1.1.5