old-www/LDP/www.debian.org/doc/manuals/debian-reference/ch02.en.html

4128 lines
229 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 2. Debian package management</title>
<link rel="stylesheet" href="debian-reference.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.en.html" title="Debian Reference">
<link rel="up" href="index.en.html" title="Debian Reference">
<link rel="prev" href="ch01.en.html" title="Chapter 1. GNU/Linux tutorials">
<link rel="next" href="ch03.en.html" title="Chapter 3. The system initialization">
<link rel="preface" href="pr01.en.html" title="Preface">
<link rel="chapter" href="ch01.en.html" title="Chapter 1. GNU/Linux tutorials">
<link rel="chapter" href="ch02.en.html" title="Chapter 2. Debian package management">
<link rel="chapter" href="ch03.en.html" title="Chapter 3. The system initialization">
<link rel="chapter" href="ch04.en.html" title="Chapter 4. Authentication">
<link rel="chapter" href="ch05.en.html" title="Chapter 5. Network setup">
<link rel="chapter" href="ch06.en.html" title="Chapter 6. Network applications">
<link rel="chapter" href="ch07.en.html" title="Chapter 7. The X Window System">
<link rel="chapter" href="ch08.en.html" title="Chapter 8. I18N and L10N">
<link rel="chapter" href="ch09.en.html" title="Chapter 9. System tips">
<link rel="chapter" href="ch10.en.html" title="Chapter 10. Data management">
<link rel="chapter" href="ch11.en.html" title="Chapter 11. Data conversion">
<link rel="chapter" href="ch12.en.html" title="Chapter 12. Programming">
<link rel="appendix" href="apa.en.html" title="Appendix A. Appendix">
<link rel="section" href="ch02.en.html#_debian_package_management_prerequisites" title="2.1. Debian package management prerequisites">
<link rel="section" href="ch02.en.html#_basic_package_management_operations" title="2.2. Basic package management operations">
<link rel="section" href="ch02.en.html#_examples_of_aptitude_operations" title="2.3. Examples of aptitude operations">
<link rel="section" href="ch02.en.html#_advanced_package_management_operations" title="2.4. Advanced package management operations">
<link rel="section" href="ch02.en.html#_debian_package_management_internals" title="2.5. Debian package management internals">
<link rel="section" href="ch02.en.html#_recovery_from_a_broken_system" title="2.6. Recovery from a broken system">
<link rel="section" href="ch02.en.html#_tips_for_the_package_management" title="2.7. Tips for the package management">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Chapter 2. Debian package management</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="ch01.en.html"><img src="images/prev.gif" alt="Prev"></a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="ch03.en.html"><img src="images/next.gif" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="_debian_package_management"></a>Chapter 2. Debian package management</h2></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="section"><a href="ch02.en.html#_debian_package_management_prerequisites">2.1. Debian package management prerequisites</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch02.en.html#_package_configuration">2.1.1. Package configuration</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_basic_precautions">2.1.2. Basic precautions</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_life_with_eternal_upgrades">2.1.3. Life with eternal upgrades</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_debian_archive_basics">2.1.4. Debian archive basics</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_package_dependencies">2.1.5. Package dependencies</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_event_flow_of_the_package_management">2.1.6. The event flow of the package management</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_first_response_to_package_management_troubles">2.1.7. First response to package management troubles</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch02.en.html#_basic_package_management_operations">2.2. Basic package management operations</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch02.en.html#_literal_apt_get_literal_literal_apt_cache_literal_vs_literal_aptitude_literal">2.2.1. <code class="literal">apt-get</code> / <code class="literal">apt-cache</code> vs. <code class="literal">aptitude</code></a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_basic_package_management_operations_with_the_commandline">2.2.2. Basic package management operations with the commandline</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_interactive_use_of_aptitude">2.2.3. Interactive use of aptitude</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_key_bindings_of_aptitude">2.2.4. Key bindings of aptitude</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_package_views_under_aptitude">2.2.5. Package views under aptitude</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_search_method_options_with_aptitude">2.2.6. Search method options with aptitude</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_aptitude_regex_formula">2.2.7. The aptitude regex formula</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_dependency_resolution_of_aptitude">2.2.8. Dependency resolution of aptitude</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_package_activity_logs">2.2.9. Package activity logs</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch02.en.html#_examples_of_aptitude_operations">2.3. Examples of aptitude operations</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch02.en.html#_listing_packages_with_regex_matching_on_package_names">2.3.1. Listing packages with regex matching on package names</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_browsing_with_the_regex_matching">2.3.2. Browsing with the regex matching</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_purging_removed_packages_for_good">2.3.3. Purging removed packages for good</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_tidying_auto_manual_install_status">2.3.4. Tidying auto/manual install status</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_system_wide_upgrade">2.3.5. System wide upgrade</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch02.en.html#_advanced_package_management_operations">2.4. Advanced package management operations</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch02.en.html#_advanced_package_management_operations_with_commandline">2.4.1. Advanced package management operations with commandline</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_verification_of_installed_package_files">2.4.2. Verification of installed package files</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_safeguarding_for_package_problems">2.4.3. Safeguarding for package problems</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_searching_on_the_package_meta_data">2.4.4. Searching on the package meta data</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch02.en.html#_debian_package_management_internals">2.5. Debian package management internals</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch02.en.html#_archive_meta_data">2.5.1. Archive meta data</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_top_level_release_file_and_authenticity">2.5.2. Top level "Release" file and authenticity</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_archive_level_release_files">2.5.3. Archive level "Release" files</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_fetching_of_the_meta_data_for_the_package">2.5.4. Fetching of the meta data for the package</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_package_state_for_apt">2.5.5. The package state for APT</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_package_state_for_aptitude">2.5.6. The package state for aptitude</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_local_copies_of_the_fetched_packages">2.5.7. Local copies of the fetched packages</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_debian_package_file_names">2.5.8. Debian package file names</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_dpkg_command">2.5.9. The dpkg command</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_update_alternative_command">2.5.10. The update-alternative command</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_dpkg_statoverride_command">2.5.11. The dpkg-statoverride command</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_dpkg_divert_command">2.5.12. The dpkg-divert command</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch02.en.html#_recovery_from_a_broken_system">2.6. Recovery from a broken system</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch02.en.html#_incompatibility_with_old_user_configuration">2.6.1. Incompatibility with old user configuration</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_different_packages_with_overlapped_files">2.6.2. Different packages with overlapped files</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_fixing_broken_package_script">2.6.3. Fixing broken package script</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_rescue_with_the_dpkg_command">2.6.4. Rescue with the dpkg command</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_recovering_package_selection_data">2.6.5. Recovering package selection data</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch02.en.html#_tips_for_the_package_management">2.7. Tips for the package management</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch02.en.html#_how_to_pick_debian_packages">2.7.1. How to pick Debian packages</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_packages_from_mixed_source_of_archives">2.7.2. Packages from mixed source of archives</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_tweaking_candidate_version">2.7.3. Tweaking candidate version</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_updates_and_backports">2.7.4. Updates and Backports</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_blocking_packages_installed_by_recommends">2.7.5. Blocking packages installed by "Recommends"</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_tracking_literal_testing_literal_with_some_packages_from_literal_unstable_literal">2.7.6. Tracking <code class="literal">testing</code> with some packages from <code class="literal">unstable</code></a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_tracking_literal_unstable_literal_with_some_packages_from_literal_experimental_literal">2.7.7. Tracking <code class="literal">unstable</code> with some packages from <code class="literal">experimental</code></a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_automatic_download_and_upgrade_of_packages">2.7.8. Automatic download and upgrade of packages</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_limiting_download_bandwidth_for_apt">2.7.9. Limiting download bandwidth for APT</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_emergency_downgrading">2.7.10. Emergency downgrading</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_who_uploaded_the_package">2.7.11. Who uploaded the package?</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_the_equivs_package">2.7.12. The equivs package</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_porting_a_package_to_the_stable_system">2.7.13. Porting a package to the stable system</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_proxy_server_for_apt">2.7.14. Proxy server for APT</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_small_public_package_archive">2.7.15. Small public package archive</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_recording_and_copying_system_configuration">2.7.16. Recording and copying system configuration</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_converting_or_installing_an_alien_binary_package">2.7.17. Converting or installing an alien binary package</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_extracting_package_without_dpkg">2.7.18. Extracting package without dpkg</a></span></dt>
<dt><span class="section"><a href="ch02.en.html#_more_readings_for_the_package_management">2.7.19. More readings for the package management</a></span></dt>
</dl></dd>
</dl>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This chapter is written assuming the latest stable release is codename: <code class="literal">squeeze</code>.</p></td></tr>
</table></div>
<p><a class="ulink" href="http://www.debian.org" target="_top">Debian</a> is a volunteer organization which builds <span class="strong"><strong>consistent</strong></span> distributions of pre-compiled binary packages of free software and distributes them from its archive.</p>
<p><a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">The Debian archive</a> is offered by <a class="ulink" href="http://www.debian.org/mirror/" target="_top">many remote mirror sites</a> for access through HTTP and FTP methods. It is also available as <a class="ulink" href="http://www.debian.org/CD/" target="_top">CD-ROM/DVD</a>.</p>
<p>The Debian package management system, <span class="strong"><strong>when used properly</strong></span>, offers the user to install <span class="strong"><strong>consistent sets of binary packages</strong></span> to the system from the archive. Currently, there are 37617 packages available for the amd64 architecture.</p>
<p>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 the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">apt-get</span>(8)</span> for all commandline operations, including package installation and removal, and dist-upgrades.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span> for an interactive text interface to manage the installed packages and to search the available packages.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">update-manager</span>(8)</span> for keeping your system up-to-date if you're running the default GNOME desktop.
</p></li>
</ul></div>
<div class="table">
<a name="listofdebianpackemanagementtools"></a><p class="title"><b>Table 2.1. List of Debian package management tools</b></p>
<div class="table-contents"><table summary="List of Debian package management tools" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apt" target="_top">
<code class="literal">apt</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apt" target="_top">http://qa.debian.org/popcon.php?package=apt</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apt.html" target="_top">3072</a></td>
<td align="left">
Advanced Packaging Tool (APT), front-end for <code class="literal">dpkg</code> providing "<code class="literal">http</code>", "<code class="literal">ftp</code>", and "<code class="literal">file</code>" archive access methods (<code class="literal">apt-get</code>/<code class="literal">apt-cache</code> commands included)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/aptitude" target="_top">
<code class="literal">aptitude</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=aptitude" target="_top">http://qa.debian.org/popcon.php?package=aptitude</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/aptitude.html" target="_top">12575</a></td>
<td align="left">
interactive terminal-based package manager with <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/update-manager-gnome" target="_top">
<code class="literal">update-manager-gnome</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=update-manager-gnome" target="_top">http://qa.debian.org/popcon.php?package=update-manager-gnome</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/u/update-manager-gnome.html" target="_top">1266</a></td>
<td align="left">
GNOME application that manages software updates with <span class="citerefentry"><span class="refentrytitle">update-manager</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/tasksel" target="_top">
<code class="literal">tasksel</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=tasksel" target="_top">http://qa.debian.org/popcon.php?package=tasksel</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/t/tasksel.html" target="_top">188</a></td>
<td align="left">
tool for selecting tasks for installation on Debian system (front-end for APT)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/unattended-upgrades" target="_top">
<code class="literal">unattended-upgrades</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=unattended-upgrades" target="_top">http://qa.debian.org/popcon.php?package=unattended-upgrades</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/u/unattended-upgrades.html" target="_top">252</a></td>
<td align="left">
enhancement package for APT to enable automatic installation of security upgrades
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/dselect" target="_top">
<code class="literal">dselect</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=dselect" target="_top">http://qa.debian.org/popcon.php?package=dselect</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/dselect.html" target="_top">2376</a></td>
<td align="left">
terminal-based package manager (previous standard, front-end for APT and other old access methods)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/dpkg" target="_top">
<code class="literal">dpkg</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=dpkg" target="_top">http://qa.debian.org/popcon.php?package=dpkg</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/dpkg.html" target="_top">5824</a></td>
<td align="left">
package management system for Debian
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/synaptic" target="_top">
<code class="literal">synaptic</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=synaptic" target="_top">http://qa.debian.org/popcon.php?package=synaptic</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/synaptic.html" target="_top">7620</a></td>
<td align="left">
graphical package manager (GNOME front-end for APT)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apt-utils" target="_top">
<code class="literal">apt-utils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apt-utils" target="_top">http://qa.debian.org/popcon.php?package=apt-utils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apt-utils.html" target="_top">1275</a></td>
<td align="left">
APT utility programs: <span class="citerefentry"><span class="refentrytitle">apt-extracttemplates</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">apt-ftparchive</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">apt-sortpkgs</span>(1)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apt-listchanges" target="_top">
<code class="literal">apt-listchanges</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apt-listchanges" target="_top">http://qa.debian.org/popcon.php?package=apt-listchanges</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apt-listchanges.html" target="_top">202</a></td>
<td align="left">
package change history notification tool
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apt-listbugs" target="_top">
<code class="literal">apt-listbugs</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apt-listbugs" target="_top">http://qa.debian.org/popcon.php?package=apt-listbugs</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apt-listbugs.html" target="_top">370</a></td>
<td align="left">
lists critical bugs before each APT installation
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apt-file" target="_top">
<code class="literal">apt-file</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apt-file" target="_top">http://qa.debian.org/popcon.php?package=apt-file</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apt-file.html" target="_top">120</a></td>
<td align="left">
APT package searching utility — command-line interface
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apt-rdepends" target="_top">
<code class="literal">apt-rdepends</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apt-rdepends" target="_top">http://qa.debian.org/popcon.php?package=apt-rdepends</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apt-rdepends.html" target="_top">80</a></td>
<td align="left">
recursively lists package dependencies
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_debian_package_management_prerequisites"></a>2.1. Debian package management prerequisites</h2></div></div></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_package_configuration"></a>2.1.1. Package configuration</h3></div></div></div>
<p>Here are some key points for package configuration on the Debian system.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
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.
</p></li>
<li class="listitem"><p>
Each package comes with its own configuration script with standardized user interface called <span class="citerefentry"><span class="refentrytitle">debconf</span>(7)</span> to help initial installation process of the package.
</p></li>
<li class="listitem"><p>
Debian Developers try their best to make your upgrade experience flawless with package configuration scripts.
</p></li>
<li class="listitem"><p>
Full functionalities of packaged software are available to the system administrator. But ones with security risks are disabled in the default installation.
</p></li>
<li class="listitem"><p>
If you manually activate a service with some security risks, you are responsible for the risk containment.
</p></li>
<li class="listitem"><p>
Esoteric configuration may be manually enabled by the system administrator. This may creates interference with popular generic helper programs for the system configuration.
</p></li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_basic_precautions"></a>2.1.2. Basic precautions</h3></div></div></div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>Do not install packages from random mixture of suites. It probably breaks the package consistency which requires deep system management knowledge, such as compiler <a class="ulink" href="http://en.wikipedia.org/wiki/Application_binary_interface" target="_top">ABI</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Library_(computing)" target="_top">library</a> version, interpreter features, etc.</p></td></tr>
</table></div>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Newbie" target="_top">newbie</a> Debian system administrator should stay with the <span class="strong"><strong><code class="literal">stable</code></strong></span> 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.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Do not include <span class="strong"><strong><code class="literal">testing</code></strong></span> or <span class="strong"><strong><code class="literal">unstable</code></strong></span> in "<code class="literal">/etc/apt/sources.list</code>".
</p></li>
<li class="listitem"><p>
Do not mix standard Debian with other non-Debian archives such as Ubuntu in "<code class="literal">/etc/apt/sources.list</code>".
</p></li>
<li class="listitem"><p>
Do not create "<code class="literal">/etc/apt/preferences</code>".
</p></li>
<li class="listitem"><p>
Do not change default behavior of package management tools through configuration files without knowing their full impacts.
</p></li>
<li class="listitem"><p>
Do not install random packages by "<code class="literal">dpkg -i &lt;random_package&gt;</code>".
</p></li>
<li class="listitem"><p>
Do not ever install random packages by "<code class="literal">dpkg --force-all -i &lt;random_package&gt;</code>".
</p></li>
<li class="listitem"><p>
Do not erase or alter files in "<code class="literal">/var/lib/dpkg/</code>".
</p></li>
<li class="listitem">
<p>
Do not overwrite system files by installing software programs directly compiled from source.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
Install them into "<code class="literal">/usr/local</code>" or "<code class="literal">/opt</code>", if needed.
</p></li></ul></div>
</li>
</ul></div>
<p>The non-compatible effects caused by above actions to the Debian package management system may leave your system unusable.</p>
<p>The serious Debian system administrator who runs mission critical servers, should use extra precautions.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p>
Do not install any packages including security updates from Debian without thoroughly testing them with your particular configuration under safe conditions.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
You as the system administrator are responsible for your system in the end.
</p></li>
<li class="listitem"><p>
The long stability history of Debian system is no guarantee by itself.
</p></li>
</ul></div>
</li></ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_life_with_eternal_upgrades"></a>2.1.3. Life with eternal upgrades</h3></div></div></div>
<p>Despite my warnings above, I know many readers of this document wish to run the <code class="literal">testing</code> or <code class="literal">unstable</code> suites of Debian as their main system for <span class="strong"><strong>self-administered Desktop environments</strong></span>. This is because they work very well, are updated frequently, and offer the latest features.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>For your <span class="strong"><strong>production server</strong></span>, the <code class="literal">stable</code> 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's PC.</p></td></tr>
</table></div>
<p>It takes no more than simply setting the distribution string in the "<code class="literal">/etc/apt/sources.list</code>" to the suite name: "<code class="literal">testing</code>" or "<code class="literal">unstable</code>"; or the codename: "<code class="literal">wheezy</code>" or "<code class="literal">sid</code>". This makes you live <span class="strong"><strong>the life of eternal upgrades</strong></span>.</p>
<p>The use of <code class="literal">testing</code> or <code class="literal">unstable</code> is <span class="strong"><strong>a lot of fun</strong></span> but comes with some risks. Even though the <code class="literal">unstable</code> suite of Debian system looks very stable for most of the times, there have been some package problems on the <code class="literal">testing</code> and <code class="literal">unstable</code> suite of Debian system and a few of them were not so trivial to resolve. It may be <span class="strong"><strong>quite painful</strong></span> for you. Sometimes, you may have a broken package or missing functionality for a few weeks.</p>
<p>Here are some ideas to ensure quick and easy recovery from bugs in Debian packages.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Make the system <span class="strong"><strong>dual bootable</strong></span> by installing the <code class="literal">stable</code> suite of Debian system to another partition
</p></li>
<li class="listitem"><p>
Make the installation CD handy for the <span class="strong"><strong>rescue boot</strong></span>
</p></li>
<li class="listitem"><p>
Consider installing <code class="literal">apt-listbugs</code> to check the <a class="ulink" href="http://www.debian.org/Bugs/" target="_top">Debian Bug Tracking System (BTS)</a> information before the upgrade
</p></li>
<li class="listitem"><p>
Learn the package system infrastructure enough to work around the problem
</p></li>
<li class="listitem"><p>
Create a chroot or similar environment and run the latest system in it in advance (see <a class="xref" href="ch09.en.html#_virtualized_system" title="9.8. Virtualized system">Section 9.8, “Virtualized system”</a>)
</p></li>
</ul></div>
<p>(If you can not do any one of these precautionary actions, you are probably not ready for the <code class="literal">testing</code> and <code class="literal">unstable</code> suites.)</p>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Bodhi" target="_top">Enlightenment</a> with the following saves a person from the eternal <a class="ulink" href="http://en.wikipedia.org/wiki/Karma" target="_top">karmic</a> struggle of upgrade <a class="ulink" href="http://en.wikipedia.org/wiki/Naraka" target="_top">hell</a> and let him reach Debian <a class="ulink" href="http://en.wikipedia.org/wiki/Nirvana" target="_top">nirvana</a>.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_debian_archive_basics"></a>2.1.4. Debian archive basics</h3></div></div></div>
<p>Let's look into <a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">the Debian archive</a> from a system user's perspective.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Official policy of the Debian archive is defined at <a class="ulink" href="http://www.debian.org/doc/debian-policy/ch-archive" target="_top">Debian Policy Manual, Chapter 2 - The Debian Archive</a>.</p></td></tr>
</table></div>
<p>For the typical HTTP access, the archive is specified in the "<code class="literal">/etc/apt/sources.list</code>" file as the following, e.g. for the current <code class="literal">stable</code> = <code class="literal">squeeze</code> system.</p>
<pre class="screen">deb http://ftp.XX.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.XX.debian.org/debian/ squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main contrib
deb-src http://security.debian.org/ squeeze/updates main contrib</pre>
<p>Please note "<code class="literal">ftp.XX.debian.org</code>" must be replaced with appropriate mirror site URL for your location, for USA "<code class="literal">ftp.us.debian.org</code>", which can be found in <a class="ulink" href="http://www.debian.org/mirror/list" target="_top">the list of Debian worldwide mirror sites</a>. The status of these servers can be checked at <a class="ulink" href="http://ftp.de.debian.org/dmc/" target="_top">Debian Mirror Checker site</a>.</p>
<p>Here, I tend to use codename "<code class="literal">squeeze</code>" instead of suite name "<code class="literal">stable</code>" to avoid surprises when the next <code class="literal">stable</code> is released.</p>
<p>The meaning of "<code class="literal">/etc/apt/sources.list</code>" is described in <span class="citerefentry"><span class="refentrytitle">sources.list</span>(5)</span> and key points are followings.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The "<code class="literal">deb</code>" line defines for the binary packages.
</p></li>
<li class="listitem"><p>
The "<code class="literal">deb-src</code>" line defines for the source packages.
</p></li>
<li class="listitem"><p>
The 1st argument is the root URL of the Debian archive.
</p></li>
<li class="listitem"><p>
The 2nd argument is the distribution name: either the suite name or the codename.
</p></li>
<li class="listitem"><p>
The 3rd and following arguments are the list of valid archive area names of the Debian archive.
</p></li>
</ul></div>
<p>The "<code class="literal">deb-src</code>" lines can safely be omitted (or commented out by placing "#" at the start of the line) if it is just for <code class="literal">aptitude</code> which does not access source related meta data. It speeds up the updates of the archive meta data. The URL can be "<code class="literal">http://</code>", "<code class="literal">ftp://</code>", "<code class="literal">file://</code>", ….</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>If "<code class="literal">sid</code>" is used in the above example instead of "<code class="literal">squeeze</code>", the "<code class="literal">deb: <a class="ulink" href="http://security.debian.org/" target="_top">http://security.debian.org/</a></code>" line for security updates in the "<code class="literal">/etc/apt/sources.list</code>" is not required. This is because there is no security update archive for "<code class="literal">sid</code>" (<code class="literal">unstable</code>).</p></td></tr>
</table></div>
<p>Here is the list of URL of the Debian archive sites and suite name or codename used in the configuration file.</p>
<div class="table">
<a name="listofdebianarchivesites"></a><p class="title"><b>Table 2.2. List of Debian archive sites</b></p>
<div class="table-contents"><table summary="List of Debian archive sites" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
archive URL
</th>
<th align="left">
suite name (codename)
</th>
<th align="left">
purpose
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">http://ftp.XX.debian.org/debian/</a>
</td>
<td align="left">
<code class="literal">stable</code> (<code class="literal">squeeze</code>)
</td>
<td align="left">
stable (squeeze) release
</td>
</tr>
<tr>
<td align="left">
<a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">http://ftp.XX.debian.org/debian/</a>
</td>
<td align="left">
<code class="literal">testing</code> (<code class="literal">wheezy</code>)
</td>
<td align="left">
testing (wheezy) release
</td>
</tr>
<tr>
<td align="left">
<a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">http://ftp.XX.debian.org/debian/</a>
</td>
<td align="left">
<code class="literal">unstable</code> (<code class="literal">sid</code>)
</td>
<td align="left">
unstable (sid) release
</td>
</tr>
<tr>
<td align="left">
<a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">http://ftp.XX.debian.org/debian/</a>
</td>
<td align="left">
<code class="literal">experimental</code>
</td>
<td align="left">
experimental pre-release (optional, only for developer)
</td>
</tr>
<tr>
<td align="left">
<a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">http://ftp.XX.debian.org/debian/</a>
</td>
<td align="left">
<code class="literal">stable-proposed-updates</code>
</td>
<td align="left">
Updates for the next stable point release (optional)
</td>
</tr>
<tr>
<td align="left">
<a class="ulink" href="http://security.debian.org/" target="_top">http://security.debian.org/</a>
</td>
<td align="left">
<code class="literal">stable/updates</code>
</td>
<td align="left">
security updates for stable release (important)
</td>
</tr>
<tr>
<td align="left">
<a class="ulink" href="http://security.debian.org/" target="_top">http://security.debian.org/</a>
</td>
<td align="left">
<code class="literal">testing/updates</code>
</td>
<td align="left">
security updates for testing release (important)
</td>
</tr>
<tr>
<td align="left">
<a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">http://ftp.XX.debian.org/debian/</a>
</td>
<td align="left">
<code class="literal">squeeze-updates</code>
</td>
<td align="left">
compatible updates for spam filter, IM clients, etc. for squeeze
</td>
</tr>
<tr>
<td align="left">
<a class="ulink" href="http://backports.debian.org/debian-backports/" target="_top">http://backports.debian.org/debian-backports/</a>
</td>
<td align="left">
<code class="literal">squeeze-backports</code>
</td>
<td align="left">
newer backported packages for squeeze (optional)
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Only pure <span class="strong"><strong><code class="literal">stable</code></strong></span> release with security updates provides the best stability. Running mostly <span class="strong"><strong><code class="literal">stable</code></strong></span> release mixed with some packages from <span class="strong"><strong><code class="literal">testing</code></strong></span> or <span class="strong"><strong><code class="literal">unstable</code></strong></span> release is riskier than running pure <span class="strong"><strong><code class="literal">unstable</code></strong></span> release for library version mismatch etc. If you really need the latest version of some programs under <span class="strong"><strong><code class="literal">stable</code></strong></span> release, please use packages from <a class="ulink" href="http://www.debian.org/News/2011/20110215" target="_top">squeeze-updates</a> and <a class="ulink" href="http://backports.debian.org" target="_top">http://backports.debian.org</a> (see <a class="xref" href="ch02.en.html#_updates_and_backports" title="2.7.4. Updates and Backports">Section 2.7.4, “Updates and Backports”</a>) services. These services must be used with extra care.</p></td></tr>
</table></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>You should basically list only one of <code class="literal">stable</code>, <code class="literal">testing</code>, or <code class="literal">unstable</code> suites in the "<code class="literal">deb</code>" line. If you list any combination of <code class="literal">stable</code>, <code class="literal">testing</code>, and <code class="literal">unstable</code> suites in the "<code class="literal">deb</code>" line, APT programs slow down while only the latest archive is effective. Multiple listing makes sense for these when the "<code class="literal">/etc/apt/preferences</code>" file is used with clear objectives (see <a class="xref" href="ch02.en.html#_tweaking_candidate_version" title="2.7.3. Tweaking candidate version">Section 2.7.3, “Tweaking candidate version”</a>).</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>For the Debian system with the <code class="literal">stable</code> and <code class="literal">testing</code> suites, it is a good idea to include lines with "<code class="literal">http://security.debian.org/</code>" in the "<code class="literal">/etc/apt/sources.list</code>" to enable security updates as in the example above.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>The security bugs for the <code class="literal">stable</code> archive are fixed by the Debian security team. This activity has been quite rigorous and reliable. Those for the <code class="literal">testing</code> archive may be fixed by the Debian testing security team. For <a class="ulink" href="http://lists.debian.org/debian-testing-security-announce/2008/12/msg00019.html" target="_top">several</a> <a class="ulink" href="http://lists.debian.org/debian-testing-security-announce/2010/01/msg00000.html" target="_top">reasons</a>, this activity is not as rigorous as that for <code class="literal">stable</code> and you may need to wait for the migration of fixed <code class="literal">unstable</code> packages. Those for the <code class="literal">unstable</code> archive are fixed by the individual maintainer. Actively maintained <code class="literal">unstable</code> packages are usually in a fairly good shape by leveraging latest upstream security fixes. See <a class="ulink" href="http://www.debian.org/security/faq" target="_top">Debian security FAQ</a> for how Debian handles security bugs.</p></td></tr>
</table></div>
<div class="table">
<a name="listofdebianarchivearea"></a><p class="title"><b>Table 2.3. List of Debian archive area</b></p>
<div class="table-contents"><table summary="List of Debian archive area" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
area
</th>
<th align="left">
number of packages
</th>
<th align="left">
criteria of package component
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">main</code>
</td>
<td align="left">
36909
</td>
<td align="left">
DFSG compliant and no dependency to <code class="literal">non-free</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">contrib</code>
</td>
<td align="left">
231
</td>
<td align="left">
DFSG compliant but having dependency to <code class="literal">non-free</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">non-free</code>
</td>
<td align="left">
477
</td>
<td align="left">
not DFSG compliant
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>Here the number of packages in the above is for the amd64 architecture. Strictly speaking, only the <code class="literal">main</code> area archive shall be considered as the Debian system.</p>
<p>The Debian archive organization can be studied best by pointing your browser to the each archive URL appended with <code class="literal">dists</code> or <code class="literal">pool</code>.</p>
<p>The distribution is referred by two ways, the suite or <a class="ulink" href="http://www.debian.org/doc/manuals/developers-reference/resources.html#codenames" target="_top">codename</a>. 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.</p>
<div class="table">
<a name="therelationshipbsuiteandcodename"></a><p class="title"><b>Table 2.4. The relationship between suite and codename</b></p>
<div class="table-contents"><table summary="The relationship between suite and codename" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
Timing
</th>
<th align="left">
suite = <code class="literal">stable</code>
</th>
<th align="left">
suite = <code class="literal">testing</code>
</th>
<th align="left">
suite = <code class="literal">unstable</code>
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
after the <code class="literal">squeeze</code> release
</td>
<td align="left">
codename = <code class="literal">squeeze</code>
</td>
<td align="left">
codename = <code class="literal">wheezy</code>
</td>
<td align="left">
codename = <code class="literal">sid</code>
</td>
</tr>
<tr>
<td align="left">
after the <code class="literal">wheezy</code> release
</td>
<td align="left">
codename = <code class="literal">wheezy</code>
</td>
<td align="left">
codename = <code class="literal">wheezy+1</code>
</td>
<td align="left">
codename = <code class="literal">sid</code>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>The history of codenames are described in <a class="ulink" href="http://www.debian.org/doc/manuals/debian-faq/ch-ftparchives#s-oldcodenames" target="_top">Debian FAQ: 6.3.1 Which other codenames have been used in the past?</a></p>
<p>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 area named as "main".)</p>
<p>Every time a new upload is done by the Debian developer (DD) to the <code class="literal">unstable</code> archive (via <a class="ulink" href="http://incoming.debian.org/" target="_top">incoming</a> processing), DD is required to ensure uploaded packages to be compatible with the latest set of packages in the latest <code class="literal">unstable</code> archive.</p>
<p>If DD breaks this compatibility intentionally for important library upgrade etc, there is usually announcement to <a class="ulink" href="http://lists.debian.org/debian-devel/" target="_top">the debian-devel mailing list</a> etc.</p>
<p>Before a set of packages are moved by the Debian archive maintenance script from the <code class="literal">unstable</code> archive to the <code class="literal">testing</code> 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 <code class="literal">testing</code> archive. This process makes the <code class="literal">testing</code> archive very current and usable.</p>
<p>Through the gradual archive freeze process led by the release team, the <code class="literal">testing</code> archive is matured to make it completely consistent and bug free with some manual interventions. Then the new <code class="literal">stable</code> release is created by assigning the codename for the old <code class="literal">testing</code> archive to the new <code class="literal">stable</code> archive and creating the new codename for the new <code class="literal">testing</code> archive. The initial contents of the new <code class="literal">testing</code> archive is exactly the same as that of the newly released <code class="literal">stable</code> archive.</p>
<p>Both the <code class="literal">unstable</code> and the <code class="literal">testing</code> archives may suffer temporary glitches due to several factors.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Broken package upload to the archive (mostly for <code class="literal">unstable</code>)
</p></li>
<li class="listitem"><p>
Delay of accepting the new packages to the archive (mostly for <code class="literal">unstable</code>)
</p></li>
<li class="listitem"><p>
Archive synchronization timing issue (both for <code class="literal">testing</code> and <code class="literal">unstable</code>)
</p></li>
<li class="listitem"><p>
Manual intervention to the archive such as package removal (more for <code class="literal">testing</code>) etc.
</p></li>
</ul></div>
<p>So if you ever decide to use these archives, you should be able to fix or work around these kinds of glitches.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>For about few months after a new <code class="literal">stable</code> release, most desktop users should use the <code class="literal">stable</code> archive with its security updates even if they usually use <code class="literal">unstable</code> or <code class="literal">testing</code> archives. For this transition period, both <code class="literal">unstable</code> and <code class="literal">testing</code> archives are not good for most people. Your system is difficult to keep in good working condition with the <code class="literal">unstable</code> archive since it suffers surges of major upgrades for core packages. The <code class="literal">testing</code> archive is not useful either since it contains mostly the same content as the <code class="literal">stable</code> archive without its security support (<a class="ulink" href="http://lists.debian.org/debian-testing-security-announce/2008/12/msg00019.html" target="_top">Debian testing-security-announce 2008-12</a>). After a month or so, the <code class="literal">unstable</code> archive may be usable if you are careful.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>When tracking the <code class="literal">testing</code> archive, a problem caused by a removed package is usually worked around by installing corresponding package from the <code class="literal">unstable</code> archive which is uploaded for bug fix.</p></td></tr>
</table></div>
<p>See <a class="ulink" href="http://www.debian.org/doc/debian-policy/" target="_top">Debian Policy Manual</a> for archive definitions.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
"<a class="ulink" href="http://www.debian.org/doc/debian-policy/ch-archive#s-subsections" target="_top">Sections</a>"
</p></li>
<li class="listitem"><p>
"<a class="ulink" href="http://www.debian.org/doc/debian-policy/ch-archive#s-priorities" target="_top">Priorities</a>"
</p></li>
<li class="listitem"><p>
"<a class="ulink" href="http://www.debian.org/doc/debian-policy/ch-binary#s3.7" target="_top">Base system</a>"
</p></li>
<li class="listitem"><p>
"<a class="ulink" href="http://www.debian.org/doc/debian-policy/ch-binary#s3.8" target="_top">Essential packages</a>"
</p></li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_package_dependencies"></a>2.1.5. Package dependencies</h3></div></div></div>
<p>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.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
"Depends"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
This declares an absolute dependency and all of the packages listed in this field must be installed at the same time or in advance.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
"Pre-Depends"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
This is like Depends, except that it requires completed installation of the listed packages in advance.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
"Recommends"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
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.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
"Suggests"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
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.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
"Enhances"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
This declares a week dependency like Suggests but works in the opposite direction.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
"Breaks"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
This declares a package incompatibility usually with some version specification. Generally the resolution is to upgrade all of the packages listed in this field.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
"Conflicts"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
This declares an absolute incompatibility. All of the packages listed in this field must be removed to install this package.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
"Replaces"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
This is declared when files installed by this package replace files in the listed packages.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
"Provides"
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
This is declared when this package provide all of the files and functionality in the listed packages.
</p></li></ul></div>
</li>
</ul></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
<p>The official definition including source dependency can be found in <a class="ulink" href="http://www.debian.org/doc/debian-policy/ch-relationships" target="_top">the Policy Manual: Chapter 7 - Declaring relationships between packages</a>.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_event_flow_of_the_package_management"></a>2.1.6. The event flow of the package management</h3></div></div></div>
<p>Here is a summary of the simplified event flow of the package management by APT.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p><span class="strong"><strong>Update</strong></span> ("<code class="literal">aptitude update</code>" or "<code class="literal">apt-get update</code>"):
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Fetch archive metadata from remote archive
</p></li>
<li class="listitem"><p>
Reconstruct and update local metadata for use by APT
</p></li>
</ol></div>
</li>
<li class="listitem">
<p><span class="strong"><strong>Upgrade</strong></span> ("<code class="literal">aptitude safe-upgrade</code>" and "<code class="literal">aptitude full-upgrade</code>", or "<code class="literal">apt-get upgrade</code>" and "<code class="literal">apt-get dist-upgrade</code>"):
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Chose candidate version which is usually the latest available version for all installed packages (see <a class="xref" href="ch02.en.html#_tweaking_candidate_version" title="2.7.3. Tweaking candidate version">Section 2.7.3, “Tweaking candidate version”</a> for exception)
</p></li>
<li class="listitem"><p>
Make package dependency resolution
</p></li>
<li class="listitem"><p>
Fetch selected binary packages from remote archive if candidate version is different from installed version
</p></li>
<li class="listitem"><p>
Unpack fetched binary packages
</p></li>
<li class="listitem"><p>
Run <span class="strong"><strong>preinst</strong></span> script
</p></li>
<li class="listitem"><p>
Install binary files
</p></li>
<li class="listitem"><p>
Run <span class="strong"><strong>postinst</strong></span> script
</p></li>
</ol></div>
</li>
<li class="listitem">
<p><span class="strong"><strong>Install</strong></span> ("<code class="literal">aptitude install …</code>" or "<code class="literal">apt-get install …</code>"):
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Chose packages listed on the command line
</p></li>
<li class="listitem"><p>
Make package dependency resolution
</p></li>
<li class="listitem"><p>
Fetch selected binary packages from remote archive
</p></li>
<li class="listitem"><p>
Unpack fetched binary packages
</p></li>
<li class="listitem"><p>
Run <span class="strong"><strong>preinst</strong></span> script
</p></li>
<li class="listitem"><p>
Install binary files
</p></li>
<li class="listitem"><p>
Run <span class="strong"><strong>postinst</strong></span> script
</p></li>
</ol></div>
</li>
<li class="listitem">
<p><span class="strong"><strong>Remove</strong></span> ("<code class="literal">aptitude remove …</code>" or "<code class="literal">apt-get remove …</code>"):
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Chose packages listed on the command line
</p></li>
<li class="listitem"><p>
Make package dependency resolution
</p></li>
<li class="listitem"><p>
Run <span class="strong"><strong>prerm</strong></span> script
</p></li>
<li class="listitem"><p>
Remove installed files <span class="strong"><strong>except</strong></span> configuration files
</p></li>
<li class="listitem"><p>
Run <span class="strong"><strong>postrm</strong></span> script
</p></li>
</ol></div>
</li>
<li class="listitem">
<p><span class="strong"><strong>Purge</strong></span> ("<code class="literal">aptitude purge …</code>" or "<code class="literal">apt-get purge …</code>"):
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Chose packages listed on the command line
</p></li>
<li class="listitem"><p>
Make package dependency resolution
</p></li>
<li class="listitem"><p>
Run <span class="strong"><strong>prerm</strong></span> script
</p></li>
<li class="listitem"><p>
Remove installed files <span class="strong"><strong>including</strong></span> configuration files
</p></li>
<li class="listitem"><p>
Run <span class="strong"><strong>postrm</strong></span> script
</p></li>
</ol></div>
</li>
</ul></div>
<p>Here, I intentionally skipped technical details for the sake of big picture.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_first_response_to_package_management_troubles"></a>2.1.7. First response to package management troubles</h3></div></div></div>
<p>You should read the fine official documentation. The first document to read is the Debian specific "<code class="literal">/usr/share/doc/&lt;package_name&gt;/README.Debian</code>". Other documentation in "<code class="literal">/usr/share/doc/&lt;package_name&gt;/</code>" should be consulted too. If you set shell as <a class="xref" href="ch01.en.html#_customizing_bash" title="1.4.2. Customizing bash">Section 1.4.2, “Customizing bash”</a>, type the following.</p>
<pre class="screen">$ cd &lt;package_name&gt;
$ pager README.Debian
$ mc</pre>
<p>You may need to install the corresponding documentation package named with "<code class="literal">-doc</code>" suffix for detailed information.</p>
<p>If you are experiencing problems with a specific package, make sure to check out <a class="ulink" href="http://bugs.debian.org/" target="_top">the Debian bug tracking system (BTS)</a> sites, first.</p>
<div class="table">
<a name="listofkeywebsiteaspecificpackage"></a><p class="title"><b>Table 2.5. List of key web site to resolving problems with a specific package</b></p>
<div class="table-contents"><table summary="List of key web site to resolving problems with a specific package" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
web site
</th>
<th align="left">
command
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
Home page of <a class="ulink" href="http://bugs.debian.org/" target="_top">the Debian bug tracking system (BTS)</a>
</td>
<td align="left">
<code class="literal">sensible-browser "http://bugs.debian.org/"</code>
</td>
</tr>
<tr>
<td align="left">
The bug report of a known package name
</td>
<td align="left">
<code class="literal">sensible-browser "http://bugs.debian.org/&lt;package_name&gt;"</code>
</td>
</tr>
<tr>
<td align="left">
The bug report of known bug number
</td>
<td align="left">
<code class="literal">sensible-browser "http://bugs.debian.org/&lt;bug_number&gt;"</code>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>Search <a class="ulink" href="http://www.google.com" target="_top">Google</a> with search words including "<code class="literal">site:debian.org</code>", "<code class="literal">site:wiki.debian.org</code>", "<code class="literal">site:lists.debian.org</code>", etc.</p>
<p>When you file a bug report, please use <span class="citerefentry"><span class="refentrytitle">reportbug</span>(1)</span> command.</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_basic_package_management_operations"></a>2.2. Basic package management operations</h2></div></div></div>
<p>Basic package management operations on the Debian system can be performed by any package management tools available on the Debian system. Here, we explain basic package management tools: <code class="literal">apt-get</code> / <code class="literal">apt-cache</code> and <code class="literal">aptitude</code>.</p>
<p>For the package management operation which involves package installation or updates package metadata, you need to have root privilege.</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_literal_apt_get_literal_literal_apt_cache_literal_vs_literal_aptitude_literal"></a>2.2.1. <code class="literal">apt-get</code> / <code class="literal">apt-cache</code> vs. <code class="literal">aptitude</code>
</h3></div></div></div>
<p>The <code class="literal">apt-get</code> and <code class="literal">apt-cache</code> commands are the most <span class="strong"><strong>basic</strong></span> package management tool.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><code class="literal">apt-get</code> and <code class="literal">apt-cache</code> offer only the commandline user interface.
</p></li>
<li class="listitem"><p><code class="literal">apt-get</code> is most suitable for the <span class="strong"><strong>major system upgrade</strong></span> between releases, etc.
</p></li>
<li class="listitem"><p><code class="literal">apt-get</code> offers a <span class="strong"><strong>robust and stable</strong></span> package resolver which uses the common package state data.
</p></li>
<li class="listitem"><p><code class="literal">apt-get</code> is less demanding on hardware resources. It consumes less memory and runs faster.
</p></li>
<li class="listitem"><p><code class="literal">apt-get</code> has been updated to support autoinstall and autoremove of recommended packages.
</p></li>
<li class="listitem"><p><code class="literal">apt-get</code> has been updated to support logging of package activities.
</p></li>
<li class="listitem"><p><code class="literal">apt-cache</code> offers a <span class="strong"><strong>standard</strong></span> regex based search on the package name and description.
</p></li>
<li class="listitem"><p><code class="literal">apt-get</code> and <code class="literal">apt-cache</code> can manage multiple versions of packages using <code class="literal">/etc/apt/preferences</code> but it is quite cumbersome.
</p></li>
</ul></div>
<p>The <code class="literal">aptitude</code> command is the most <span class="strong"><strong>versatile</strong></span> package management tool.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><code class="literal">aptitude</code> offers the fullscreen interactive text user interface.
</p></li>
<li class="listitem"><p><code class="literal">aptitude</code> offers the commandline user interface, too.
</p></li>
<li class="listitem"><p><code class="literal">aptitude</code> is most suitable for the <span class="strong"><strong>daily interactive package management</strong></span> such as inspecting installed packages and searching available packages.
</p></li>
<li class="listitem"><p><code class="literal">aptitude</code> is more demanding on hardware resources. It consumes more memory and runs slower.
</p></li>
<li class="listitem"><p><code class="literal">aptitude</code> offers an <span class="strong"><strong>enhanced</strong></span> package resolver which also uses an extra package state data used only by <code class="literal">aptitude</code>.
</p></li>
<li class="listitem"><p><code class="literal">aptitude</code> supports autoinstall and autoremove of recommended packages.
</p></li>
<li class="listitem"><p><code class="literal">aptitude</code> supports logging of package activities.
</p></li>
<li class="listitem"><p><code class="literal">aptitude</code> offers an <span class="strong"><strong>enhanced</strong></span> regex based search on all of the package metadata.
</p></li>
<li class="listitem"><p><code class="literal">aptitude</code> can manage multiple versions of packages without using <code class="literal">/etc/apt/preferences</code> and it is quite intuitive.
</p></li>
</ul></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Although the <code class="literal">aptitude</code> command comes with rich features such as its enhanced package resolver, this complexity has caused (or may still causes) some regressions such as <a class="ulink" href="http://bugs.debian.org/411123" target="_top">Bug #411123</a>, <a class="ulink" href="http://bugs.debian.org/514930" target="_top">Bug #514930</a>, and <a class="ulink" href="http://bugs.debian.org/570377" target="_top">Bug #570377</a>. In case of doubt, please use the <code class="literal">apt-get</code> and <code class="literal">apt-cache</code> commands over the <code class="literal">aptitude</code> command.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_basic_package_management_operations_with_the_commandline"></a>2.2.2. Basic package management operations with the commandline</h3></div></div></div>
<p>Here are basic package management operations with the commandline using <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">apt-get</span>(8)</span> /<span class="citerefentry"><span class="refentrytitle">apt-cache</span>(8)</span>.</p>
<div class="table">
<a name="basicpackagemanaaptgetiaptcachei"></a><p class="title"><b>Table 2.6. Basic package management operations with the commandline using <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">apt-get</span>(8)</span> /<span class="citerefentry"><span class="refentrytitle">apt-cache</span>(8)</span></b></p>
<div class="table-contents"><table summary="Basic package management operations with the commandline using aptitude8 and apt-get8 /apt-cache8" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
<code class="literal">aptitude</code> syntax
</th>
<th align="left">
<code class="literal">apt-get</code>/<code class="literal">apt-cache</code> syntax
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">aptitude update</code>
</td>
<td align="left">
<code class="literal">apt-get update</code>
</td>
<td align="left">
update package archive metadata
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude install foo</code>
</td>
<td align="left">
<code class="literal">apt-get install foo</code>
</td>
<td align="left">
install candidate version of "<code class="literal">foo</code>" package with its dependencies
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude safe-upgrade</code>
</td>
<td align="left">
<code class="literal">apt-get upgrade</code>
</td>
<td align="left">
install candidate version of installed packages without removing any other packages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude full-upgrade</code>
</td>
<td align="left">
<code class="literal">apt-get dist-upgrade &lt;package&gt;</code>
</td>
<td align="left">
install candidate version of installed packages while removing other packages if needed
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude remove foo</code>
</td>
<td align="left">
<code class="literal">apt-get remove foo</code>
</td>
<td align="left">
remove "<code class="literal">foo</code>" package while leaving its configuration files
</td>
</tr>
<tr>
<td align="left">
N/A
</td>
<td align="left">
<code class="literal">apt-get autoremove</code>
</td>
<td align="left">
remove auto-installed packages which is no longer required
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude purge foo</code>
</td>
<td align="left">
<code class="literal">apt-get purge foo</code>
</td>
<td align="left">
purge "<code class="literal">foo</code>" package with its configuration files
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude clean</code>
</td>
<td align="left">
<code class="literal">apt-get clean</code>
</td>
<td align="left">
clear out the local repository of retrieved package files completely
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude autoclean</code>
</td>
<td align="left">
<code class="literal">apt-get autoclean</code>
</td>
<td align="left">
clear out the local repository of retrieved package files for outdated packages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude show foo</code>
</td>
<td align="left">
<code class="literal">apt-cache show &lt;package&gt;</code>
</td>
<td align="left">
display detailed information about "<code class="literal">foo</code>" package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude search &lt;regex&gt;</code>
</td>
<td align="left">
<code class="literal">apt-cache search &lt;regex&gt;</code>
</td>
<td align="left">
search packages which match &lt;regex&gt;
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude why &lt;regex&gt;</code>
</td>
<td align="left">
N/A
</td>
<td align="left">
explain the reason why &lt;regex&gt; matching packages should be installed
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude why-not &lt;regex&gt;</code>
</td>
<td align="left">
N/A
</td>
<td align="left">
explain the reason why &lt;regex&gt; matching packages can not be installed
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Since <code class="literal">apt-get</code> and <code class="literal">aptitude</code> share auto-installed package status (see <a class="xref" href="ch02.en.html#_the_package_state_for_apt" title="2.5.5. The package state for APT">Section 2.5.5, “The package state for APT”</a>) after <code class="literal">lenny</code>, you can mix these tools without major troubles (see <a class="ulink" href="http://bugs.debian.org/594490" target="_top">Bug #594490</a>).</p></td></tr>
</table></div>
<p>The difference between "<code class="literal">safe-upgrade</code>"/"<code class="literal">upgrade</code>" and "<code class="literal">full-upgrade</code>"/"<code class="literal">dist-upgrade</code>" only appears when new versions of packages stand in different dependency relationships from old versions of those packages. The "<code class="literal">aptitude safe-upgrade</code>" command does not install new packages nor remove installed packages.</p>
<p>The "<code class="literal">aptitude why &lt;regex&gt;</code>" can list more information by "<code class="literal">aptitude -v why &lt;regex&gt;</code>". Similar information can be obtained by "<code class="literal">apt-cache rdepends &lt;package&gt;</code>".</p>
<p>When <code class="literal">aptitude</code> 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 "<code class="literal">e</code>"-key later at the prompt.</p>
<p>You may provide command options right after "<code class="literal">aptitude</code>".</p>
<div class="table">
<a name="notablecommandopionsforaptitudei"></a><p class="title"><b>Table 2.7. Notable command options for <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span></b></p>
<div class="table-contents"><table summary="Notable command options for aptitude8" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
command option
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">-s</code>
</td>
<td align="left">
simulate the result of the command
</td>
</tr>
<tr>
<td align="left">
<code class="literal">-d</code>
</td>
<td align="left">
download only but no install/upgrade
</td>
</tr>
<tr>
<td align="left">
<code class="literal">-D</code>
</td>
<td align="left">
show brief explanations before the automatic installations and removals
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>See <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span> and "aptitude user's manual" at "<code class="literal">/usr/share/doc/aptitude/README</code>" for more.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The <code class="literal">dselect</code> package is still available and was the preferred full screen interactive package management tool in previous releases.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_interactive_use_of_aptitude"></a>2.2.3. Interactive use of aptitude</h3></div></div></div>
<p>For the interactive package management, you start <code class="literal">aptitude</code> in interactive mode from the console shell prompt as follows.</p>
<pre class="screen">$ sudo aptitude -u
Password:</pre>
<p>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 "<code class="literal">~/.aptitude/config</code>".</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>If you want to use root's configuration instead of user's one, use "<code class="literal">sudo -H aptitude …</code>" instead of "<code class="literal">sudo aptitude …</code>" in the above expression.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p><code class="literal">Aptitude</code> automatically sets <span class="strong"><strong>pending actions</strong></span> as it is started interactively. If you do not like it, you can reset it from menu: "Action" → "Cancel pending actions".</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_key_bindings_of_aptitude"></a>2.2.4. Key bindings of aptitude</h3></div></div></div>
<p>Notable key strokes to browse status of packages and to set "planned action" on them in this full screen mode are the following.</p>
<div class="table">
<a name="listofkeybindingsforaptitude"></a><p class="title"><b>Table 2.8. List of key bindings for aptitude</b></p>
<div class="table-contents"><table summary="List of key bindings for aptitude" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
key
</th>
<th align="left">
key binding
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">F10</code> or <code class="literal">Ctrl-t</code>
</td>
<td align="left">
menu
</td>
</tr>
<tr>
<td align="left">
<code class="literal">?</code>
</td>
<td align="left">
display <span class="strong"><strong>help</strong></span> for keystroke (more complete listing)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">F10</code> → Help → User's Manual
</td>
<td align="left">
display User's Manual
</td>
</tr>
<tr>
<td align="left">
<code class="literal">u</code>
</td>
<td align="left">
update package archive information
</td>
</tr>
<tr>
<td align="left">
<code class="literal">+</code>
</td>
<td align="left">
mark the package for the <span class="strong"><strong>upgrade</strong></span> or the <span class="strong"><strong>install</strong></span>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">-</code>
</td>
<td align="left">
mark the package for the <span class="strong"><strong>remove</strong></span> (keep configuration files)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">_</code>
</td>
<td align="left">
mark the package for the <span class="strong"><strong>purge</strong></span> (remove configuration files)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">=</code>
</td>
<td align="left">
place the package on <span class="strong"><strong>hold</strong></span>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">U</code>
</td>
<td align="left">
mark all upgradable packages (function as <span class="strong"><strong>full-upgrade</strong></span>)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">g</code>
</td>
<td align="left">
start <span class="strong"><strong>downloading</strong></span> and <span class="strong"><strong>installing</strong></span> selected packages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">q</code>
</td>
<td align="left">
quit current screen and save changes
</td>
</tr>
<tr>
<td align="left">
<code class="literal">x</code>
</td>
<td align="left">
quit current screen and discard changes
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Enter</code>
</td>
<td align="left">
view information about a package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">C</code>
</td>
<td align="left">
view a package's changelog
</td>
</tr>
<tr>
<td align="left">
<code class="literal">l</code>
</td>
<td align="left">
change the limit for the displayed packages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/</code>
</td>
<td align="left">
search for the first match
</td>
</tr>
<tr>
<td align="left">
<code class="literal">\</code>
</td>
<td align="left">
repeat the last search
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>The file name specification of the command line and the menu prompt after pressing "<code class="literal">l</code>" and "<code class="literal">//</code>" take the aptitude regex as described below. Aptitude regex can explicitly match a package name using a string started by "<code class="literal">~n</code> and followed by the package name.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You need to press "<code class="literal">U</code>" to get all the installed packages upgraded to the <span class="strong"><strong>candidate version</strong></span> in the visual interface. Otherwise only the selected packages and certain packages with versioned dependency to them are upgraded to the <span class="strong"><strong>candidate version</strong></span>.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_package_views_under_aptitude"></a>2.2.5. Package views under aptitude</h3></div></div></div>
<p>In the interactive full screen mode of <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span>, packages in the package list are displayed as the next example.</p>
<pre class="screen">idA libsmbclient -2220kB 3.0.25a-1 3.0.25a-2</pre>
<p>Here, this line means from the left as the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The "current state" flag (the first letter)
</p></li>
<li class="listitem"><p>
The "planned action" flag (the second letter)
</p></li>
<li class="listitem"><p>
The "automatic" flag (the third letter)
</p></li>
<li class="listitem"><p>
The Package name
</p></li>
<li class="listitem"><p>
The change in disk space usage attributed to "planned action"
</p></li>
<li class="listitem"><p>
The current version of the package
</p></li>
<li class="listitem"><p>
The candidate version of the package
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The full list of flags are given at the bottom of <span class="strong"><strong>Help</strong></span> screen shown by pressing "<code class="literal">?</code>".</p></td></tr>
</table></div>
<p>The <span class="strong"><strong>candidate version</strong></span> is chosen according to the current local preferences (see <span class="citerefentry"><span class="refentrytitle">apt_preferences</span>(5)</span> and <a class="xref" href="ch02.en.html#_tweaking_candidate_version" title="2.7.3. Tweaking candidate version">Section 2.7.3, “Tweaking candidate version”</a>).</p>
<p>Several types of package views are available under the menu "<code class="literal">Views</code>".</p>
<div class="table">
<a name="listofviewsforaptitude"></a><p class="title"><b>Table 2.9. List of views for aptitude</b></p>
<div class="table-contents"><table summary="List of views for aptitude" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
view
</th>
<th align="left">
status
</th>
<th align="left">
description of view
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">Package View</code>
</td>
<td align="left">
Good
</td>
<td align="left">
see <a class="xref" href="ch02.en.html#standard-package-views" title="Table 2.10. The categorization of standard package views">Table 2.10, “The categorization of standard package views”</a> (default)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Audit Recommendations</code>
</td>
<td align="left">
Good
</td>
<td align="left">
list packages which are recommended by some installed packages but not yet installed are listed
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Flat Package List</code>
</td>
<td align="left">
Good
</td>
<td align="left">
list packages without categorization (for use with regex)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Debtags Browser</code>
</td>
<td align="left">
Very usable
</td>
<td align="left">
list packages categorized according to their <a class="ulink" href="http://debtags.alioth.debian.org/" target="_top">debtags</a> entries
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Categorical Browser</code>
</td>
<td align="left">
Deprecated
</td>
<td align="left">
list packages categorized according to their category (use <code class="literal">Debtags Browser</code>, instead)
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Please help us <a class="ulink" href="http://debtags.alioth.debian.org/todo.html" target="_top">improving tagging packages with debtags!</a></p></td></tr>
</table></div>
<p>The standard "<code class="literal">Package View</code>" categorizes packages somewhat like <code class="literal">dselect</code> with few extra features.</p>
<div class="table">
<a name="standard-package-views"></a><p class="title"><b>Table 2.10. The categorization of standard package views</b></p>
<div class="table-contents"><table summary="The categorization of standard package views" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
category
</th>
<th align="left">
description of view
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">Upgradable Packages</code>
</td>
<td align="left">
list packages organized as <code class="literal">section</code><code class="literal">area</code><code class="literal">package</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">New Packages</code>
</td>
<td align="left">
, ,
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Installed Packages</code>
</td>
<td align="left">
, ,
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Not Installed Packages</code>
</td>
<td align="left">
, ,
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Obsolete and Locally Created Packages</code>
</td>
<td align="left">
, ,
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Virtual Packages</code>
</td>
<td align="left">
list packages with the same function
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Tasks</code>
</td>
<td align="left">
list packages with different functions generally needed for a task
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p><code class="literal">Tasks</code> view can be used to cherry pick packages for your task.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_search_method_options_with_aptitude"></a>2.2.6. Search method options with aptitude</h3></div></div></div>
<p>Aptitude offers several options for you to search packages using its regex formula.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
Shell commandline:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
"<code class="literal">aptitude search '&lt;aptitude_regex&gt;'</code>" to list installation status, package name and short description of matching packages
</p></li>
<li class="listitem"><p>
"<code class="literal">aptitude show '&lt;package_name&gt;'</code>" to list detailed description of the package
</p></li>
</ul></div>
</li>
<li class="listitem">
<p>
Interactive full screen mode:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
"<code class="literal">l</code>" to limit package view to matching packages
</p></li>
<li class="listitem"><p>
"<code class="literal">/</code>" for search to a matching package
</p></li>
<li class="listitem"><p>
"<code class="literal">\</code>" for backward search to a matching package
</p></li>
<li class="listitem"><p>
"<code class="literal">n</code>" for find-next
</p></li>
<li class="listitem"><p>
"<code class="literal">N</code>" for find-next (backward)
</p></li>
</ul></div>
</li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The string for &lt;package_name&gt; is treated as the exact string match to the package name unless it is started explicitly with "<code class="literal">~</code>" to be the regex formula.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_aptitude_regex_formula"></a>2.2.7. The aptitude regex formula</h3></div></div></div>
<p>The aptitude regex formula is mutt-like extended <span class="strong"><strong>ERE</strong></span> (see <a class="xref" href="ch01.en.html#_regular_expressions" title="1.6.2. Regular expressions">Section 1.6.2, “Regular expressions”</a>) and the meanings of the <code class="literal">aptitude</code> specific special match rule extensions are as follows.</p>
<div class="table">
<a name="listoftheaptituderegexformula"></a><p class="title"><b>Table 2.11. List of the aptitude regex formula</b></p>
<div class="table-contents"><table summary="List of the aptitude regex formula" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
description of the extended match rule
</th>
<th align="left">
regex formula
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
match on package name
</td>
<td align="left">
<code class="literal">~n&lt;regex_name&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match on description
</td>
<td align="left">
<code class="literal">~d&lt;regex_description&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match on task name
</td>
<td align="left">
<code class="literal">~t&lt;regex_task&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match on debtag
</td>
<td align="left">
<code class="literal">~G&lt;regex_debtag&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match on maintainer
</td>
<td align="left">
<code class="literal">~m&lt;regex_maintainer&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match on package section
</td>
<td align="left">
<code class="literal">~s&lt;regex_section&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match on package version
</td>
<td align="left">
<code class="literal">~V&lt;regex_version&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match archive
</td>
<td align="left">
<code class="literal">~A{sarge,etch,sid</code>}
</td>
</tr>
<tr>
<td align="left">
match origin
</td>
<td align="left">
<code class="literal">~O{debian,…</code>}
</td>
</tr>
<tr>
<td align="left">
match priority
</td>
<td align="left">
<code class="literal">~p{extra,important,optional,required,standard</code>}
</td>
</tr>
<tr>
<td align="left">
match essential packages
</td>
<td align="left">
<code class="literal">~E</code>
</td>
</tr>
<tr>
<td align="left">
match virtual packages
</td>
<td align="left">
<code class="literal">~v</code>
</td>
</tr>
<tr>
<td align="left">
match new packages
</td>
<td align="left">
<code class="literal">~N</code>
</td>
</tr>
<tr>
<td align="left">
match with pending action
</td>
<td align="left">
<code class="literal">~a{install,upgrade,downgrade,remove,purge,hold,keep</code>}
</td>
</tr>
<tr>
<td align="left">
match installed packages
</td>
<td align="left">
<code class="literal">~i</code>
</td>
</tr>
<tr>
<td align="left">
match installed packages with <span class="strong"><strong>A</strong></span>-mark (auto installed package)
</td>
<td align="left">
<code class="literal">~M</code>
</td>
</tr>
<tr>
<td align="left">
match installed packages without <span class="strong"><strong>A</strong></span>-mark (administrator selected package)
</td>
<td align="left">
<code class="literal">~i!~M</code>
</td>
</tr>
<tr>
<td align="left">
match installed and upgradable packages
</td>
<td align="left">
<code class="literal">~U</code>
</td>
</tr>
<tr>
<td align="left">
match removed but not purged packages
</td>
<td align="left">
<code class="literal">~c</code>
</td>
</tr>
<tr>
<td align="left">
match removed, purged or can-be-removed packages
</td>
<td align="left">
<code class="literal">~g</code>
</td>
</tr>
<tr>
<td align="left">
match packages with broken relation
</td>
<td align="left">
<code class="literal">~b</code>
</td>
</tr>
<tr>
<td align="left">
match packages with broken depends/predepends/conflict
</td>
<td align="left">
<code class="literal">~B&lt;type&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match packages from which relation &lt;type&gt; is defined to &lt;term&gt; package
</td>
<td align="left">
<code class="literal">~D[&lt;type&gt;:]&lt;term&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match packages from which <span class="strong"><strong>broken</strong></span> relation &lt;type&gt; is defined to &lt;term&gt; package
</td>
<td align="left">
<code class="literal">~DB[&lt;type&gt;:]&lt;term&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match packages to which the &lt;term&gt; package defines relation &lt;type&gt;
</td>
<td align="left">
<code class="literal">~R[&lt;type&gt;:]&lt;term&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match packages to which the &lt;term&gt; package defines <span class="strong"><strong>broken</strong></span> relation &lt;type&gt;
</td>
<td align="left">
<code class="literal">~RB[&lt;type&gt;:]&lt;term&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match packages to which some other installed packages depend on
</td>
<td align="left">
<code class="literal">~R~i</code>
</td>
</tr>
<tr>
<td align="left">
match packages to which no other installed packages depend on
</td>
<td align="left">
<code class="literal">!~R~i</code>
</td>
</tr>
<tr>
<td align="left">
match packages to which some other installed packages depend or recommend on
</td>
<td align="left">
<code class="literal">~R~i|~Rrecommends:~i</code>
</td>
</tr>
<tr>
<td align="left">
match &lt;term&gt; package with filtered version
</td>
<td align="left">
<code class="literal">~S filter &lt;term&gt;</code>
</td>
</tr>
<tr>
<td align="left">
match all packages (true)
</td>
<td align="left">
<code class="literal">~T</code>
</td>
</tr>
<tr>
<td align="left">
match no packages (false)
</td>
<td align="left">
<code class="literal">~F</code>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The regex part is the same <span class="strong"><strong>ERE</strong></span> as the one used in typical Unix-like text tools using "<code class="literal">^</code>", "<code class="literal">.*</code>", "<code class="literal">$</code>" etc. as in <span class="citerefentry"><span class="refentrytitle">egrep</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">awk</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">perl</span>(1)</span>.
</p></li>
<li class="listitem"><p>
The relation &lt;type&gt; is one of (depends, predepends, recommends, suggests, conflicts, replaces, provides).
</p></li>
<li class="listitem"><p>
The default relation type is "depends".
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>When &lt;regex_pattern&gt; is a null string, place "<code class="literal">~T</code>" immediately after the command.</p></td></tr>
</table></div>
<p>Here are some short cuts.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
"<code class="literal">~P&lt;term&gt;</code>" == "<code class="literal">~Dprovides:&lt;term&gt;</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">~C&lt;term&gt;</code>" == "<code class="literal">~Dconflicts:&lt;term&gt;</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">…~W term</code>" == "<code class="literal">(…|term)</code>"
</p></li>
</ul></div>
<p>Users familiar with <code class="literal">mutt</code> pick up quickly, as mutt was the inspiration for the expression syntax. See "SEARCHING, LIMITING, AND EXPRESSIONS" in the "User's Manual" "<code class="literal">/usr/share/doc/aptitude/README</code>".</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>With the <code class="literal">lenny</code> version of <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span>, the new <span class="strong"><strong>long form</strong></span> syntax such as "<code class="literal">?broken</code>" may be used for regex matching in place for its old <span class="strong"><strong>short form</strong></span> equivalent "<code class="literal">~b</code>". Now space character "<code class="literal"> </code>" is considered as one of the regex terminating character in addition to tilde character "<code class="literal">~</code>". See "User's Manual" for the new <span class="strong"><strong>long form</strong></span> syntax.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_dependency_resolution_of_aptitude"></a>2.2.8. Dependency resolution of aptitude</h3></div></div></div>
<p>The selection of a package in <code class="literal">aptitude</code> not only pulls in packages which are defined in its "<code class="literal">Depends:</code>" list but also defined in the "<code class="literal">Recommends:</code>" list if the menu "<code class="literal">F10</code> → Options → Dependency handling" is set accordingly. These auto installed packages are removed automatically if they are no longer needed under <code class="literal">aptitude</code>.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Before the <code class="literal">lenny</code> release, <code class="literal">apt-get</code> and other standard APT tools did not offer the autoremove functionality.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_package_activity_logs"></a>2.2.9. Package activity logs</h3></div></div></div>
<p>You can check package activity history in the log files.</p>
<div class="table">
<a name="thelogfilesforpackageactivities"></a><p class="title"><b>Table 2.12. The log files for package activities</b></p>
<div class="table-contents"><table summary="The log files for package activities" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
file
</th>
<th align="left">
content
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">/var/log/dpkg.log</code>
</td>
<td align="left">
Log of <code class="literal">dpkg</code> level activity for all package activities
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/log/apt/term.log</code>
</td>
<td align="left">
Log of generic APT activity
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/log/aptitude</code>
</td>
<td align="left">
Log of <code class="literal">aptitude</code> command activity
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>In reality, it is not so easy to get meaningful understanding quickly out from these logs. See <a class="xref" href="ch09.en.html#_recording_changes_in_configuration_files" title="9.2.10. Recording changes in configuration files">Section 9.2.10, “Recording changes in configuration files”</a> for easier way.</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_examples_of_aptitude_operations"></a>2.3. Examples of aptitude operations</h2></div></div></div>
<p>Here are few examples of <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span> operations.</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_listing_packages_with_regex_matching_on_package_names"></a>2.3.1. Listing packages with regex matching on package names</h3></div></div></div>
<p>The following command lists packages with regex matching on package names.</p>
<pre class="screen">$ aptitude search '~n(pam|nss).*ldap'
p libnss-ldap - NSS module for using LDAP as a naming service
p libpam-ldap - Pluggable Authentication Module allowing LDAP interfaces</pre>
<p>This is quite handy for you to find the exact name of a package.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_browsing_with_the_regex_matching"></a>2.3.2. Browsing with the regex matching</h3></div></div></div>
<p>The regex "<code class="literal">~dipv6</code>" in the "New Flat Package List" view with "<code class="literal">l</code>" prompt, limits view to packages with the matching description and let you browse their information interactively.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_purging_removed_packages_for_good"></a>2.3.3. Purging removed packages for good</h3></div></div></div>
<p>You can purge all remaining configuration files of removed packages.</p>
<p>Check results of the following command.</p>
<pre class="screen"># aptitude search '~c'</pre>
<p>If you think listed packages are OK to be purged, execute the following command.</p>
<pre class="screen"># aptitude purge '~c'</pre>
<p>You may want to do the similar in the interactive mode for fine grained control.</p>
<p>You provide the regex "<code class="literal">~c</code>" in the "New Flat Package List" view with "<code class="literal">l</code>" 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 "<code class="literal">[</code>" at top level headings.</p>
<p>Then you press "<code class="literal">_</code>" 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 "<code class="literal">=</code>" interactively for each of them.</p>
<p>This technique is quite handy and works for many other command keys.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_tidying_auto_manual_install_status"></a>2.3.4. Tidying auto/manual install status</h3></div></div></div>
<p>Here is how I tidy auto/manual install status for packages (after using non-aptitude package installer etc.).</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Start <code class="literal">aptitude</code> in interactive mode as root.
</p></li>
<li class="listitem"><p>
Type "<code class="literal">u</code>", "<code class="literal">U</code>", "<code class="literal">f</code>" and "<code class="literal">g</code>" to update and upgrade package list and packages.
</p></li>
<li class="listitem"><p>
Type "<code class="literal">l</code>" to enter the package display limit as "<code class="literal">~i(~R~i|~Rrecommends:~i)</code>" and type "<code class="literal">M</code>" over "<code class="literal">Installed Packages</code>" as auto installed.
</p></li>
<li class="listitem"><p>
Type "<code class="literal">l</code>" to enter the package display limit as "<code class="literal">~prequired|~pimportant|~pstandard|~E</code>" and type "<code class="literal">m</code>" over "<code class="literal">Installed Packages</code>" as manual installed.
</p></li>
<li class="listitem"><p>
Type "<code class="literal">l</code>" to enter the package display limit as "<code class="literal">~i!~M</code>" and remove unused package by typing "<code class="literal">-</code>" over each of them after exposing them by typing "<code class="literal">[</code>" over "<code class="literal">Installed Packages</code>".
</p></li>
<li class="listitem"><p>
Type "<code class="literal">l</code>" to enter the package display limit as "<code class="literal">~i</code>" and type "<code class="literal">m</code>" over "<code class="literal">Tasks</code>" as manual installed.
</p></li>
<li class="listitem"><p>
Exit <code class="literal">aptitude</code>.
</p></li>
<li class="listitem"><p>
Start "<code class="literal">apt-get -s autoremove|less</code>" as root to check what are not used.
</p></li>
<li class="listitem"><p>
Restart <code class="literal">aptitude</code> in interactive mode and mark needed packages as "<code class="literal">m</code>".
</p></li>
<li class="listitem"><p>
Restart "<code class="literal">apt-get -s autoremove|less</code>" as root to recheck REMOVED contain only expected packages.
</p></li>
<li class="listitem"><p>
Start "<code class="literal">apt-get autoremove|less</code>" as root to autoremove unused packages.
</p></li>
</ol></div>
<p>The "<code class="literal">m</code>" action over "<code class="literal">Tasks</code>" is an optional one to prevent mass package removal situation in future.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_system_wide_upgrade"></a>2.3.5. System wide upgrade</h3></div></div></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>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 <a class="xref" href="ch10.en.html#_backup_and_recovery" title="10.1.6. Backup and recovery">Section 10.1.6, “Backup and recovery”</a>) before doing this. I recommend to make a dual boot configuration using different partition to have the smoothest transition.</p></td></tr>
</table></div>
<p>You can perform system wide upgrade to a newer release by changing contents of the "<code class="literal">/etc/apt/sources.list</code>" file pointing to a new release and running the "<code class="literal">apt-get update; apt-get dist-upgrade</code>" command.</p>
<p>To upgrade from <code class="literal">stable</code> to <code class="literal">testing</code> or <code class="literal">unstable</code>, you replace "<code class="literal">squeeze</code>" in the "<code class="literal">/etc/apt/sources.list</code>" example of <a class="xref" href="ch02.en.html#_debian_archive_basics" title="2.1.4. Debian archive basics">Section 2.1.4, “Debian archive basics”</a> with "<code class="literal">wheezy</code>" or "<code class="literal">sid</code>".</p>
<p>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 <code class="literal">stable</code> to the new <code class="literal">stable</code> after its release, you can read its new <a class="ulink" href="http://www.debian.org/releases/stable/releasenotes" target="_top">Release Notes</a> and follow the exact procedure described in it to minimize troubles.</p>
<p>When you decide to move from <code class="literal">stable</code> to <code class="literal">testing</code> before its formal release, there are no <a class="ulink" href="http://www.debian.org/releases/stable/releasenotes" target="_top">Release Notes</a> to help you. The difference between <code class="literal">stable</code> and <code class="literal">testing</code> could have grown quite large after the previous <code class="literal">stable</code> release and makes upgrade situation complicated.</p>
<p>You should make precautionary moves for the full upgrade while gathering latest information from mailing list and using common senses.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Read previous "Release Notes".
</p></li>
<li class="listitem"><p>
Backup entire system (especially data and configuration information).
</p></li>
<li class="listitem"><p>
Have bootable media handy for broken bootloader.
</p></li>
<li class="listitem"><p>
Inform users on the system well in advance.
</p></li>
<li class="listitem"><p>
Record upgrade activity with <span class="citerefentry"><span class="refentrytitle">script</span>(1)</span>.
</p></li>
<li class="listitem"><p>
Apply "unmarkauto" to required packages, e.g., "<code class="literal">aptitude unmarkauto vim</code>", to prevent removal.
</p></li>
<li class="listitem"><p>
Minimize installed packages to reduce chance of package conflicts, e.g., remove desktop task packages.
</p></li>
<li class="listitem"><p>
Remove the "<code class="literal">/etc/apt/preferences</code>" file (disable apt-pinning).
</p></li>
<li class="listitem"><p>
Try to upgrade step wise: <code class="literal">oldstable</code><code class="literal">stable</code><code class="literal">testing</code><code class="literal">unstable</code>.
</p></li>
<li class="listitem"><p>
Update the "<code class="literal">/etc/apt/sources.list</code>" file to point to new archive only and run "<code class="literal">aptitude update</code>".
</p></li>
<li class="listitem"><p>
Install, optionally, new <span class="strong"><strong>core packages</strong></span> first, e.g., "<code class="literal">aptitude install perl</code>".
</p></li>
<li class="listitem"><p>
Run the "<code class="literal">apt-get -s dist-upgrade</code>" command to assess impact.
</p></li>
<li class="listitem"><p>
Run the "<code class="literal">apt-get dist-upgrade</code>" command at last.
</p></li>
</ol></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>It is not wise to skip major Debian release when upgrading between <code class="literal">stable</code> releases.</p></td></tr>
</table></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>In previous "Release Notes", GCC, Linux Kernel, initrd-tools, Glibc, Perl, APT tool chain, etc. have required some special attention for system wide upgrade.</p></td></tr>
</table></div>
<p>For daily upgrade in <code class="literal">unstable</code>, see <a class="xref" href="ch02.en.html#_safeguarding_for_package_problems" title="2.4.3. Safeguarding for package problems">Section 2.4.3, “Safeguarding for package problems”</a>.</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_advanced_package_management_operations"></a>2.4. Advanced package management operations</h2></div></div></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_advanced_package_management_operations_with_commandline"></a>2.4.1. Advanced package management operations with commandline</h3></div></div></div>
<p>Here are list of other package management operations for which <code class="literal">aptitude</code> is too high-level or lacks required functionalities.</p>
<div class="table">
<a name="listofadvancedpagementoperations"></a><p class="title"><b>Table 2.13. List of advanced package management operations</b></p>
<div class="table-contents"><table summary="List of advanced package management operations" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
command
</th>
<th align="left">
action
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">COLUMNS=120 dpkg -l &lt;package_name_pattern&gt;</code>
</td>
<td align="left">
list status of an installed package for the bug report
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg -L &lt;package_name&gt;</code>
</td>
<td align="left">
list contents of an installed package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg -L &lt;package_name&gt; | egrep '/usr/share/man/man.*/.+'</code>
</td>
<td align="left">
list manpages for an installed package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg -S &lt;file_name_pattern&gt;</code>
</td>
<td align="left">
list installed packages which have matching file name
</td>
</tr>
<tr>
<td align="left">
<code class="literal">apt-file search &lt;file_name_pattern&gt;</code>
</td>
<td align="left">
list packages in archive which have matching file name
</td>
</tr>
<tr>
<td align="left">
<code class="literal">apt-file list &lt;package_name_pattern&gt;</code>
</td>
<td align="left">
list contents of matching packages in archive
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg-reconfigure &lt;package_name&gt;</code>
</td>
<td align="left">
reconfigure the exact package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg-reconfigure -p=low &lt;package_name&gt;</code>
</td>
<td align="left">
reconfigure the exact package with the most detailed question
</td>
</tr>
<tr>
<td align="left">
<code class="literal">configure-debian</code>
</td>
<td align="left">
reconfigure packages from the full screen menu
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg --audit</code>
</td>
<td align="left">
audit system for partially installed packages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg --configure -a</code>
</td>
<td align="left">
configure all partially installed packages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">apt-cache policy &lt;binary_package_name&gt;</code>
</td>
<td align="left">
show available version, priority, and archive information of a binary package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">apt-cache madison &lt;package_name&gt;</code>
</td>
<td align="left">
show available version, archive information of a package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">apt-cache showsrc &lt;binary_package_name&gt;</code>
</td>
<td align="left">
show source package information of a binary package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">apt-get build-dep &lt;package_name&gt;</code>
</td>
<td align="left">
install required packages to build package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">aptitude build-dep &lt;package_name&gt;</code>
</td>
<td align="left">
install required packages to build package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">apt-get source &lt;package_name&gt;</code>
</td>
<td align="left">
download a source (from standard archive)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dget &lt;URL for dsc file&gt;</code>
</td>
<td align="left">
download a source packages (from other archive)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg-source -x &lt;package_name&gt;_&lt;version&gt;-&lt;debian_version&gt;.dsc</code>
</td>
<td align="left">
build a source tree from a set of source packages ("<code class="literal">*.orig.tar.gz</code>" and "<code class="literal">*.debian.tar.gz</code>"/"<code class="literal">*.diff.gz</code>")
</td>
</tr>
<tr>
<td align="left">
<code class="literal">debuild binary</code>
</td>
<td align="left">
build package(s) from a local source tree
</td>
</tr>
<tr>
<td align="left">
<code class="literal">make-kpkg kernel_image</code>
</td>
<td align="left">
build a kernel package from a kernel source tree
</td>
</tr>
<tr>
<td align="left">
<code class="literal">make-kpkg --initrd kernel_image</code>
</td>
<td align="left">
build a kernel package from a kernel source tree with initramfs enabled
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg -i &lt;package_name&gt;<span class="emphasis"><em>&lt;version&gt;-&lt;debian_version&gt;</em></span>&lt;arch&gt;.deb</code>
</td>
<td align="left">
install a local package to the system
</td>
</tr>
<tr>
<td align="left">
<code class="literal">debi &lt;package_name&gt;<span class="emphasis"><em>&lt;version&gt;-&lt;debian_version&gt;</em></span>&lt;arch&gt;.dsc</code>
</td>
<td align="left">
install local package(s) to the system
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg --get-selections '*' &gt;selection.txt</code>
</td>
<td align="left">
save <code class="literal">dpkg</code> level package selection state information
</td>
</tr>
<tr>
<td align="left">
<code class="literal">dpkg --set-selections &lt;selection.txt</code>
</td>
<td align="left">
set <code class="literal">dpkg</code> level package selection state information
</td>
</tr>
<tr>
<td align="left">
<code class="literal">echo &lt;package_name&gt; hold | dpkg --set-selections</code>
</td>
<td align="left">
set <code class="literal">dpkg</code> level package selection state for a package to <span class="strong"><strong>hold</strong></span> (equivalent to "<code class="literal">aptitude hold &lt;package_name&gt;</code>")
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Lower level package tools such as "<code class="literal">dpkg -i …</code>" and "<code class="literal">debi …</code>" should be carefully used by the system administrator. It does not automatically take care required package dependencies. Dpkg's commandline options "<code class="literal">--force-all</code>" and similar (see <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span>) are intended to be used by experts only. Using them without fully understanding their effects may break your whole system.</p></td></tr>
</table></div>
<p>Please note the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
All system configuration and installation commands require to be run from root.
</p></li>
<li class="listitem"><p>
Unlike <code class="literal">aptitude</code> which uses regex (see <a class="xref" href="ch01.en.html#_regular_expressions" title="1.6.2. Regular expressions">Section 1.6.2, “Regular expressions”</a>), other package management commands use pattern like shell glob (see <a class="xref" href="ch01.en.html#_shell_glob" title="1.5.6. Shell glob">Section 1.5.6, “Shell glob”</a>).
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">apt-file</span>(1)</span> provided by the <code class="literal">apt-file</code> package must run "<code class="literal">apt-file update</code>" in advance.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">configure-debian</span>(8)</span> provided by the <code class="literal">configure-debian</code> package runs <span class="citerefentry"><span class="refentrytitle">dpkg-reconfigure</span>(8)</span> as its backend.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">dpkg-reconfigure</span>(8)</span> runs package scripts using <span class="citerefentry"><span class="refentrytitle">debconf</span>(1)</span> as its backend.
</p></li>
<li class="listitem"><p>
"<code class="literal">apt-get build-dep</code>", "<code class="literal">apt-get source</code>" and "<code class="literal">apt-cache showsrc</code>" commands require "<code class="literal">deb-src</code>" entry in "<code class="literal">/etc/apt/sources.list</code>".
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">dget</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">debuild</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">debi</span>(1)</span> require <code class="literal">devscripts</code> package.
</p></li>
<li class="listitem"><p>
See (re)packaging procedure using "<code class="literal">apt-get source</code>" in <a class="xref" href="ch02.en.html#_porting_a_package_to_the_stable_system" title="2.7.13. Porting a package to the stable system">Section 2.7.13, “Porting a package to the stable system”</a>.
</p></li>
<li class="listitem"><p><code class="literal">make-kpkg</code> command requires the <code class="literal">kernel-package</code> package (see <a class="xref" href="ch09.en.html#_the_kernel" title="9.7. The kernel">Section 9.7, “The kernel”</a>).
</p></li>
<li class="listitem"><p>
See <a class="xref" href="ch12.en.html#_making_debian_package" title="12.11. Making Debian package">Section 12.11, “Making Debian package”</a> for general packaging.
</p></li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_verification_of_installed_package_files"></a>2.4.2. Verification of installed package files</h3></div></div></div>
<p>The installation of <code class="literal">debsums</code> enables verification of installed package files against MD5sum values in the "<code class="literal">/var/lib/dpkg/info/*.md5sums</code>" file with <span class="citerefentry"><span class="refentrytitle">debsums</span>(1)</span>. See <a class="xref" href="ch10.en.html#_the_md5_sum" title="10.4.5. The MD5 sum">Section 10.4.5, “The MD5 sum”</a> for how MD5sum works.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Because MD5sum database may be tampered by the intruder, <span class="citerefentry"><span class="refentrytitle">debsums</span>(1)</span> 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.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_safeguarding_for_package_problems"></a>2.4.3. Safeguarding for package problems</h3></div></div></div>
<p>Many users prefer to follow the <span class="strong"><strong>unstable</strong></span> 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.</p>
<p>The installation of the <code class="literal">apt-listbugs</code> package safeguards your system against critical bugs by checking Debian BTS automatically for critical bugs when upgrading with APT system.</p>
<p>The installation of the <code class="literal">apt-listchanges</code> package provides important news in "<code class="literal">NEWS.Debian</code>" when upgrading with APT system.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_searching_on_the_package_meta_data"></a>2.4.4. Searching on the package meta data</h3></div></div></div>
<p>Although visiting Debian site <a class="ulink" href="http://packages.debian.org/" target="_top">http://packages.debian.org/</a> facilitates easy ways to search on the package meta data these days, let's look into more traditional ways.</p>
<p>The <span class="citerefentry"><span class="refentrytitle">grep-dctrl</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">grep-status</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">grep-available</span>(1)</span> commands can be used to search any file which has the general format of a Debian package control file.</p>
<p>The "<code class="literal">dpkg -S &lt;file_name_pattern&gt;</code>" can be used search package names which contain files with the matching name installed by <code class="literal">dpkg</code>. But this overlooks files created by the maintainer scripts.</p>
<p>If you need to make more elaborate search on the dpkg meta data, you need to run "<code class="literal">grep -e regex_pattern *</code>" command in the "<code class="literal">/var/lib/dpkg/info/</code>" directory. This makes you search words mentioned in package scripts and installation query texts.</p>
<p>If you wish to look up package dependency recursively, you should use <span class="citerefentry"><span class="refentrytitle">apt-rdepends</span>(8)</span>.</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_debian_package_management_internals"></a>2.5. Debian package management internals</h2></div></div></div>
<p>Let's learn how the Debian package management system works internally. This should help you to create your own solution to some package problems.</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_archive_meta_data"></a>2.5.1. Archive meta data</h3></div></div></div>
<p>Meta data files for each distribution are stored under "<code class="literal">dist/&lt;codename&gt;</code>" on each Debian mirror sites, e.g., "<code class="literal">http://ftp.us.debian.org/debian/</code>". Its archive structure can be browsed by the web browser. There are 6 types of key meta data.</p>
<div class="table">
<a name="thecontentofthednarchivemetadata"></a><p class="title"><b>Table 2.14. The content of the Debian archive meta data</b></p>
<div class="table-contents"><table summary="The content of the Debian archive meta data" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
file
</th>
<th align="left">
location
</th>
<th align="left">
content
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">Release</code>
</td>
<td align="left">
top of distribution
</td>
<td align="left">
archive description and integrity information
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Release.gpg</code>
</td>
<td align="left">
top of distribution
</td>
<td align="left">
signature file for the "<code class="literal">Release</code>" file signed with the archive key
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Contents-&lt;architecture&gt;</code>
</td>
<td align="left">
top of distribution
</td>
<td align="left">
list of all files for all the packages in the pertinent archive
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Release</code>
</td>
<td align="left">
top of each distribution/area/architecture combination
</td>
<td align="left">
archive description used for the rule of <span class="citerefentry"><span class="refentrytitle">apt_preferences</span>(5)</span>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Packages</code>
</td>
<td align="left">
top of each distribution/area/binary-architecture combination
</td>
<td align="left">
concatenated <code class="literal">debian/control</code> for binary packages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">Sources</code>
</td>
<td align="left">
top of each distribution/area/source combination
</td>
<td align="left">
concatenated <code class="literal">debian/control</code> for source packages
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>In the recent archive, these meta data are stored as the compressed and differential files to reduce network traffic.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_top_level_release_file_and_authenticity"></a>2.5.2. Top level "Release" file and authenticity</h3></div></div></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The top level "<code class="literal">Release</code>" file is used for signing the archive under the <span class="strong"><strong>secure APT</strong></span> system.</p></td></tr>
</table></div>
<p>Each suite of the Debian archive has a top level "<code class="literal">Release</code>" file, e.g., "<code class="literal">http://ftp.us.debian.org/debian/dists/unstable/Release</code>", as follows.</p>
<pre class="screen">Origin: Debian
Label: Debian
Suite: unstable
Codename: sid
Date: Sat, 14 May 2011 08:20:50 UTC
Valid-Until: Sat, 21 May 2011 08:20:50 UTC
Architectures: alpha amd64 armel hppa hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 sparc
Components: main contrib non-free
Description: Debian x.y Unstable - Not Released
MD5Sum:
bdc8fa4b3f5e4a715dd0d56d176fc789 18876880 Contents-alpha.gz
9469a03c94b85e010d116aeeab9614c0 19441880 Contents-amd64.gz
3d68e206d7faa3aded660dc0996054fe 19203165 Contents-armel.gz
...</pre>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Here, you can find my rationale to use the "suite", and "codeneme" in <a class="xref" href="ch02.en.html#_debian_archive_basics" title="2.1.4. Debian archive basics">Section 2.1.4, “Debian archive basics”</a>. The "distribution" is used when referring to both "suite" and "codeneme". All archive "area" names offered by the archive are listed under "Component".</p></td></tr>
</table></div>
<p>The integrity of the top level "<code class="literal">Release</code>" file is verified by cryptographic infrastructure called the <a class="ulink" href="http://wiki.debian.org/SecureApt" target="_top">secure apt</a>.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The cryptographic signature file "<code class="literal">Release.gpg</code>" is created from the authentic top level "<code class="literal">Release</code>" file and the secret Debian archive key.
</p></li>
<li class="listitem">
<p>
The public Debian archive key can be seeded into "<code class="literal">/etc/apt/trusted.gpg</code>";
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
automatically by installing the keyring with the latest <code class="literal">base-files</code> package, or
</p></li>
<li class="listitem"><p>
manually by <code class="literal">gpg</code> or <code class="literal">apt-key</code> tool with <a class="ulink" href="http://ftp-master.debian.org/" target="_top">the latest public archive key posted on the ftp-master.debian.org</a> .
</p></li>
</ul></div>
</li>
<li class="listitem"><p>
The <span class="strong"><strong>secure APT</strong></span> system verifies the integrity of the downloaded top level "<code class="literal">Release</code>" file cryptographically by this "<code class="literal">Release.gpg</code>" file and the public Debian archive key in "<code class="literal">/etc/apt/trusted.gpg</code>".
</p></li>
</ul></div>
<p>The integrity of all the "<code class="literal">Packages</code>" and "<code class="literal">Sources</code>" files are verified by using MD5sum values in its top level "<code class="literal">Release</code>" file. The integrity of all package files are verified by using MD5sum values in the "<code class="literal">Packages</code>" and "<code class="literal">Sources</code>" files. See <span class="citerefentry"><span class="refentrytitle">debsums</span>(1)</span> and <a class="xref" href="ch02.en.html#_verification_of_installed_package_files" title="2.4.2. Verification of installed package files">Section 2.4.2, “Verification of installed package files”</a>.</p>
<p>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 "<code class="literal">Release</code>" file provides <a class="ulink" href="http://www.infodrom.org/~joey/Writing/Linux-Journal/secure-apt/" target="_top">the good security with the performance</a> (see <a class="xref" href="ch10.en.html#_data_security_infrastructure" title="10.4. Data security infrastructure">Section 10.4, “Data security infrastructure”</a>).</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_archive_level_release_files"></a>2.5.3. Archive level "Release" files</h3></div></div></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The archive level "<code class="literal">Release</code>" files are used for the rule of <span class="citerefentry"><span class="refentrytitle">apt_preferences</span>(5)</span>.</p></td></tr>
</table></div>
<p>There are archive level "<code class="literal">Release</code>" files for all archive locations specified by "<code class="literal">deb</code>" line in "<code class="literal">/etc/apt/sources.list</code>", such as "<code class="literal">http://ftp.us.debian.org/debian/dists/unstable/main/binary-amd64/Release</code>" or "<code class="literal">http://ftp.us.debian.org/debian/dists/sid/main/binary-amd64/Release</code>" as follows.</p>
<pre class="screen">Archive: unstable
Origin: Debian
Label: Debian
Component: main
Architecture: amd64</pre>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>For "<code class="literal">Archive:</code>" stanza, suite names ("<code class="literal">stable</code>", "<code class="literal">testing</code>", "<code class="literal">unstable</code>", …) are used in <a class="ulink" href="http://ftp.us.debian.org/debian/" target="_top">the Debian archive</a> while codenames ("<code class="literal">dapper</code>", "<code class="literal">feisty</code>", "<code class="literal">gutsy</code>", "<code class="literal">hardy</code>", "<code class="literal">intrepid</code>", …) are used in <a class="ulink" href="http://archive.ubuntu.com/ubuntu/" target="_top">the Ubuntu archive</a>.</p></td></tr>
</table></div>
<p>For some archives, such as <code class="literal">experimental</code>, and <code class="literal">squeeze-backports</code>, which contain packages which should not be installed automatically, there is an extra line, e.g., "<code class="literal">http://ftp.us.debian.org/debian/dists/experimental/main/binary-amd64/Release</code>" as follows.</p>
<pre class="screen">Archive: experimental
Origin: Debian
Label: Debian
NotAutomatic: yes
Component: main
Architecture: amd64</pre>
<p>Please note that for normal archives without "<code class="literal">NotAutomatic: yes</code>", the default Pin-Priority value is 500, while for special archives with "<code class="literal">NotAutomatic: yes</code>", the default Pin-Priority value is 1 (see <span class="citerefentry"><span class="refentrytitle">apt_preferences</span>(5)</span> and <a class="xref" href="ch02.en.html#_tweaking_candidate_version" title="2.7.3. Tweaking candidate version">Section 2.7.3, “Tweaking candidate version”</a>).</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_fetching_of_the_meta_data_for_the_package"></a>2.5.4. Fetching of the meta data for the package</h3></div></div></div>
<p>When APT tools, such as <code class="literal">aptitude</code>, <code class="literal">apt-get</code>, <code class="literal">synaptic</code>, <code class="literal">apt-file</code>, <code class="literal">auto-apt</code>…, 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 <code class="literal">distribution</code>, <code class="literal">area</code>, and <code class="literal">architecture</code> names in the "<code class="literal">/etc/apt/sources.list</code>" (see <a class="xref" href="ch02.en.html#_debian_archive_basics" title="2.1.4. Debian archive basics">Section 2.1.4, “Debian archive basics”</a>).</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
"<code class="literal">/var/lib/apt/lists/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_Release</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">/var/lib/apt/lists/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_Release.gpg</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">/var/lib/apt/lists/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_&lt;area&gt;_binary-&lt;architecture&gt;_Packages</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">/var/lib/apt/lists/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_&lt;area&gt;_source_Sources</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">/var/cache/apt/apt-file/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_Contents-&lt;architecture&gt;.gz</code>" (for <code class="literal">apt-file</code>)
</p></li>
</ul></div>
<p>First 4 types of files are shared by all the pertinent APT commands and updated from command line by "<code class="literal">apt-get update</code>" and "<code class="literal">aptitude update</code>". The "<code class="literal">Packages</code>" meta data are updated if there is the "<code class="literal">deb</code>" line in "<code class="literal">/etc/apt/sources.list</code>". The "<code class="literal">Sources</code>" meta data are updated if there is the "<code class="literal">deb-src</code>" line in "<code class="literal">/etc/apt/sources.list</code>".</p>
<p>The "<code class="literal">Packages</code>" and "<code class="literal">Sources</code>" meta data contain "<code class="literal">Filename:</code>" stanza pointing to the file location of the binary and source packages. Currently, these packages are located under the "<code class="literal">pool/</code>" directory tree for the improved transition over the releases.</p>
<p>Local copies of "<code class="literal">Packages</code>" meta data can be interactively searched with the help of <code class="literal">aptitude</code>. The specialized search command <span class="citerefentry"><span class="refentrytitle">grep-dctrl</span>(1)</span> can search local copies of "<code class="literal">Packages</code>" and "<code class="literal">Sources</code>" meta data.</p>
<p>Local copy of "<code class="literal">Contents-&lt;architecture&gt;</code>" meta data can be updated by "<code class="literal">apt-file update</code>" and its location is different from other 4 ones. See <span class="citerefentry"><span class="refentrytitle">apt-file</span>(1)</span>. (The <code class="literal">auto-apt</code> uses different location for local copy of "<code class="literal">Contents-&lt;architecture&gt;.gz</code>" as default.)</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_package_state_for_apt"></a>2.5.5. The package state for APT</h3></div></div></div>
<p>In addition to the remotely fetched meta data, the APT tool after <code class="literal">lenny</code> stores its locally generated installation state information in the "<code class="literal">/var/lib/apt/extended_states</code>" which is used by all APT tools to track all auto installed packages.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_package_state_for_aptitude"></a>2.5.6. The package state for aptitude</h3></div></div></div>
<p>In addition to the remotely fetched meta data, the <code class="literal">aptitude</code> command stores its locally generated installation state information in the "<code class="literal">/var/lib/aptitude/pkgstates</code>" which is used only by it.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_local_copies_of_the_fetched_packages"></a>2.5.7. Local copies of the fetched packages</h3></div></div></div>
<p>All the remotely fetched packages via APT mechanism are stored in the "<code class="literal">/var/cache/apt/archives</code>" until they are cleaned.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_debian_package_file_names"></a>2.5.8. Debian package file names</h3></div></div></div>
<p>Debian package files have particular name structures.</p>
<div class="table">
<a name="thenamestructureofdebianpackages"></a><p class="title"><b>Table 2.15. The name structure of Debian packages</b></p>
<div class="table-contents"><table summary="The name structure of Debian packages" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package type
</th>
<th align="left">
name structure
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
The binary package (a.k.a <code class="literal">deb</code>)
</td>
<td align="left">
<code class="literal">&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;-&lt;architecture&gt;.deb</code>
</td>
</tr>
<tr>
<td align="left">
The binary package (a.k.a <code class="literal">udeb</code>)
</td>
<td align="left">
<code class="literal">&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;-&lt;architecture&gt;.udeb</code>
</td>
</tr>
<tr>
<td align="left">
The source package (upstream source)
</td>
<td align="left">
<code class="literal">&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;.orig.tar.gz</code>
</td>
</tr>
<tr>
<td align="left">
The <code class="literal">1.0</code> source package (Debian changes)
</td>
<td align="left">
<code class="literal">&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;.diff.gz</code>
</td>
</tr>
<tr>
<td align="left">
The <code class="literal">3.0 (quilt)</code> source package (Debian changes)
</td>
<td align="left">
<code class="literal">&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;.debian.tar.gz</code>
</td>
</tr>
<tr>
<td align="left">
The source package (description)
</td>
<td align="left">
<code class="literal">&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;.dsc</code>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Here only the basic source package formats are described. See more on <span class="citerefentry"><span class="refentrytitle">dpkg-source</span>(1)</span>.</p></td></tr>
</table></div>
<div class="table">
<a name="theusablecharactbianpackagenames"></a><p class="title"><b>Table 2.16. The usable characters for each component in the Debian package names</b></p>
<div class="table-contents"><table summary="The usable characters for each component in the Debian package names" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
name component
</th>
<th align="left">
usable characters (regex)
</th>
<th align="left">
existence
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">&lt;package-name&gt;</code>
</td>
<td align="left">
<code class="literal">[a-z,A-Z,0-9,.,<code class="literal">,-]</code></code>
</td>
<td align="left">
required
</td>
</tr>
<tr>
<td align="left">
<code class="literal">&lt;epoch&gt;:</code>
</td>
<td align="left">
<code class="literal">[0-9]+:</code>
</td>
<td align="left">
optional
</td>
</tr>
<tr>
<td align="left">
<code class="literal">&lt;upstream-version&gt;</code>
</td>
<td align="left">
<code class="literal">[a-z,A-Z,0-9,.,<code class="literal">,-,:]</code></code>
</td>
<td align="left">
required
</td>
</tr>
<tr>
<td align="left">
<code class="literal">&lt;debian.version&gt;</code>
</td>
<td align="left">
<code class="literal">[a-z,A-Z,0-9,.,<code class="literal">,~]</code></code>
</td>
<td align="left">
optional
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>You can check package version order by <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span>, e.g., "<code class="literal">dpkg --compare-versions 7.0 gt 7.~pre1 ; echo $?</code>" .</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p><a class="ulink" href="http://www.debian.org/devel/debian-installer/" target="_top">The debian-installer (d-i)</a> uses <code class="literal">udeb</code> as the file extension for its binary package instead of normal <code class="literal">deb</code>. An <code class="literal">udeb</code> package is a stripped down <code class="literal">deb</code> package which removes few non-essential contents such as documentation to save space while relaxing the package policy requirements. Both <code class="literal">deb</code> and <code class="literal">udeb</code> packages share the same package structure. The "<code class="literal">u</code>" stands for micro.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_dpkg_command"></a>2.5.9. The dpkg command</h3></div></div></div>
<p><span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span> is the lowest level tool for the Debian package management. This is very powerful and needs to be used with care.</p>
<p>While installing package called "<code class="literal">&lt;package_name&gt;</code>", <code class="literal">dpkg</code> process it in the following order.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Unpack the deb file ("<code class="literal">ar -x</code>" equivalent)
</p></li>
<li class="listitem"><p>
Execute "<code class="literal">&lt;package_name&gt;.preinst</code>" using <span class="citerefentry"><span class="refentrytitle">debconf</span>(1)</span>
</p></li>
<li class="listitem"><p>
Install the package content to the system ("<code class="literal">tar -x</code>" equivalent)
</p></li>
<li class="listitem"><p>
Execute "<code class="literal">&lt;package_name&gt;.postinst</code>" using <span class="citerefentry"><span class="refentrytitle">debconf</span>(1)</span>
</p></li>
</ol></div>
<p>The <code class="literal">debconf</code> system provides standardized user interaction with I18N and L10N (<a class="xref" href="ch08.en.html" title="Chapter 8. I18N and L10N">Chapter 8, <i>I18N and L10N</i></a>) supports.</p>
<div class="table">
<a name="thenotablefilescreatedbydpkg"></a><p class="title"><b>Table 2.17. The notable files created by <code class="literal">dpkg</code></b></p>
<div class="table-contents"><table summary="The notable files created by dpkg" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
file
</th>
<th align="left">
description of contents
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.conffiles</code>
</td>
<td align="left">
list of configuration files. (user modifiable)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.list</code>
</td>
<td align="left">
list of files and directories installed by the package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.md5sums</code>
</td>
<td align="left">
list of MD5 hash values for files installed by the package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.preinst</code>
</td>
<td align="left">
package script run before the package installation
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.postinst</code>
</td>
<td align="left">
package script run after the package installation
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.prerm</code>
</td>
<td align="left">
package script run before the package removal
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.postrm</code>
</td>
<td align="left">
package script run after the package removal
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.config</code>
</td>
<td align="left">
package script for <code class="literal">debconf</code> system
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/alternatives/&lt;package_name&gt;</code>
</td>
<td align="left">
the alternative information used by the <code class="literal">update-alternatives</code> command
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/available</code>
</td>
<td align="left">
the availability information for all the package
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/diversions</code>
</td>
<td align="left">
the diversions information used by <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span> and set by`dpkg-divert`(8)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/statoverride</code>
</td>
<td align="left">
the stat override information used by <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span> and set by`dpkg-statoverride`(8)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/status</code>
</td>
<td align="left">
the status information for all the packages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/lib/dpkg/status-old</code>
</td>
<td align="left">
the first-generation backup of the "<code class="literal">var/lib/dpkg/status</code>" file
</td>
</tr>
<tr>
<td align="left">
<code class="literal">/var/backups/dpkg.status*</code>
</td>
<td align="left">
the second-generation backup and older ones of the "<code class="literal">var/lib/dpkg/status</code>" file
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>The "<code class="literal">status</code>" file is also used by the tools such as <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span>, "<code class="literal">dselect update</code>" and "<code class="literal">apt-get -u dselect-upgrade</code>".</p>
<p>The specialized search command <span class="citerefentry"><span class="refentrytitle">grep-dctrl</span>(1)</span> can search the local copies of "<code class="literal">status</code>" and "<code class="literal">available</code>" meta data.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>In <a class="ulink" href="http://www.debian.org/devel/debian-installer/" target="_top">the debian-installer</a> environment, the <code class="literal">udpkg</code> command is used to open <code class="literal">udeb</code> packages. The <code class="literal">udpkg</code> command is a stripped down version of the <code class="literal">dpkg</code> command.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_update_alternative_command"></a>2.5.10. The update-alternative command</h3></div></div></div>
<p>The Debian system has mechanism to install somewhat overlapping programs peacefully using <span class="citerefentry"><span class="refentrytitle">update-alternatives</span>(8)</span>. For example, you can make the <code class="literal">vi</code> command select to run <code class="literal">vim</code> while installing both <code class="literal">vim</code> and <code class="literal">nvi</code> packages.</p>
<pre class="screen">$ ls -l $(type -p vi)
lrwxrwxrwx 1 root root 20 2007-03-24 19:05 /usr/bin/vi -&gt; /etc/alternatives/vi
$ sudo update-alternatives --display vi
...
$ sudo update-alternatives --config vi
Selection Command
----------------------------------------------
1 /usr/bin/vim
*+ 2 /usr/bin/nvi
Enter to keep the default[*], or type selection number: 1</pre>
<p>The Debian alternatives system keeps its selection as symlinks in "<code class="literal">/etc/alternatives/</code>". The selection process uses corresponding file in "<code class="literal">/var/lib/dpkg/alternatives/</code>".</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_dpkg_statoverride_command"></a>2.5.11. The dpkg-statoverride command</h3></div></div></div>
<p><span class="strong"><strong>Stat overrides</strong></span> provided by the <span class="citerefentry"><span class="refentrytitle">dpkg-statoverride</span>(8)</span> command are a way to tell <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span> to use a different owner or mode for a <span class="strong"><strong>file</strong></span> when a package is installed. If "<code class="literal">--update</code>" is specified and file exists, it is immediately set to the new owner and mode.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>The direct alteration of owner or mode for a <span class="strong"><strong>file</strong></span> owned by the package using <code class="literal">chmod</code> or <code class="literal">chown</code> commands by the system administrator is reset by the next upgrade of the package.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>I use the word <span class="strong"><strong>file</strong></span> here, but in reality this can be any filesystem object that <code class="literal">dpkg</code> handles, including directories, devices, etc.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_dpkg_divert_command"></a>2.5.12. The dpkg-divert command</h3></div></div></div>
<p>File <span class="strong"><strong>diversions</strong></span> provided by the <span class="citerefentry"><span class="refentrytitle">dpkg-divert</span>(8)</span> command are a way of forcing <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span> not to install a file into its default location, but to a <span class="strong"><strong>diverted</strong></span> location. The use of <code class="literal">dpkg-divert</code> is meant for the package maintenance scripts. Its casual use by the system administrator is deprecated.</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_recovery_from_a_broken_system"></a>2.6. Recovery from a broken system</h2></div></div></div>
<p>When running <code class="literal">unstable</code> system, the administrator is expected to recover from broken package management situation.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Some methods described here are high risk actions. You have been warned!</p></td></tr>
</table></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_incompatibility_with_old_user_configuration"></a>2.6.1. Incompatibility with old user configuration</h3></div></div></div>
<p>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.)</p>
<p>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.)</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_different_packages_with_overlapped_files"></a>2.6.2. Different packages with overlapped files</h3></div></div></div>
<p>Archive level package management systems, such as <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span> or <span class="citerefentry"><span class="refentrytitle">apt-get</span>(1)</span>, do not even try to install packages with overlapped files using package dependencies (see <a class="xref" href="ch02.en.html#_package_dependencies" title="2.1.5. Package dependencies">Section 2.1.5, “Package dependencies”</a>).</p>
<p>Errors by the package maintainer or deployment of inconsistently mixed source of archives (see <a class="xref" href="ch02.en.html#_packages_from_mixed_source_of_archives" title="2.7.2. Packages from mixed source of archives">Section 2.7.2, “Packages from mixed source of archives”</a>) by the system administrator may create situation with incorrectly defined package dependencies. When you install a package with overlapped files using <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span> or <span class="citerefentry"><span class="refentrytitle">apt-get</span>(1)</span> under such situation, <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span> which unpacks package ensures to return error to the calling program without overwriting existing files.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>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 <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span> command only protects against overwriting by the unpacking.</p></td></tr>
</table></div>
<p>You can work around such broken installation by removing the old offending package, <code class="literal">&lt;old-package&gt;</code>, first.</p>
<pre class="screen">$ sudo dpkg -P &lt;old-package&gt;</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_fixing_broken_package_script"></a>2.6.3. Fixing broken package script</h3></div></div></div>
<p>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.</p>
<p>For the package script problem of "<code class="literal">&lt;package_name&gt;</code>", you should look into following package scripts.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
"<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.preinst</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.postinst</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.prerm</code>"
</p></li>
<li class="listitem"><p>
"<code class="literal">/var/lib/dpkg/info/&lt;package_name&gt;.postrm</code>"
</p></li>
</ul></div>
<p>Edit the offending package script from the root using following techniques.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
disable the offending line by preceding "<code class="literal">#</code>"
</p></li>
<li class="listitem"><p>
force to return success by appending the offending line with "<code class="literal">|| true</code>"
</p></li>
</ul></div>
<p>Configure all partially installed packages with the following command.</p>
<pre class="screen"># dpkg --configure -a</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_rescue_with_the_dpkg_command"></a>2.6.4. Rescue with the dpkg command</h3></div></div></div>
<p>Since <code class="literal">dpkg</code> is very low level package tool, it can function under the very bad situation such as unbootable system without network connection. Let's assume <code class="literal">foo</code> package was broken and needs to be replaced.</p>
<p>You may still find cached copies of older bug free version of <code class="literal">foo</code> package in the package cache directory: "<code class="literal">/var/cache/apt/archives/</code>". (If not, you can download it from archive of <a class="ulink" href="http://snapshot.debian.net/" target="_top">http://snapshot.debian.net/</a> or copy it from package cache of a functioning machine.)</p>
<p>If you can boot the system, you may install it by the following command.</p>
<pre class="screen"># dpkg -i /path/to/foo_&lt;old_version&gt;_&lt;arch&gt;.deb</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>If system breakage is minor, you may alternatively downgrade the whole system as <a class="xref" href="ch02.en.html#_emergency_downgrading" title="2.7.10. Emergency downgrading">Section 2.7.10, “Emergency downgrading”</a> using the higher level APT system.</p></td></tr>
</table></div>
<p>If your system is unbootable from hard disk, you should seek other ways to boot it.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Boot the system using the debian-installer CD in rescue mode.
</p></li>
<li class="listitem"><p>
Mount the unbootable system on the hard disk to "<code class="literal">/target</code>".
</p></li>
<li class="listitem"><p>
Install older version of <code class="literal">foo</code> package by the following.
</p></li>
</ol></div>
<pre class="screen"># dpkg --root /target -i /path/to/foo_&lt;old_version&gt;_&lt;arch&gt;.deb</pre>
<p>This example works even if the <code class="literal">dpkg</code> command on the hard disk is broken.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
<p>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 <code class="literal">dpkg</code>'s "<code class="literal">--ignore-depends</code>", "<code class="literal">--force-depends</code>" and other options. If you do this, you need to make serious effort to restore proper dependency later. See <span class="citerefentry"><span class="refentrytitle">dpkg</span>(8)</span> for details.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>When your system is seriously broken, you should make a full backup of system to a safe place (see <a class="xref" href="ch10.en.html#_backup_and_recovery" title="10.1.6. Backup and recovery">Section 10.1.6, “Backup and recovery”</a>) and should perform a clean installation. This is less time consuming and produces better results in the end.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_recovering_package_selection_data"></a>2.6.5. Recovering package selection data</h3></div></div></div>
<p>If "<code class="literal">/var/lib/dpkg/status</code>" becomes corrupt for any reason, the Debian system loses package selection data and suffers severely. Look for the old "<code class="literal">/var/lib/dpkg/status</code>" file at "<code class="literal">/var/lib/dpkg/status-old</code>" or "<code class="literal">/var/backups/dpkg.status.*</code>".</p>
<p>Keeping "<code class="literal">/var/backups/</code>" in a separate partition may be a good idea since this directory contains lots of important system data.</p>
<p>For serious breakage, I recommend to make fresh re-install after making backup of the system. Even if everything in "<code class="literal">/var/</code>" is gone, you can still recover some information from directories in "<code class="literal">/usr/share/doc/</code>" to guide your new installation.</p>
<p>Reinstall minimal (desktop) system.</p>
<pre class="screen"># mkdir -p /path/to/old/system</pre>
<p>Mount old system at "<code class="literal">/path/to/old/system/</code>".</p>
<pre class="screen"># cd /path/to/old/system/usr/share/doc
# ls -1 &gt;~/ls1.txt
# cd /usr/share/doc
# ls -1 &gt;&gt;~/ls1.txt
# cd
# sort ls1.txt | uniq | less</pre>
<p>Then you are presented with package names to install. (There may be some non-package names such as "<code class="literal">texmf</code>".)</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_tips_for_the_package_management"></a>2.7. Tips for the package management</h2></div></div></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_how_to_pick_debian_packages"></a>2.7.1. How to pick Debian packages</h3></div></div></div>
<p>You can seek packages which satisfy your needs with <code class="literal">aptitude</code> from the package description or from the list under "Tasks".</p>
<p>When you encounter more than 2 similar packages and wonder which one to install without "trial and error" efforts, you should use some <span class="strong"><strong>common sense</strong></span>. I consider following points are good indications of preferred packages.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Essential: yes &gt; no
</p></li>
<li class="listitem"><p>
Component: main &gt; contrib &gt; non-free
</p></li>
<li class="listitem"><p>
Priority: required &gt; important &gt; standard &gt; optional &gt; extra
</p></li>
<li class="listitem"><p>
Tasks: packages listed in tasks such as "Desktop environment"
</p></li>
<li class="listitem"><p>
Packages selected by the dependency package (e.g., <code class="literal">python2.4</code> by <code class="literal">python</code>)
</p></li>
<li class="listitem"><p>
Popcon: higher in the vote and install number
</p></li>
<li class="listitem"><p>
Changelog: regular updates by the maintainer
</p></li>
<li class="listitem"><p>
BTS: No RC bugs (no critical, no grave, and no serious bugs)
</p></li>
<li class="listitem"><p>
BTS: responsive maintainer to bug reports
</p></li>
<li class="listitem"><p>
BTS: higher number of the recently fixed bugs
</p></li>
<li class="listitem"><p>
BTS: lower number of remaining non-wishlist bugs
</p></li>
</ul></div>
<p>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.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_packages_from_mixed_source_of_archives"></a>2.7.2. Packages from mixed source of archives</h3></div></div></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>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 <code class="literal">stable</code> with <a class="ulink" href="http://www.debian.org/security/" target="_top">security updates</a> and <a class="ulink" href="http://www.debian.org/News/2011/20110215" target="_top">squeeze-updates</a>.</p></td></tr>
</table></div>
<p>Here is an example of operations to include specific newer upstream version packages found in <code class="literal">unstable</code> while tracking <code class="literal">testing</code> for single occasion.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Change the "<code class="literal">/etc/apt/sources.list</code>" file temporarily to single "<code class="literal">unstable</code>" entry.
</p></li>
<li class="listitem"><p>
Run "<code class="literal">aptitude update</code>".
</p></li>
<li class="listitem"><p>
Run "<code class="literal">aptitude install &lt;package-name&gt;</code>".
</p></li>
<li class="listitem"><p>
Recover the original "<code class="literal">/etc/apt/sources.list</code>" file for <code class="literal">testing</code>.
</p></li>
<li class="listitem"><p>
Run "<code class="literal">aptitude update</code>".
</p></li>
</ol></div>
<p>You do not create the "<code class="literal">/etc/apt/preferences</code>" file nor need to worry about apt-pinning with this manual approach. But this is very cumbersome.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
<p>General rules for installing packages from different archives are followings.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
Non-binary packages ("<code class="literal">Architecture: all</code>") are <span class="strong"><strong>safer</strong></span> to install.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
documentation packages: no special requirements
</p></li>
<li class="listitem"><p>
interpreter program packages: compatible interpreter must be available
</p></li>
</ul></div>
</li>
<li class="listitem">
<p>
Binary packages (non "<code class="literal">Architecture: all</code>") usually face many road blocks and <span class="strong"><strong>unsafe</strong></span> to install.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
library version compatibility (including "<code class="literal">libc</code>")
</p></li>
<li class="listitem"><p>
related utility program version compatibility
</p></li>
<li class="listitem"><p>
Kernel <a class="ulink" href="http://en.wikipedia.org/wiki/Application_binary_interface" target="_top">ABI</a> compatibility
</p></li>
<li class="listitem"><p>
C++ <a class="ulink" href="http://en.wikipedia.org/wiki/Application_binary_interface" target="_top">ABI</a> compatibility
</p></li>
<li class="listitem"><p>
</p></li>
</ul></div>
</li>
</ul></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>In order to make a package to be <span class="strong"><strong>safer</strong></span> to install, some commercial non-free binary program packages may be provided with completely statically linked libraries. You should still check <a class="ulink" href="http://en.wikipedia.org/wiki/Application_binary_interface" target="_top">ABI</a> compatibility issues etc. for them.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>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 <a class="xref" href="ch02.en.html#_tweaking_candidate_version" title="2.7.3. Tweaking candidate version">Section 2.7.3, “Tweaking candidate version”</a>). You should consider chroot or similar techniques (see <a class="xref" href="ch09.en.html#_virtualized_system" title="9.8. Virtualized system">Section 9.8, “Virtualized system”</a>) to run programs from different archives.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_tweaking_candidate_version"></a>2.7.3. Tweaking candidate version</h3></div></div></div>
<p>Without the "<code class="literal">/etc/apt/preferences</code>" file, APT system choses the latest available version as the <span class="strong"><strong>candidate version</strong></span> 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 "<code class="literal">/etc/apt/preferences</code>" file since some archives which should not be used as the automatic source of upgrades are marked as <span class="strong"><strong>NotAutomatic</strong></span> and dealt properly.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The version string comparison rule can be verified with, e.g., "<code class="literal">dpkg --compare-versions ver1.1 gt ver1.1~1; echo $?</code>" (see <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span>).</p></td></tr>
</table></div>
<p>When you install packages from mixed source of archives (see <a class="xref" href="ch02.en.html#_packages_from_mixed_source_of_archives" title="2.7.2. Packages from mixed source of archives">Section 2.7.2, “Packages from mixed source of archives”</a>) regularly, you can automate these complicated operations by creating the "<code class="literal">/etc/apt/preferences</code>" file with proper entries and tweaking the package selection rule for <span class="strong"><strong>candidate version</strong></span> as described in <span class="citerefentry"><span class="refentrytitle">apt_preferences</span>(5)</span>. This is called <span class="strong"><strong>apt-pinning</strong></span>.</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Archive level Release files (see <a class="xref" href="ch02.en.html#_archive_level_release_files" title='2.5.3. Archive level "Release" files'>Section 2.5.3, “Archive level "Release" files”</a>) are used for the rule of <span class="citerefentry"><span class="refentrytitle">apt_preferences</span>(5)</span>. Thus apt-pinning works only with "suite" name for <a class="ulink" href="http://ftp.us.debian.org/debian/dists/" target="_top">normal Debian archives</a> and <a class="ulink" href="http://security.debian.org/dists/" target="_top">security Debian archives</a>. (This is different from <a class="ulink" href="http://www.ubuntu.com/" target="_top">Ubuntu</a> archives). For example, you can do "<code class="literal">Pin: release a=unstable</code>" but can not do "<code class="literal">Pin: release a=sid</code>" in the "<code class="literal">/etc/apt/preferences</code>" file.</p></td></tr>
</table></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Even if you do not create the "<code class="literal">/etc/apt/preferences</code>" file, you can do fairly complex system operations (see <a class="xref" href="ch02.en.html#_rescue_with_the_dpkg_command" title="2.6.4. Rescue with the dpkg command">Section 2.6.4, “Rescue with the dpkg command”</a> and <a class="xref" href="ch02.en.html#_packages_from_mixed_source_of_archives" title="2.7.2. Packages from mixed source of archives">Section 2.7.2, “Packages from mixed source of archives”</a>) without apt-pinning.</p></td></tr>
</table></div>
<p>Here is a simplified explanation of <span class="strong"><strong>apt-pinning</strong></span> technique.</p>
<p>APT system choses highest Pin-Priority <span class="strong"><strong>upgrading</strong></span> package from available package sources defined in the "<code class="literal">/etc/apt/sources.list</code>" file as the <span class="strong"><strong>candidate version</strong></span> package. If the Pin-Priority of the package is larger than 1000, this version restriction for <span class="strong"><strong>upgrading</strong></span> is dropped to enable downgrading (see <a class="xref" href="ch02.en.html#_emergency_downgrading" title="2.7.10. Emergency downgrading">Section 2.7.10, “Emergency downgrading”</a>).</p>
<p>Pin-Priority value of each package is defined by "Pin-Priority" entries in the "<code class="literal">/etc/apt/preferences</code>" file or uses its default value.</p>
<div class="table">
<a name="listofnotablepinpinningtechnique"></a><p class="title"><b>Table 2.18. List of notable Pin-Priority values for <span class="strong">apt-pinning</span> technique.</b></p>
<div class="table-contents"><table summary="List of notable Pin-Priority values for apt-pinning technique." border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
Pin-Priority
</th>
<th align="left">
apt-pinning effects to the package
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
1001
</td>
<td align="left">
install the package even if this constitutes a downgrade of the package
</td>
</tr>
<tr>
<td align="left">
990
</td>
<td align="left">
used as the default for the <span class="strong"><strong>target release</strong></span> archive
</td>
</tr>
<tr>
<td align="left">
500
</td>
<td align="left">
used as the default for the <span class="strong"><strong>normal</strong></span> archive
</td>
</tr>
<tr>
<td align="left">
100
</td>
<td align="left">
used as the default for the <span class="strong"><strong>NotAutomatic</strong></span> and <span class="strong"><strong>ButAutomaticUpgrades</strong></span> archive
</td>
</tr>
<tr>
<td align="left">
100
</td>
<td align="left">
used for the <span class="strong"><strong>installed</strong></span> package
</td>
</tr>
<tr>
<td align="left">
1
</td>
<td align="left">
used as the default for the <span class="strong"><strong>NotAutomatic</strong></span> archive
</td>
</tr>
<tr>
<td align="left">
-1
</td>
<td align="left">
<span class="strong"><strong>never install</strong></span> the package even if recommended
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>The <span class="strong"><strong>target release</strong></span> archive can be set by several methods.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
"<code class="literal">/etc/apt/apt.conf</code>" configuration file with "<code class="literal">APT::Default-Release "stable";</code>" line
</p></li>
<li class="listitem"><p>
command line option, e.g., "<code class="literal">apt-get install -t testing some-package</code>"
</p></li>
</ul></div>
<p>The <span class="strong"><strong>NotAutomatic</strong></span> and <span class="strong"><strong>ButAutomaticUpgrades</strong></span> archive is set by archive server having its archive level Release file (see <a class="xref" href="ch02.en.html#_archive_level_release_files" title='2.5.3. Archive level "Release" files'>Section 2.5.3, “Archive level "Release" files”</a>) containing both "<code class="literal">NotAutomatic: yes</code>" and "<code class="literal">ButAutomaticUpgrades: yes</code>". The <span class="strong"><strong>NotAutomatic</strong></span> archive is set by archive server having its archive level Release file containing only "<code class="literal">NotAutomatic: yes</code>".</p>
<p>The <span class="strong"><strong>apt-pinning situation</strong></span> of &lt;package&gt; from multiple archive sources is displayed by "<code class="literal">apt-cache policy &lt;package&gt;</code>".</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
A line started with "<code class="literal">Package pin:</code>" lists the package version of <span class="strong"><strong>pin</strong></span> if association just with &lt;package&gt; is defined, e.g., "<code class="literal">Package pin: 0.190</code>".
</p></li>
<li class="listitem"><p>
No line with "<code class="literal">Package pin:</code>" exists if no association just with &lt;package&gt; is defined.
</p></li>
<li class="listitem"><p>
The Pin-Priority value associated just with &lt;package&gt; is listed right side of all version strings, e.g., "<code class="literal">0.181 700</code>".
</p></li>
<li class="listitem"><p>
"<code class="literal">0</code>" is listed right side of all version strings if no association just with &lt;package&gt; is defined, e.g., "<code class="literal">0.181 0</code>".
</p></li>
<li class="listitem"><p>
The Pin-Priority values of archives (defined as "<code class="literal">Package: *</code>" in the "<code class="literal">/etc/apt/preferences</code>" file) are listed left side of all archive paths, e.g., "<code class="literal">100 http://backports.debian.org/debian-backports/ squeeze-backports/main Packages</code>".
</p></li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_updates_and_backports"></a>2.7.4. Updates and Backports</h3></div></div></div>
<p>There are <a class="ulink" href="http://www.debian.org/News/2011/20110215" target="_top">squeeze-updates</a> and <a class="ulink" href="http://backports.debian.org" target="_top">backports.debian.org</a> archives which provide updgrade packages for <code class="literal">stable</code> (<code class="literal">squeeze</code>).</p>
<p>In order to use these archives, you list all required archives in the "<code class="literal">/etc/apt/sources.list</code>" file as the following.</p>
<pre class="screen">deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main contrib
deb http://ftp.us.debian.org/debian/ squeeze-updates main contrib non-free
deb http://backports.debian.org/debian-backports/ squeeze-backports main contrib non-free</pre>
<p>There is no need to set Pin-Priority value explicitly in the "<code class="literal">/etc/apt/preferences</code>" file. When newer packages become available, the default configuration provides most reasonable upgrades (see <a class="xref" href="ch02.en.html#_archive_level_release_files" title='2.5.3. Archive level "Release" files'>Section 2.5.3, “Archive level "Release" files”</a>).</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
All installed older packages are upgraded to newer ones from <code class="literal">squeeze-updates</code>.
</p></li>
<li class="listitem"><p>
Only manually installed older packages from <code class="literal">squeeze-backports</code> are upgraded to newer ones from <code class="literal">squeeze-backports</code>.
</p></li>
</ul></div>
<p>Whenever you wish to install a package named "<code class="literal">&lt;package-name&gt;</code>" with its dependency from <code class="literal">squeeze-backports</code> archive manually, you use following command while switching target release with "<code class="literal">-t</code>" option.</p>
<pre class="screen">$ sudo apt-get install -t squeeze-backports &lt;package-name&gt;</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_blocking_packages_installed_by_recommends"></a>2.7.5. Blocking packages installed by "Recommends"</h3></div></div></div>
<p>If you wish not to pull in particular packages automatically by "Recommends", you must create the "<code class="literal">/etc/apt/preferences</code>" file and explicitly list all those packages at the top of it as the following.</p>
<pre class="screen">Package: &lt;package-1&gt;
Pin: version *
Pin-Priority: -1
Package: &lt;package-2&gt;
Pin: version *
Pin-Priority: -1</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_tracking_literal_testing_literal_with_some_packages_from_literal_unstable_literal"></a>2.7.6. Tracking <code class="literal">testing</code> with some packages from <code class="literal">unstable</code>
</h3></div></div></div>
<p>Here is an example of <span class="strong"><strong>apt-pinning</strong></span> technique to include specific newer upstream version packages found in <code class="literal">unstable</code> regularly upgraded while tracking <code class="literal">testing</code>. You list all required archives in the "<code class="literal">/etc/apt/sources.list</code>" file as the following.</p>
<pre class="screen">deb http://ftp.us.debian.org/debian/ testing main contrib non-free
deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
deb http://security.debian.org/ testing/updates main contrib</pre>
<p>Set the "<code class="literal">/etc/apt/preferences</code>" file as as the following.</p>
<pre class="screen">Package: *
Pin: release a=unstable
Pin-Priority: 100</pre>
<p>When you wish to install a package named "<code class="literal">&lt;package-name&gt;</code>" with its dependencies from <code class="literal">unstable</code> archive under this configuration, you issue the following command which switches target release with "<code class="literal">-t</code>" option (Pin-Priority of <code class="literal">unstable</code> becomes 990.).</p>
<pre class="screen">$ sudo apt-get install -t unstable &lt;package-name&gt;</pre>
<p>With this configuration, usual execution of "<code class="literal">apt-get upgrade</code>" and "<code class="literal">apt-get dist-upgrade</code>" (or "<code class="literal">aptitude safe-upgrade</code>" and "<code class="literal">aptitude full-upgrade</code>") upgrades packages which were installed from <code class="literal">testing</code> archive using current <code class="literal">testing</code> archive and packages which were installed from <code class="literal">unstable</code> archive using current <code class="literal">unstable</code> archive.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Be careful not to remove "<code class="literal">testing</code>" entry from the "<code class="literal">/etc/apt/sources.list</code>" file. Without "<code class="literal">testing</code>" entry in it, APT system upgrades packages using newer <code class="literal">unstable</code> archive.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>I usually edit the "<code class="literal">/etc/apt/sources.list</code>" file to comment out "<code class="literal">unstable</code>" archive entry right after above operation. This avoids slow update process of having too many entries in the "<code class="literal">/etc/apt/sources.list</code>" file although this prevents upgrading packages which were installed from <code class="literal">unstable</code> archive using current <code class="literal">unstable</code> archive.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>If "<code class="literal">Pin-Priority: 1</code>" is used instead of "<code class="literal">Pin-Priority: 100</code>" for the "<code class="literal">/etc/apt/preferences</code>" file, already installed packages having Pin-Priority value of 100 are not upgraded by <code class="literal">unstable</code> archive even if "<code class="literal">testing</code>" entry in the "<code class="literal">/etc/apt/sources.list</code>" file is removed.</p></td></tr>
</table></div>
<p>If you wish to track particular packages in <code class="literal">unstable</code> automatically without initial "<code class="literal">-t unstable</code>" installation, you must create the "<code class="literal">/etc/apt/preferences</code>" file and explicitly list all those packages at the top of it as the following.</p>
<pre class="screen">Package: &lt;package-1&gt;
Pin: release a=unstable
Pin-Priority: 700
Package: &lt;package-2&gt;
Pin: release a=unstable
Pin-Priority: 700</pre>
<p>These set Pin-Priority value for each specific package. For example, in order to track the latest <code class="literal">unstable</code> version of this "Debian Reference" in English, you should have following entries in the "<code class="literal">/etc/apt/preferences</code>" file.</p>
<pre class="screen">Package: debian-reference-en
Pin: release a=unstable
Pin-Priority: 700
Package: debian-reference-common
Pin: release a=unstable
Pin-Priority: 700</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>This apt-pinning technique is valid even when you are tracking <code class="literal">stable</code> archive. Documentation packages have been always safe to install from <code class="literal">unstable</code> archive in my experience, so far.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_tracking_literal_unstable_literal_with_some_packages_from_literal_experimental_literal"></a>2.7.7. Tracking <code class="literal">unstable</code> with some packages from <code class="literal">experimental</code>
</h3></div></div></div>
<p>Here is another example of <span class="strong"><strong>apt-pinning</strong></span> technique to include specific newer upstream version packages found in <code class="literal">experimental</code> while tracking <code class="literal">unstable</code>. You list all required archives in the "<code class="literal">/etc/apt/sources.list</code>" file as the following.</p>
<pre class="screen">deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
deb http://ftp.us.debian.org/debian/ experimental main contrib non-free
deb http://security.debian.org/ testing/updates main contrib</pre>
<p>The default Pin-Priority value for <code class="literal">experimental</code> archive is always 1 (&lt;&lt;100) since it is <span class="strong"><strong>NotAutomatic</strong></span> archive (see <a class="xref" href="ch02.en.html#_archive_level_release_files" title='2.5.3. Archive level "Release" files'>Section 2.5.3, “Archive level "Release" files”</a>). There is no need to set Pin-Priority value explicitly in the "<code class="literal">/etc/apt/preferences</code>" file just to use <code class="literal">experimental</code> archive unless you wish to track particular packages in it automatically for next upgrading.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_automatic_download_and_upgrade_of_packages"></a>2.7.8. Automatic download and upgrade of packages</h3></div></div></div>
<p>The <code class="literal">apt</code> package comes with its own cron script "<code class="literal">/etc/cron.daily/apt</code>" to support the automatic download of packages. This script can be enhanced to perform the automatic upgrade of packages by installing the <code class="literal">unattended-upgrades</code> package. These can be customized by parameters in "<code class="literal">/etc/apt/apt.conf.d/02backup</code>" and "<code class="literal">/etc/apt/apt.conf.d/50unattended-upgrades</code>" as described in "<code class="literal">/usr/share/doc/unattended-upgrades/README</code>".</p>
<p>The <code class="literal">unattended-upgrades</code> package is mainly intended for the security upgrade for the <code class="literal">stable</code> system. If the risk of breaking an existing <code class="literal">stable</code> 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.</p>
<pre class="screen">APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1";</pre>
<p>If you are running an <code class="literal">unstable</code> system, you do not want to use the automatic upgrade since it certainly breaks system some day. Even for such <code class="literal">unstable</code> case, you may still want to download packages in advance to save time for the interactive upgrade with configuration parameters as the following.</p>
<pre class="screen">APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "0";</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_limiting_download_bandwidth_for_apt"></a>2.7.9. Limiting download bandwidth for APT</h3></div></div></div>
<p>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.</p>
<pre class="screen">APT::Acquire::http::Dl-Limit "800";</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_emergency_downgrading"></a>2.7.10. Emergency downgrading</h3></div></div></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
<p>You may be lucky to downgrade from newer archive to older archive to recover from broken system upgrade by manipulating <span class="strong"><strong>candidate version</strong></span> (see <a class="xref" href="ch02.en.html#_tweaking_candidate_version" title="2.7.3. Tweaking candidate version">Section 2.7.3, “Tweaking candidate version”</a>). This is lazy alternative to tedious actions of many "<code class="literal">dpkg -i &lt;broken-package&gt;_&lt;old-version&gt;.deb</code>" commands (see <a class="xref" href="ch02.en.html#_rescue_with_the_dpkg_command" title="2.6.4. Rescue with the dpkg command">Section 2.6.4, “Rescue with the dpkg command”</a>).</p>
<p>Search lines in the "<code class="literal">/etc/apt/sources.list</code>" file tracking <code class="literal">unstable</code> as the following.</p>
<pre class="screen">deb http://ftp.us.debian.org/debian/ sid main contrib non-free</pre>
<p>Replace it with the following to track <code class="literal">testing</code>.</p>
<pre class="screen">deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free</pre>
<p>Set the "<code class="literal">/etc/apt/preferences</code>" file as the following.</p>
<pre class="screen">Package: *
Pin: release a=testing
Pin-Priority: 1010</pre>
<p>Run "<code class="literal">apt-get dist-upgrade</code>" to force downgrading of packages across the system.</p>
<p>Remove this special "<code class="literal">/etc/apt/preferences</code>" file after this emergency downgrading.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_who_uploaded_the_package"></a>2.7.11. Who uploaded the package?</h3></div></div></div>
<p>Although the maintainer name listed in "<code class="literal">/var/lib/dpkg/available</code>" and "<code class="literal">/usr/share/doc/package_name/changelog</code>" provide some information on "who is behind the packaging activity", the actual uploader of the package is somewhat obscure. <span class="citerefentry"><span class="refentrytitle">who-uploads</span>(1)</span> in the <code class="literal">devscripts</code> package identifies the actual uploader of Debian source packages.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_equivs_package"></a>2.7.12. The equivs package</h3></div></div></div>
<p>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 (<code class="literal">*.deb</code>) and use private archive.</p>
<p>If you chose to compile a program from source and to install them under "<code class="literal">/usr/local</code>" instead, you may need to use <code class="literal">equivs</code> as a last resort to satisfy the missing package dependency.</p>
<pre class="screen">Package: equivs
Priority: extra
Section: admin
Description: Circumventing Debian package dependencies
This is a dummy package which can be used to create Debian
packages, which only contain dependency information.</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_porting_a_package_to_the_stable_system"></a>2.7.13. Porting a package to the stable system</h3></div></div></div>
<p>For partial upgrades of the <code class="literal">stable</code> system, rebuilding a package within its environment using the source package is desirable. This avoids massive package upgrades due to their dependencies.</p>
<p>Add the following entries to the "<code class="literal">/etc/apt/sources.list</code>" of a <code class="literal">stable</code> system.</p>
<pre class="screen">deb-src http://http.us.debian.org/debian unstable main contrib non-free</pre>
<p>Install required packages for the compilation and download the source package as the following.</p>
<pre class="screen"># apt-get update
# apt-get dist-upgrade
# apt-get install fakeroot devscripts build-essential
$ apt-get build-dep foo
$ apt-get source foo
$ cd foo*</pre>
<p>Adjust installed packages if needed.</p>
<p>Execute the following.</p>
<pre class="screen">$ dch -i</pre>
<p>Bump package version, e.g. one appended with "<code class="literal">+bp1</code>" in "<code class="literal">debian/changelog</code>"</p>
<p>Build packages and install them to the system as the following.</p>
<pre class="screen">$ debuild
$ cd ..
# debi foo*.changes</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_proxy_server_for_apt"></a>2.7.14. Proxy server for APT</h3></div></div></div>
<p>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 <a class="ulink" href="http://en.wikipedia.org/wiki/Local_area_network" target="_top">LAN</a>. APT can be configure to use generic web (http) proxy servers such as <code class="literal">squid</code> (see <a class="xref" href="ch06.en.html#_other_network_application_servers" title="6.10. Other network application servers">Section 6.10, “Other network application servers”</a>) as described in <span class="citerefentry"><span class="refentrytitle">apt.conf</span>(5)</span> and in "<code class="literal">/usr/share/doc/apt/examples/configure-index.gz</code>". The "<code class="literal">$http_proxy</code>" environment variable can be used to override proxy server setting in the "<code class="literal">/etc/apt/apt.conf</code>" file.</p>
<p>There are proxy tools specially for Debian archive. You should check BTS before using them.</p>
<div class="table">
<a name="listoftheproxytofordebianarchive"></a><p class="title"><b>Table 2.19. List of the proxy tools specially for Debian archive</b></p>
<div class="table-contents"><table summary="List of the proxy tools specially for Debian archive" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/approx" target="_top">
<code class="literal">approx</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=approx" target="_top">http://qa.debian.org/popcon.php?package=approx</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/approx.html" target="_top">3537</a></td>
<td align="left">
caching proxy server for Debian archive files (compiled <a class="ulink" href="http://en.wikipedia.org/wiki/Objective_Caml" target="_top">OCaml</a> program)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apt-cacher" target="_top">
<code class="literal">apt-cacher</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apt-cacher" target="_top">http://qa.debian.org/popcon.php?package=apt-cacher</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apt-cacher.html" target="_top">311</a></td>
<td align="left">
Caching proxy for Debian package and source files (Perl program)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apt-cacher-ng" target="_top">
<code class="literal">apt-cacher-ng</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apt-cacher-ng" target="_top">http://qa.debian.org/popcon.php?package=apt-cacher-ng</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apt-cacher-ng.html" target="_top">1132</a></td>
<td align="left">
Caching proxy for distribution of software packages (compiled C++ program)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/debtorrent" target="_top">
<code class="literal">debtorrent</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=debtorrent" target="_top">http://qa.debian.org/popcon.php?package=debtorrent</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/debtorrent.html" target="_top">1185</a></td>
<td align="left">
Bittorrent proxy for downloading Debian packages (Python program)
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>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.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_small_public_package_archive"></a>2.7.15. Small public package archive</h3></div></div></div>
<p>Here is an example for creating a small public package archive compatible with the modern <span class="strong"><strong>secure APT</strong></span> system (see <a class="xref" href="ch02.en.html#_top_level_release_file_and_authenticity" title='2.5.2. Top level "Release" file and authenticity'>Section 2.5.2, “Top level "Release" file and authenticity”</a>). Let's assume few things.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Account name: "<code class="literal">foo</code>"
</p></li>
<li class="listitem"><p>
Host name: "<code class="literal">www.example.com</code>"
</p></li>
<li class="listitem"><p>
Required packages: <code class="literal">apt-utils</code>, <code class="literal">gnupg</code>, and other packages
</p></li>
<li class="listitem"><p>
URL: "<code class="literal">http://www.example.com/~foo/</code>" ( → "<code class="literal">/home/foo/public_html/index.html</code>")
</p></li>
<li class="listitem"><p>
Architecture of packages: "<code class="literal">amd64</code>"
</p></li>
</ul></div>
<p>Create an APT archive key of Foo on your server system as the following.</p>
<pre class="screen">$ ssh foo@www.example.com
$ gpg --gen-key
...
$ gpg -K
...
sec 1024D/3A3CB5A6 2008-08-14
uid Foo (ARCHIVE KEY) &lt;foo@www.example.com&gt;
ssb 2048g/6856F4A7 2008-08-14
$ gpg --export -a 3A3CB5A6 &gt;foo.public.key</pre>
<p>Publish the archive key file "<code class="literal">foo.public.key</code>" with the key ID "<code class="literal">3A3CB5A6</code>" for Foo</p>
<p>Create an archive tree called "Origin: Foo" as the following.</p>
<pre class="screen">$ umask 022
$ mkdir -p ~/public_html/debian/pool/main
$ mkdir -p ~/public_html/debian/dists/unstable/main/binary-amd64
$ mkdir -p ~/public_html/debian/dists/unstable/main/source
$ cd ~/public_html/debian
$ cat &gt; dists/unstable/main/binary-amd64/Release &lt;&lt; EOF
Archive: unstable
Version: 4.0
Component: main
Origin: Foo
Label: Foo
Architecture: amd64
EOF
$ cat &gt; dists/unstable/main/source/Release &lt;&lt; EOF
Archive: unstable
Version: 4.0
Component: main
Origin: Foo
Label: Foo
Architecture: source
EOF
$ cat &gt;aptftp.conf &lt;&lt;EOF
APT::FTPArchive::Release {
Origin "Foo";
Label "Foo";
Suite "unstable";
Codename "sid";
Architectures "amd64";
Components "main";
Description "Public archive for Foo";
};
EOF
$ cat &gt;aptgenerate.conf &lt;&lt;EOF
Dir::ArchiveDir ".";
Dir::CacheDir ".";
TreeDefault::Directory "pool/";
TreeDefault::SrcDirectory "pool/";
Default::Packages::Extensions ".deb";
Default::Packages::Compress ". gzip bzip2";
Default::Sources::Compress "gzip bzip2";
Default::Contents::Compress "gzip bzip2";
BinDirectory "dists/unstable/main/binary-amd64" {
Packages "dists/unstable/main/binary-amd64/Packages";
Contents "dists/unstable/Contents-amd64";
SrcPackages "dists/unstable/main/source/Sources";
};
Tree "dists/unstable" {
Sections "main";
Architectures "amd64 source";
};
EOF</pre>
<p>You can automate repetitive updates of APT archive contents on your server system by configuring <code class="literal">dupload</code>.</p>
<p>Place all package files into "<code class="literal">~foo/public_html/debian/pool/main/</code>" by executing "<code class="literal">dupload -t foo changes_file</code>" in client while having "<code class="literal">~/.dupload.conf</code>" containing the following.</p>
<pre class="screen">$cfg{'foo'} = {
fqdn =&gt; "www.example.com",
method =&gt; "scpb",
incoming =&gt; "/home/foo/public_html/debian/pool/main",
# The dinstall on ftp-master sends emails itself
dinstall_runs =&gt; 1,
};
$cfg{'foo'}{postupload}{'changes'} = "
echo 'cd public_html/debian ;
apt-ftparchive generate -c=aptftp.conf aptgenerate.conf;
apt-ftparchive release -c=aptftp.conf dists/unstable &gt;dists/unstable/Release ;
rm -f dists/unstable/Release.gpg ;
gpg -u 3A3CB5A6 -bao dists/unstable/Release.gpg dists/unstable/Release'|
ssh foo@www.example.com 2&gt;/dev/null ;
echo 'Package archive created!'";</pre>
<p>The <span class="strong"><strong>postupload</strong></span> hook script initiated by <span class="citerefentry"><span class="refentrytitle">dupload</span>(1)</span> creates updated archive files for each upload.</p>
<p>You can add this small public archive to the apt-line of your client system by the following.</p>
<pre class="screen">$ sudo bash
# echo "deb http://www.example.com/~foo/debian/ unstable main" \
&gt;&gt; /etc/apt/sources.list
# apt-key add foo.public.key</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>If the archive is located on the local filesystem, you can use "<code class="literal">deb file:///home/foo/debian/ …</code>" instead.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_recording_and_copying_system_configuration"></a>2.7.16. Recording and copying system configuration</h3></div></div></div>
<p>You can make a local copy of the package and debconf selection states by the following.</p>
<pre class="screen"># dpkg --get-selections '*' &gt; selection.dpkg
# debconf-get-selections &gt; selection.debconf</pre>
<p>Here, "<code class="literal">*</code>" makes "<code class="literal">selection.dpkg</code>" to include package entries for "purge" too.</p>
<p>You can transfer these 2 files to another computer, and install there with the following.</p>
<pre class="screen"># dselect update
# debconf-set-selections &lt; myselection.debconf
# dpkg --set-selections &lt; myselection.dpkg
# apt-get -u dselect-upgrade # or dselect install</pre>
<p>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 <code class="literal">fai</code> to manage the whole system.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_converting_or_installing_an_alien_binary_package"></a>2.7.17. Converting or installing an alien binary package</h3></div></div></div>
<p><span class="citerefentry"><span class="refentrytitle">alien</span>(1)</span> enables the conversion of binary packages provided in Red Hat <code class="literal">rpm</code>, Stampede <code class="literal">slp</code>, Slackware <code class="literal">tgz</code>, and Solaris <code class="literal">pkg</code> file formats into a Debian <code class="literal">deb</code> package. If you want to use a package from another Linux distribution than the one you have installed on your system, you can use <code class="literal">alien</code> to convert it from your preferred package format and install it. <code class="literal">alien</code> also supports LSB packages.</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p><span class="citerefentry"><span class="refentrytitle">alien</span>(1)</span> should not be used to replace essential system packages, such as <code class="literal">sysvinit</code>, <code class="literal">libc6</code>, <code class="literal">libpam-modules</code>, etc. Practically, <span class="citerefentry"><span class="refentrytitle">alien</span>(1)</span> should only used for <span class="strong"><strong>non-free</strong></span> binary-only packages which are LSB compliant or statically linked. For free softwares, you should use their source packages to make real Debian packages.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_extracting_package_without_dpkg"></a>2.7.18. Extracting package without dpkg</h3></div></div></div>
<p>The current "<code class="literal">*.deb</code>" package contents can be extracted without using <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span> on any <a class="ulink" href="http://en.wikipedia.org/wiki/Unix-like" target="_top">Unix-like</a> environment using standard <span class="citerefentry"><span class="refentrytitle">ar</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span>.</p>
<pre class="screen"># ar x /path/to/dpkg_&lt;version&gt;_&lt;arch&gt;.deb
# ls
total 24
-rw-r--r-- 1 bozo bozo 1320 2007-05-07 00:11 control.tar.gz
-rw-r--r-- 1 bozo bozo 12837 2007-05-07 00:11 data.tar.gz
-rw-r--r-- 1 bozo bozo 4 2007-05-07 00:11 debian-binary
# mkdir control
# mkdir data
# tar xvzf control.tar.gz -C control
# tar xvzf data.tar.gz -C data</pre>
<p>You can also browse package content using the <code class="literal">mc</code> command.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_more_readings_for_the_package_management"></a>2.7.19. More readings for the package management</h3></div></div></div>
<p>You can learn more on the package management from following documentations.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
Primary documentations on the package management:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">tasksel</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">apt-get</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">apt-config</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">apt-key</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">sources.list</span>(5)</span>, <span class="citerefentry"><span class="refentrytitle">apt.conf</span>(5)</span>, and <span class="citerefentry"><span class="refentrytitle">apt_preferences</span>(5)</span>;
</p></li>
<li class="listitem"><p>
"<code class="literal">/usr/share/doc/apt-doc/guide.html/index.html</code>" and "<code class="literal">/usr/share/doc/apt-doc/offline.html/index.html</code>" from the <code class="literal">apt-doc</code> package; and
</p></li>
<li class="listitem"><p>
"<code class="literal">/usr/share/doc/aptitude/html/en/index.html</code>" from the <code class="literal">aptitude-doc-en</code> package.
</p></li>
</ul></div>
</li>
<li class="listitem">
<p>
Official and detailed documentations on the Debian archive:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p><a class="ulink" href="http://www.debian.org/doc/debian-policy/ch-archive" target="_top">"Debian Policy Manual Chapter 2 - The Debian Archive"</a>,
</p></li>
<li class="listitem"><p><a class="ulink" href="http://www.debian.org/doc/manuals/developers-reference/resources.html#archive" target="_top">"Debian Developer's Reference, Chapter 4 - Resources for Debian Developers 4.6 The Debian archive"</a>, and
</p></li>
<li class="listitem"><p><a class="ulink" href="http://www.debian.org/doc/FAQ/ch-ftparchives" target="_top">"The Debian GNU/Linux FAQ, Chapter 5 - The Debian FTP archives"</a>.
</p></li>
</ul></div>
</li>
<li class="listitem">
<p>
Tutorial for building of a Debian package for Debian users:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p><a class="ulink" href="http://www.debian.org/doc/manuals/maint-guide/" target="_top">"Debian New Maintainers' Guide"</a>.
</p></li></ul></div>
</li>
</ul></div>
</div>
</div>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="ch01.en.html"><img src="images/prev.gif" alt="Prev"></a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="ch03.en.html"><img src="images/next.gif" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 1. GNU/Linux tutorials </td>
<td width="20%" align="center"><a accesskey="h" href="index.en.html"><img src="images/home.gif" alt="Home"></a></td>
<td width="40%" align="right" valign="top"> Chapter 3. The system initialization</td>
</tr>
</table>
</div>
</body>
</html>