| 1 |
<!-- CVS revision of this document "$Revision: 1.7 $" -->
|
| 2 |
<!-- CVS revision of original english document "1.55" -->
|
| 3 |
|
| 4 |
<!--Line width ruler (ruler uses 78 characters) 34567890123456789012345-->
|
| 5 |
|
| 6 |
<chapt id="package">Debian Paket Management
|
| 7 |
|
| 8 |
<p>
|
| 9 |
Stellen Sie sicher, dass Sie einen lokalen HTTP Proxy benutzen
|
| 10 |
(<prgn>squid</prgn>) wenn Sie Pakete
|
| 11 |
mit APT herunterladen. Ein Proxy erhöht die Performanz im Netzwerk insbesondere
|
| 12 |
dann, wenn viele Debian Rechner im LAN vorhanden sind. Dieses Kapitel bezieht
|
| 13 |
sich auf ein Woody System, jedoch sollten die Informationen hier auch auf ein
|
| 14 |
Potato System (mit Ausnahme von <manref name="apt_preferences" section="5">
|
| 15 |
und Themen die Bezug auf die <file>/etc/preferences</file> Datei nehmen).
|
| 16 |
|
| 17 |
<sect id="pkg-intro">Einführung
|
| 18 |
<p>
|
| 19 |
Wenn dass Lesen der Entwickler Dokumentation zu viel für Sie ist, dann lesen
|
| 20 |
Sie zuerst dieses Kapitel um dann die ganze Vielfalt von Debian
|
| 21 |
(<tt>testing</tt>/<tt>unstable</tt>) zu nutzen :-).
|
| 22 |
|
| 23 |
<sect1>Grundlegende Tools
|
| 24 |
<p>
|
| 25 |
<example>
|
| 26 |
dselect — menü gesteuertes Paket Management Tool (top level)
|
| 27 |
dpkg — installiert Pakete (Zentrale Paket-Dateien)
|
| 28 |
apt-get — installiert Pakete (Zentrales Paket-Archiv, CLI APT)
|
| 29 |
tasksel — installiert Aufgaben-Profile (Verbund von Paketen)
|
| 30 |
aptitude — installiert Pakete (Pakete & Verbund von Paketen, ncurses APT)
|
| 31 |
deity — alternatives ncurses APT
|
| 32 |
synaptic, gsynaptic — GUI APT Alternativen
|
| 33 |
</example>
|
| 34 |
Diese Tools arbeiten nicht alle auf dem gleichen Level. <prgn>dselect</prgn>
|
| 35 |
arbeitet ein Level über APT (der Kommandozeilen Befehl ist
|
| 36 |
<prgn>apt-get</prgn>) und <prgn>dpkg</prgn>.
|
| 37 |
<p>
|
| 38 |
Um alle verfügbaren Pakete zu erfassen, nutzt APT
|
| 39 |
<file>/var/lib/apt/lists/*</file>, <prgn>dpkg</prgn> jedoch nutzt
|
| 40 |
<file>/var/lib/dpkg/available</file>. Wenn Sie Pakete direkt mit
|
| 41 |
<prgn>apt-get</prgn> oder mit einem änlichen Programm, wie z.B.
|
| 42 |
<prgn>aptitude</prgn> installiert haben, dann stellen Sie sicher, dass Sie
|
| 43 |
die Datei <file>/var/lib/dpkg/available</file> mittels <tt>[U]pdate</tt>
|
| 44 |
aus dem <prgn>dselect</prgn> Menü oder von der Kommandozeile "<tt>dselect
|
| 45 |
update</tt>" updaten, bevor Sie <tt>dselect select</tt>, <tt>tasksel</tt> oder
|
| 46 |
<tt>dpkg -l</tt> ausführen.
|
| 47 |
<p>
|
| 48 |
Was die Paket-Abhängikeiten angeht, so berücksichtigt <prgn>apt-get</prgn>
|
| 49 |
Pakete mit gesetztem <strong>depends</strong>, ignoriert aber Pakete mit
|
| 50 |
gesetztem <strong>recommends</strong> und <strong>suggests</strong>.
|
| 51 |
<prgn>dselect</prgn> bietet jedoch eine feinere Kontrolle über die Auswahl von
|
| 52 |
solchen Paketen und installiert Pakete mit gesetztem <strong>depends</strong>
|
| 53 |
und <strong>recommends</strong> per Default.
|
| 54 |
<![%f-ref;[
|
| 55 |
Siehe <ref id="depends">.
|
| 56 |
]]>
|
| 57 |
</sect1>
|
| 58 |
|
| 59 |
<sect1> Nützliche Tools
|
| 60 |
<p>
|
| 61 |
<example>
|
| 62 |
apt-cache - durchsucht den lokalen Pakete Cache
|
| 63 |
dpkg-reconfigure - erneutes konfigurieren von bereits installierten Paketen
|
| 64 |
(sofern sie denn debconf benutzten)
|
| 65 |
dpkg-source - packt und entpackt Debian Quell-Archive
|
| 66 |
dpkg-buildpackage - automatisiert den Prozess der Erstellung von Paketdateien
|
| 67 |
...
|
| 68 |
</example>
|
| 69 |
</sect1>
|
| 70 |
</sect>
|
| 71 |
|
| 72 |
<sect id="survival">Debian überlebens Befehle
|
| 73 |
<p>
|
| 74 |
Mit diesem Wissen kann jeder ein Leben des <strong>ewigen</strong> "Upgrades"
|
| 75 |
leben :-)
|
| 76 |
<p>
|
| 77 |
<![%f-ref;[
|
| 78 |
Siehe auch
|
| 79 |
<ref id="install">, <ref id="woody"> und <ref id="bin-editor">.
|
| 80 |
]]>
|
| 81 |
|
| 82 |
<sect1 id="tasksel"><var>Aufgaben-Profile</var> mit <prgn>tasksel</prgn>
|
| 83 |
installieren
|
| 84 |
<p>
|
| 85 |
<prgn>tasksel</prgn> ist das <strong>Debian Aufgaben-Profil Installations
|
| 86 |
Programm</strong>, das auch wärend der Debian Installation als
|
| 87 |
<tt>einfache</tt> Option angeboten wird.
|
| 88 |
<p>
|
| 89 |
Wenn eine Verbund von Paketen z.B. C/C++ Entwicklungs Werkzeuge benötigt
|
| 90 |
werden, ist der einfachste Weg <prgn>tasksel</prgn> zu verwenden. Stellen Sie
|
| 91 |
sicher, dass sie folgende Befehle verwenden:
|
| 92 |
<example>
|
| 93 |
# dselect update
|
| 94 |
# tasksel
|
| 95 |
</example>
|
| 96 |
</sect1>
|
| 97 |
|
| 98 |
<sect1 id="apt-install">Pakete mit APT installieren
|
| 99 |
<p>
|
| 100 |
Man kann selektiv Pakete von unterschiedlichen Archiven, unter Verwendung von
|
| 101 |
neueren Versionen von <prgn>apt-get</prgn> (>Woody) installieren, indem
|
| 102 |
man zusätzliche Quellen für <tt>unstable</tt> und <tt>testing</tt> der
|
| 103 |
<file>/etc/apt/sources.list</file> Datei hinzufügt. Dies ermöglichts es einem,
|
| 104 |
wärend man <tt>stable</tt> weiterhin als haupt Distribution beibehält,
|
| 105 |
selektive upgrades auf <tt>unstable</tt> und selektive downgrades auf
|
| 106 |
<tt>stable</tt> zu machen.
|
| 107 |
<p>
|
| 108 |
Um selektive upgrades zu machen, wärend man die <tt>testing</tt> Distribution
|
| 109 |
installiert hat, ist der Datei <file>/etc/apt/preferences</file>, folgendes
|
| 110 |
hinzu zu fügen:
|
| 111 |
<example>
|
| 112 |
Package: *
|
| 113 |
Pin: release a=stable
|
| 114 |
Pin-Priority: 500
|
| 115 |
|
| 116 |
Package: *
|
| 117 |
Pin: release a=testing
|
| 118 |
Pin-Priority: 600
|
| 119 |
|
| 120 |
Package: *
|
| 121 |
Pin: release a=unstable
|
| 122 |
Pin-Priority: 50
|
| 123 |
</example>
|
| 124 |
Der gleiche Effekt lässt sich auch folgendermaßen erzielen:
|
| 125 |
<example>
|
| 126 |
# echo 'APT::Default-Release "testing";' >> /etc/apt/apt.conf
|
| 127 |
</example>
|
| 128 |
|
| 129 |
Mit den oben genannten zusätzlichen Einträgen in der Datei
|
| 130 |
<file>/etc/apt/sources.list</file>, lassen sich folgendermaßen Pakete aus den
|
| 131 |
einzelen Debian Distributionen installieren:
|
| 132 |
<list>
|
| 133 |
<item><tt>apt-get upgrade</tt>
|
| 134 |
<p>aktualisiert nur Pakete aus dem Default-Release (testing).
|
| 135 |
<item><tt>apt-get install <var>Paket</var></tt>
|
| 136 |
<p> installiert <var>Paket</var> und dessen Abhängigkeiten aus der
|
| 137 |
<tt>testing</tt> Distribution.
|
| 138 |
<item><tt>apt-get install <var>Paket</var>/unstable</tt>
|
| 139 |
<p>installiert <var>Paket</var> aus der <tt>unstable</tt> Distribution,
|
| 140 |
wärend dessen Abhängigkeiten aus der <tt>testing</tt> Distribution
|
| 141 |
installiert werden.
|
| 142 |
<item><tt>apt-get install -t unstable <var>Paket</var></tt>
|
| 143 |
<p> installiert <var>Paket</var> aus der <tt>unstable</tt> Distribution,
|
| 144 |
und dessen Abhängigkeiten ebenfalls aus der <tt>unstable</tt> Distribution.
|
| 145 |
</list>
|
| 146 |
<p>
|
| 147 |
Wenn Sie als Ihr Basis-System die <tt>stable</tt> Distribution verwenden
|
| 148 |
möchten, dann decrementieren Sie die Pin-Priority von <tt>testing</tt> zu 60
|
| 149 |
in <file>/etc/apt/preferences</file> für das obige Beispiel. Alternativ können
|
| 150 |
Sie auch folgenden Befehl ausführen:
|
| 151 |
<example>
|
| 152 |
# echo 'APT::Default-Release "stable";' >> /etc/apt/apt.conf
|
| 153 |
</example>
|
| 154 |
<p>
|
| 155 |
Andere Befehle sind:
|
| 156 |
<example>
|
| 157 |
# apt-cache policy libc6 libc6-dev locales # check status
|
| 158 |
# apt-get install libc6=2.2.4-1 libc6-dev=2.2.4-1 locales=2.2.4-1
|
| 159 |
# apt-get -u install interesting-new-package remove-package-
|
| 160 |
# apt-get remove useless-old-package
|
| 161 |
# apt-get remove --purge really-useless-old-package
|
| 162 |
</example>
|
| 163 |
<p>
|
| 164 |
Um alle Pakete auf die <tt>stable</tt> Distribution zurückzustufen,
|
| 165 |
editieren sie die Datei <file>/etc/apt/preferences</file> wie folgt:
|
| 166 |
<example>
|
| 167 |
Package: *
|
| 168 |
Pin: release a=stable
|
| 169 |
Pin-Priority: 1001
|
| 170 |
</example>
|
| 171 |
und führen Sie "<tt>apt-get upgrade</tt>" aus. Dieser Befehl stuft
|
| 172 |
aufgrund der Pin-Priority > 1000 sämtliche Pakete herunter. Aber seien
|
| 173 |
Sie gewarnt, es könnte abhänigkeits Probleme geben.
|
| 174 |
</sect1>
|
| 175 |
|
| 176 |
<sect1 id="apt-upgrade">Mittels APT das System upgraden
|
| 177 |
<p>
|
| 178 |
Um ein System Upgrade mit APT durchzuführen:
|
| 179 |
<example>
|
| 180 |
# apt-get update
|
| 181 |
... und dann einer der folgenden Befehle:
|
| 182 |
# apt-get -u upgrade # pull all depends
|
| 183 |
# apt-get -u dist-upgrade # pull all depends and resolve dependency
|
| 184 |
# apt-get -u dselect-upgrade # follow selections set by dselect
|
| 185 |
</example>
|
| 186 |
Möchte man, dass die <tt>-u</tt> Option per Default gelten soll:
|
| 187 |
<example>
|
| 188 |
$ cat >> /etc/apt/apt.conf << .
|
| 189 |
// Zeige immer die Pakete an, du zum Upgrade gewählt wurden (-u)
|
| 190 |
APT::Get::Show-Upgraded "true";
|
| 191 |
.
|
| 192 |
</example>
|
| 193 |
<p>
|
| 194 |
Die <tt>-s</tt> Option kann genutzt werden, um ein Upgrade zu simulieren, ohne
|
| 195 |
tatsächlich ein Upgrade durchzuführen.
|
| 196 |
<p>
|
| 197 |
<prgn>dselect</prgn> Menügesteuerte Schnittstelle zu APT.
|
| 198 |
<prgn>deity</prgn> und <prgn>aptitude</prgn> sind wiederum Alternativen zu
|
| 199 |
<prgn>dselect</prgn>.
|
| 200 |
</sect1>
|
| 201 |
|
| 202 |
<sect1 id="bug-check">Überprüfe Bugs in Debian und ersuche Hilfe
|
| 203 |
<p>
|
| 204 |
Wenn Sie auf Probleme bezüglich eines bestimmten Paktes stoßen, stellen Sie
|
| 205 |
sicher, dass sie zuerst diese Seiten konsolidieren, bevor Sie um Hilfe fragen
|
| 206 |
oder einen Bug Report erstellen.
|
| 207 |
(<prgn>lynx</prgn>, <prgn>links</prgn> und <prgn>w3m</prgn> sind hier
|
| 208 |
gleichwertig):
|
| 209 |
<example>
|
| 210 |
$ lynx &bugs;
|
| 211 |
$ lynx &bugs;<var>package-name</var> # wenn der Name des Paketes bekannt ist
|
| 212 |
$ lynx &bugs;<var>bugnumber</var> # wenn die Bugnummer bekannt ist
|
| 213 |
</example>
|
| 214 |
Suchen Sie auch bei Google (www.google.de) mit Suchbegriffen wie
|
| 215 |
"site:debian.org".
|
| 216 |
<p>
|
| 217 |
Wenn Sie nicht weiter kommen, lesen Sie die guten Manuals. Setzen Sie
|
| 218 |
<tt>CDPATH</tt> wie folgt:
|
| 219 |
<example>
|
| 220 |
export CDPATH=.:/usr/local:/usr/share/doc
|
| 221 |
</example>
|
| 222 |
und dann
|
| 223 |
<example>
|
| 224 |
$ cd <var>Paketname</var>
|
| 225 |
$ mc
|
| 226 |
</example>
|
| 227 |
<![%f-ref;[
|
| 228 |
Weitere Hilfequellen sind in <ref id="support"> aufgelistet.
|
| 229 |
]]>
|
| 230 |
</sect1>
|
| 231 |
|
| 232 |
<sect1 id="apt-trouble">APT upgrade troubleshooting
|
| 233 |
<p>
|
| 234 |
Package dependency problems may occur when upgrading in
|
| 235 |
<tt>unstable</tt>/<tt>testing</tt>.
|
| 236 |
Most of the time, this is because a package that will be upgraded has a new
|
| 237 |
dependency that isn't met. These problems are fixed by using
|
| 238 |
<example>
|
| 239 |
# apt-get dist-upgrade
|
| 240 |
</example>
|
| 241 |
If this does not work, then repeat one of the following until the problem
|
| 242 |
resolves itself:
|
| 243 |
<example>
|
| 244 |
# apt-get upgrade -f # continue upgrade even after error
|
| 245 |
... or
|
| 246 |
# apt-get dist-upgrade -f # continue dist-upgrade even after error
|
| 247 |
</example>
|
| 248 |
<p>
|
| 249 |
Some really broken upgrade scripts may cause persistent trouble.
|
| 250 |
It is usually better to resolve this type of situation by inspecting the
|
| 251 |
<file>/var/lib/dpkg/info/packagename.<var>{post-,pre-}{install,removal}</var></file>
|
| 252 |
scripts of the offending package and then running:
|
| 253 |
<example>
|
| 254 |
# dpkg --configure -a # configures all partially installed packages
|
| 255 |
</example>
|
| 256 |
<p>
|
| 257 |
If a script complains about a missing configuration file, look in
|
| 258 |
<file>/etc</file> for
|
| 259 |
the corresponding configuration file. If one exists with an extension of
|
| 260 |
<tt>.new</tt>
|
| 261 |
(or something similar), change (<prgn>mv</prgn>) it to remove the suffix.
|
| 262 |
<p>
|
| 263 |
Package dependency problems may occur when installing in unstable/testing.
|
| 264 |
There are ways to circumvent dependency.
|
| 265 |
<example>
|
| 266 |
# apt-get install -f <var>package</var> # override broken dependencies
|
| 267 |
</example>
|
| 268 |
<p>
|
| 269 |
An alternative method to fix these situations is to use the
|
| 270 |
<package>equivs</package> package.
|
| 271 |
See <file>&f-equivs;</file><![%f-ref;[ and <ref id="equivs">]]>.
|
| 272 |
</sect1>
|
| 273 |
|
| 274 |
<sect1 id="rescue-dpkg">Rescue using <prgn>dpkg</prgn>
|
| 275 |
<p>
|
| 276 |
Ad hoc recovery of a crashed <prgn>dselect</prgn> (APT) can be done on a really broken
|
| 277 |
system by just using <prgn>dpkg</prgn> without APT:
|
| 278 |
<example>
|
| 279 |
# cd /var/cache/apt/archives
|
| 280 |
# dpkg -i libc6* libdb2* perl*
|
| 281 |
# dpkg -i apt* dpkg* debconf*
|
| 282 |
# dpkg -i * # until no error occurs
|
| 283 |
</example>
|
| 284 |
If a package is missing, get it from <url id="&mirror-site;" name="mirror sites"> by:
|
| 285 |
<example>
|
| 286 |
# mc # use "FTP link" pointing to Debian FTP server
|
| 287 |
</example>
|
| 288 |
As of recently, actual packages on the HTTP/FTP server may not be located
|
| 289 |
under the classic <file>/dist</file> directory but rather under the new
|
| 290 |
<file>/pool</file> directory.
|
| 291 |
<![%f-ref;[
|
| 292 |
(See <ref id="pools">.)
|
| 293 |
]]>
|
| 294 |
<p>
|
| 295 |
Then install by:
|
| 296 |
<example>
|
| 297 |
# dpkg -i /var/cache/apt/archives/<var>packagefile.deb</var>
|
| 298 |
</example>
|
| 299 |
For a broken dependency, fix it or use:
|
| 300 |
<example>
|
| 301 |
# dpkg --ignore-depends=<var>package1</var>,... -i <var>packagefile.deb</var>
|
| 302 |
# dpkg --force-depends -i <var>packagefile.deb</var>
|
| 303 |
# dpkg --force-depends --purge <var>package</var>
|
| 304 |
# dpkg --force-confmiss -i <var>packagefile.deb</var> # Install missing conffile
|
| 305 |
</example>
|
| 306 |
</sect1>
|
| 307 |
|
| 308 |
<sect1 id="rescue-var">Rescue system after erasing <file>/var</file>
|
| 309 |
<p>
|
| 310 |
If everything under the <file>/var</file> directory is erased, you can
|
| 311 |
recover control of the system if you have backup copies of
|
| 312 |
<file>/var/lib/dpkg/status</file> by:
|
| 313 |
<example>
|
| 314 |
# cd /
|
| 315 |
# install -d /var/cache/apt/archives
|
| 316 |
# install -d /var/cache/apt/archives/partial
|
| 317 |
# install -d /var/lib/dpkg/
|
| 318 |
# cp <var>status-old</var> /var/lib/dpkg/status
|
| 319 |
# apt-cache gencaches
|
| 320 |
</example>
|
| 321 |
Look for the old <file>/var/lib/dpkg/status</file> file
|
| 322 |
at <file>/var/lib/dpkg/status-old</file> or
|
| 323 |
<file>/var/backups/dpkg.status.*</file>.
|
| 324 |
<p>
|
| 325 |
Keeping <file>/var/backups/</file> in a separate partition may be a
|
| 326 |
good idea since this directory contains lots of important system data.
|
| 327 |
|
| 328 |
<sect1 id="un-bootable">Install a package into an unbootable system
|
| 329 |
<p>
|
| 330 |
Boot into Linux using a Debian rescue floppy/CD or an alternative
|
| 331 |
partition in a multi-boot Linux system.
|
| 332 |
Mount the unbootable system on <file>/target</file> and use the chroot install mode of
|
| 333 |
<prgn>dpkg</prgn>.
|
| 334 |
<example>
|
| 335 |
# dpkg --root /target -i <var>packagefile.deb</var>
|
| 336 |
</example>
|
| 337 |
Then configure and fix problems.
|
| 338 |
<p>
|
| 339 |
By the way, if a broken <prgn>lilo</prgn> is all that prevents booting, you can boot using
|
| 340 |
a standard Debian rescue disk. At boot prompt, assuming the root partition of
|
| 341 |
your Linux installation is in <file>/dev/hda12</file> and you want runlevel 3, enter:
|
| 342 |
<example>
|
| 343 |
boot: rescue root=/dev/<var>hda12</var> 3
|
| 344 |
</example>
|
| 345 |
Then you are booted into an almost fully functional system with the kernel on
|
| 346 |
floppy disk. (There may be minor glitches due to lack of kernel features or modules.)
|
| 347 |
</sect1>
|
| 348 |
|
| 349 |
<sect1>What to do if the <prgn>dpkg</prgn> command is broken
|
| 350 |
<p>
|
| 351 |
A broken <prgn>dpkg</prgn> may make it impossible to install any <tt>.deb</tt>
|
| 352 |
files. A procedure like the following will help you recover from this
|
| 353 |
situation. (In the first line, you can replace "links" with your favorite
|
| 354 |
browser command.)
|
| 355 |
<example>
|
| 356 |
$ links http://<var>http.us.debian.org</var>/debian/pool/main/d/dpkg/
|
| 357 |
... download the good dpkg_<var>version</var>_<var>arch</var>.deb
|
| 358 |
$ ar x dpkg_<var>version</var>_<var>arch</var>.deb
|
| 359 |
$ su
|
| 360 |
password: *****
|
| 361 |
# mv data.tar.gz /data.tar.gz
|
| 362 |
# cd /
|
| 363 |
# tar xzfv data.tar.gz
|
| 364 |
</example>
|
| 365 |
For <tt>i386</tt>, <tt>http://packages.debian.org/dpkg</tt> may
|
| 366 |
also be used as the URL.
|
| 367 |
</sect1>
|
| 368 |
|
| 369 |
</sect>
|
| 370 |
|
| 371 |
<sect id="debian-package">Debian nirvana commands
|
| 372 |
<p>
|
| 373 |
<strong>Enlightenment</strong> with these commands will save a person from the eternal
|
| 374 |
karmic struggle of upgrade hell and let him reach Debian <strong>nirvana</strong>. :-)
|
| 375 |
|
| 376 |
<sect1 id="info-file">Information on a file
|
| 377 |
<p>
|
| 378 |
To find the package to which a particular file belongs:
|
| 379 |
<example>
|
| 380 |
$ dpkg {-S|--search} pattern # search for pattern in installed packages
|
| 381 |
$ zgrep -e pattern <var>/local/copy/of/debian/woody/Contents-i386.gz</var>
|
| 382 |
# find filename-pattern of files in the debian archive
|
| 383 |
</example>
|
| 384 |
Or use specialized package commands:
|
| 385 |
<example>
|
| 386 |
# apt-get install dlocate
|
| 387 |
# conflicts with slocate (secure version of locate)
|
| 388 |
$ dlocate <var>filename</var> # fast alternative to dpkg -L and dpkg -S
|
| 389 |
...
|
| 390 |
# apt-get install auto-apt # on-demand package installation tool
|
| 391 |
# auto-apt update # create db file for auto-apt
|
| 392 |
$ auto-apt search <var>pattern</var>
|
| 393 |
# search for pattern in all packages, installed or not
|
| 394 |
</example>
|
| 395 |
</sect1>
|
| 396 |
|
| 397 |
<sect1 id="info-package">Information on a package
|
| 398 |
<p>
|
| 399 |
Search and display information from package archives. Make sure to
|
| 400 |
point APT to the proper archive(s) by editing
|
| 401 |
<file>/etc/apt/sources.list</file>.
|
| 402 |
If you want to see how packages in testing/unstable do against the currently
|
| 403 |
installed one, use <tt>apt-cache policy</tt>—quite nice.
|
| 404 |
<example>
|
| 405 |
# apt-get check # update cache and check for broken packages
|
| 406 |
$ apt-cache search <var>pattern</var> # search package from text description
|
| 407 |
$ apt-cache policy <var>package</var> # package priority/dists information
|
| 408 |
$ apt-cache show -a <var>package</var> # show description of package in all dists
|
| 409 |
$ apt-cache showsrc <var>package</var> # show description of matching source package
|
| 410 |
$ apt-cache showpkg <var>package</var> # package information for debugging
|
| 411 |
# dpkg --audit|-C # search for partially installed packages
|
| 412 |
$ dpkg {-s|--status} <var>package</var> ... # description of installed package
|
| 413 |
$ dpkg -l <var>package</var> ... # status of installed package (1 line each)
|
| 414 |
$ dpkg -L <var>package</var> ... # list file names installed by the package
|
| 415 |
</example>
|
| 416 |
<!-- Erase this when manual page gets fixed. FIXME -->
|
| 417 |
<tt>apt-cache showsrc</tt> is not documented as of the Woody release but
|
| 418 |
works :)
|
| 419 |
<p>
|
| 420 |
You can also find package information in (I use <tt>mc</tt> to browse these):
|
| 421 |
<example>
|
| 422 |
/var/lib/apt/lists/*
|
| 423 |
/var/lib/dpkg/available
|
| 424 |
</example>
|
| 425 |
The comparison of the following files provides information on what
|
| 426 |
exactly has happened in the last few install sessions.
|
| 427 |
<example>
|
| 428 |
/var/lib/dpkg/status
|
| 429 |
/var/backups/dpkg.status*
|
| 430 |
</example>
|
| 431 |
|
| 432 |
</sect1>
|
| 433 |
|
| 434 |
<sect1 id="apt-get-auto">Unattended installation with APT
|
| 435 |
<p>
|
| 436 |
For a unattended installation, add following line in
|
| 437 |
<file>/etc/apt/apt.conf</file>:
|
| 438 |
<example>
|
| 439 |
Dpkg::Options {"--force-confold";}
|
| 440 |
</example>
|
| 441 |
This is an equivalent of running <tt>apt-get -q -y <var>packagename</var></tt>.
|
| 442 |
This may have serious negative implication. So use this trick with care.
|
| 443 |
See <manref name="apt.conf" section="5"> and <manref name="dpkg" section="1">.
|
| 444 |
<p>
|
| 445 |
You can configure any particular packages later by following
|
| 446 |
<ref id="reconfigure">.
|
| 447 |
|
| 448 |
<sect1 id="reconfigure">Reconfigure installed packages
|
| 449 |
<p>
|
| 450 |
Use the following to reconfigure any already-installed package.
|
| 451 |
<example>
|
| 452 |
# dpkg-reconfigure --priority=<var>medium</var> <var>package</var> [...]
|
| 453 |
# dpkg-reconfigure --all # reconfigure all packages
|
| 454 |
# dpkg-reconfigure locales # generate any extra locales
|
| 455 |
# dpkg-reconfigure --p=<var>low</var> xserver-xfree86 # reconfigure X server
|
| 456 |
</example>
|
| 457 |
Do this for <prgn>debconf</prgn> if you need to change the
|
| 458 |
<prgn>debconf</prgn> dialog mode permanently.
|
| 459 |
<p>
|
| 460 |
Some programs come with special configuration scripts.
|
| 461 |
<example>
|
| 462 |
apt-setup - create /etc/sources.list
|
| 463 |
install-mbr - install a Master Boot Record manager
|
| 464 |
tzconfig - set the local timezone
|
| 465 |
gpmconfig - set gpm mouse daemon
|
| 466 |
sambaconfig - configure Samba in Potato (Woody uses debconf)
|
| 467 |
eximconfig - configure Exim (MTA)
|
| 468 |
texconfig - configure teTeX
|
| 469 |
apacheconfig - configure Apache (httpd)
|
| 470 |
cvsconfig - configure CVS
|
| 471 |
sndconfig - configure sound system
|
| 472 |
...
|
| 473 |
update-alternatives - set default command, e.g., vim as vi
|
| 474 |
update-rc.d - System-V init script management
|
| 475 |
update-menus - Debian menu system
|
| 476 |
...
|
| 477 |
</example>
|
| 478 |
</sect1>
|
| 479 |
|
| 480 |
<sect1 id="remove">Remove and purge packages
|
| 481 |
<p>
|
| 482 |
Remove a package while maintaining its configuration:
|
| 483 |
<example>
|
| 484 |
# apt-get remove <var>package</var> ...
|
| 485 |
# dpkg --remove <var>package</var> ...
|
| 486 |
</example>
|
| 487 |
Remove a package and all configuration:
|
| 488 |
<example>
|
| 489 |
# apt-get remove --purge <var>package</var> ...
|
| 490 |
# dpkg --purge <var>package</var> ...
|
| 491 |
</example>
|
| 492 |
</sect1>
|
| 493 |
|
| 494 |
<sect1 id="hold">Holding older packages
|
| 495 |
<p>
|
| 496 |
For example, holding of <package>libc6</package> and
|
| 497 |
<package>libc6-dev</package> for <prgn>dselect</prgn> and
|
| 498 |
<tt>apt-get -u upgrade <var>package</var></tt> can be done as follows:
|
| 499 |
<example>
|
| 500 |
# echo -e "libc6 hold\nlibc6-dev hold" | dpkg --set-selections
|
| 501 |
</example>
|
| 502 |
<tt>apt-get -u install <var>package</var></tt> will not be hindered by this "hold". To
|
| 503 |
hold a package through forcing automatic downgrade for <tt>apt-get -u upgrade
|
| 504 |
<var>package</var></tt> or <tt>apt-get -u dist-upgrade</tt>, add the following to
|
| 505 |
<file>/etc/apt/preferences</file>:
|
| 506 |
<example>
|
| 507 |
Package: libc6
|
| 508 |
Pin: release a=stable
|
| 509 |
Pin-Priority: 2000
|
| 510 |
</example>
|
| 511 |
Here the "<tt>Package:</tt>" entry cannot use entries such as "<tt>libc6*</tt>".
|
| 512 |
If you need to keep all binary packages related to the <package>glibc</package>
|
| 513 |
source package in a synchronized version, you need to list them explicitly.
|
| 514 |
<p>
|
| 515 |
The following will list packages on hold:
|
| 516 |
<example>
|
| 517 |
dpkg --get-selections "*"|grep -e "hold$"
|
| 518 |
</example>
|
| 519 |
</sect1>
|
| 520 |
|
| 521 |
<sect1 id="mixedsys">Mixed stable/testing/unstable system
|
| 522 |
<p>
|
| 523 |
<prgn>apt-show-versions</prgn> can lists available package
|
| 524 |
versions with distribution.
|
| 525 |
<example>
|
| 526 |
$ apt-show-versions | fgrep /testing | wc
|
| 527 |
... how many packages you have from testing
|
| 528 |
$ apt-show-versions -u
|
| 529 |
... list of upgradeable packages
|
| 530 |
$ apt-get install `apt-show-versions -u -b | fgrep /unstable`
|
| 531 |
... upgrade all unstable packages to their newest versions
|
| 532 |
</example>
|
| 533 |
</sect1>
|
| 534 |
|
| 535 |
<sect1 id="dselect"><prgn>dselect</prgn> – global configuration
|
| 536 |
<p>
|
| 537 |
Add a line containing the option "expert" in
|
| 538 |
<file>/etc/dpkg/dselect.cfg</file> to reduce noise.
|
| 539 |
<p>
|
| 540 |
When started, <prgn>dselect</prgn> automatically selects all "Required",
|
| 541 |
"Important", and "Standard" packages. In the Potato system, some large
|
| 542 |
programs such as teTeX and Emacs used to belong here and were best skipped for
|
| 543 |
the initial install by manually unselecting them (by typing `_'). In Woody,
|
| 544 |
these have moved to the "Optional" package category.
|
| 545 |
<p>
|
| 546 |
<prgn>dselect</prgn> has a somewhat strange user interface. There are 4 ambiguous commands
|
| 547 |
(Capital means CAPITAL!):
|
| 548 |
<example>
|
| 549 |
Key-stroke Action
|
| 550 |
Q Quit. Confirm current selection and quit anyway.
|
| 551 |
(override dependencies)
|
| 552 |
R Revert! I did not mean it.
|
| 553 |
D Damn it! I do not care what dselect thinks. Just Do it!
|
| 554 |
U Set all to sUggested state
|
| 555 |
</example>
|
| 556 |
With <tt>D</tt> and <tt>Q</tt>, you can select conflicting selections at your own risk.
|
| 557 |
Handle these commands with care. For a slower machine, run
|
| 558 |
<prgn>dselect</prgn> on another
|
| 559 |
fast machine to find packages and use <tt>apt-get install</tt> to install them.
|
| 560 |
<tt>apt-get dselect-upgrade</tt> best honors <prgn>dselect</prgn> selections.
|
| 561 |
</sect1>
|
| 562 |
|
| 563 |
<sect1 id="cache">Prune cached package files
|
| 564 |
<p>
|
| 565 |
Package installation with APT leaves cached package files in
|
| 566 |
<file>/var/cache/apt/archives</file> and these need to be cleaned.
|
| 567 |
<example>
|
| 568 |
# apt-get autoclean # removes only useless package files
|
| 569 |
# apt-get clean # removes all cached package files
|
| 570 |
</example>
|
| 571 |
</sect1>
|
| 572 |
|
| 573 |
|
| 574 |
<sect1 id="record">Record/copy system configuration
|
| 575 |
<p>
|
| 576 |
To make a local copy of the package selection states:
|
| 577 |
<example>
|
| 578 |
$ dpkg --get-selections "*" ><var>myselections</var> # or use \*
|
| 579 |
</example>
|
| 580 |
<tt>"*"</tt> makes <tt><var>myselections</var></tt> include package entries for "purge" too.
|
| 581 |
<p>
|
| 582 |
You can transfer this file to another computer, and install it there with:
|
| 583 |
<example>
|
| 584 |
# dselect update
|
| 585 |
# dpkg --set-selections <<var>myselections</var>
|
| 586 |
# apt-get -u dselect-upgrade # <var>or</var> dselect install
|
| 587 |
</example>
|
| 588 |
</sect1>
|
| 589 |
|
| 590 |
<sect1 id="port">Port a package to the <tt>stable</tt> system
|
| 591 |
<p>
|
| 592 |
For partial upgrades of the stable system, rebuilding a package within its
|
| 593 |
environment using the source package is desirable. This avoids massive
|
| 594 |
package upgrades due to their dependencies. First, add the following entries
|
| 595 |
to <file>/etc/apt/sources.list</file>:
|
| 596 |
<example>
|
| 597 |
deb-src &http-us;debian testing \
|
| 598 |
main contrib non-free
|
| 599 |
deb-src &http-non-us;debian-non-US testing/non-US \
|
| 600 |
main contrib non-free
|
| 601 |
deb-src &http-us;debian unstable \
|
| 602 |
main contrib non-free
|
| 603 |
deb-src &http-non-us;debian-non-US unstable/non-US \
|
| 604 |
main contrib non-free
|
| 605 |
</example>
|
| 606 |
Here each entry for <tt>deb-src</tt> is broken into 2 lines because of
|
| 607 |
printing constraints, but the actual entry in <file>sources.list</file> should
|
| 608 |
consist of a single line.
|
| 609 |
<p>
|
| 610 |
Then get the source and make a local package:
|
| 611 |
<example>
|
| 612 |
$ apt-get source <var>package</var>/unstable
|
| 613 |
$ dpkg-source -x <var>package.dsc</var>
|
| 614 |
$ cd <var>package-version</var>
|
| 615 |
... inspect required packages (Build-depends in .dsc file) and
|
| 616 |
install them too. You need the "fakeroot" package also.
|
| 617 |
|
| 618 |
$ dpkg-buildpackage -rfakeroot
|
| 619 |
|
| 620 |
...or (no sig)
|
| 621 |
$ dpkg-buildpackage -rfakeroot -us -uc # use "debsign" later if needed
|
| 622 |
|
| 623 |
...Then to install
|
| 624 |
$ su -c "dpkg -i <var>packagefile.deb</var>"
|
| 625 |
</example>
|
| 626 |
Usually, one needs to install a few packages with the "-dev" suffix to satisfy
|
| 627 |
package dependencies. <prgn>debsign</prgn> is in the
|
| 628 |
<package>devscripts</package> package. <prgn>auto-apt</prgn> may
|
| 629 |
ease satisfying these dependencies. Use of <prgn>fakeroot</prgn>
|
| 630 |
avoids unnecessary use of the root account.
|
| 631 |
<p>
|
| 632 |
In Woody, these dependency issues can be simplified.
|
| 633 |
For example, to compile a source-only <package>pine</package> package:
|
| 634 |
<example>
|
| 635 |
# apt-get build-dep pine
|
| 636 |
# apt-get source -b pine
|
| 637 |
</example>
|
| 638 |
</sect1>
|
| 639 |
|
| 640 |
<sect1 id="local">Local package archive
|
| 641 |
<p>
|
| 642 |
In order to create a local package archive which is compatible with
|
| 643 |
APT and the dselect system, <file>Packages</file> needs to be created
|
| 644 |
and package files needs to be populated in a particular directory tree.
|
| 645 |
<p>
|
| 646 |
Debian official archive like local deb repository can be made:
|
| 647 |
<example>
|
| 648 |
# apt-get install dpkg-dev
|
| 649 |
# cd <var>/usr/local</var>
|
| 650 |
# install -d <var>pool</var> # physical packages are located here
|
| 651 |
# install -d dists/<var>unstable</var>/<var>main</var>/binary-<var>i386</var>
|
| 652 |
# ls -1 <var>pool</var> | sed 's/_.*$/ extra <var>BOGUS</var>/' | uniq > <var>override</var>
|
| 653 |
# editor <var>override</var> # adjust <var>BOGUS</var>
|
| 654 |
# dpkg-scanpackages <var>pool</var> <var>override</var> <var>/usr/local</var>/ \
|
| 655 |
> dists/<var>unstable</var>/<var>main</var>/binary-<var>i386</var>/Packages
|
| 656 |
# cat > dists/<var>unstable</var>/<var>main</var>/Release << EOF
|
| 657 |
Archive: <var>unstable</var>
|
| 658 |
Version: <var>3.0</var>
|
| 659 |
Component: <var>main</var>
|
| 660 |
Origin: <var>Local</var>
|
| 661 |
Label: <var>Local</var>
|
| 662 |
Architecture: <var>i386</var>
|
| 663 |
EOF
|
| 664 |
# echo "deb file:<var>/usr/local</var> <var>unstable</var> <var>main</var>" \
|
| 665 |
>> /etc/apt/sources.list
|
| 666 |
</example>
|
| 667 |
<p>
|
| 668 |
Alternatively, quick-n-dirty local deb repository can be made:
|
| 669 |
<example>
|
| 670 |
# apt-get install dpkg-dev
|
| 671 |
# mkdir <var>/usr/local/debian</var>
|
| 672 |
# mv <var>/some/where/package.deb</var> <var>/usr/local/debian</var>
|
| 673 |
# dpkg-scanpackages <var>/usr/local/debian</var> /dev/null | \
|
| 674 |
gzip - > <var>/usr/local/debian</var>/Packages.gz
|
| 675 |
# echo "deb file:<var>/usr/local/debian</var> ./" >> /etc/apt/sources.list
|
| 676 |
</example>
|
| 677 |
<p>
|
| 678 |
These archives can be remotely accessed by providing access to these
|
| 679 |
directories through either HTTP or FTP methods and changing entries in
|
| 680 |
<file>/etc/apt/sources.list</file> accordingly.
|
| 681 |
|
| 682 |
<sect1 id="alien">Convert or install an alien binary package
|
| 683 |
<p>
|
| 684 |
<package>alien</package> enables the conversion of binary packages provided in
|
| 685 |
Redhat <tt>rpm</tt>, Stampede <tt>slp</tt>, Slackware <tt>tgz</tt>, and
|
| 686 |
Solaris <tt>pkg</tt> file formats
|
| 687 |
into a &debian; <tt>deb</tt> package. If you want to use a package from another
|
| 688 |
Linux distribution than the one you have installed on your
|
| 689 |
system, you can use <prgn>alien</prgn> to convert it to your preferred
|
| 690 |
package format and install it. <package>alien</package> also supports LSB packages.
|
| 691 |
</sect1>
|
| 692 |
|
| 693 |
<sect1 id="debsums">Verify installed package files
|
| 694 |
<p>
|
| 695 |
<prgn>debsums</prgn> enables verification of installed package files against
|
| 696 |
MD5 checksums. Some packages do not have available MD5 checksums. A possible
|
| 697 |
temporary fix for sysadmins:
|
| 698 |
<example>
|
| 699 |
# cat >>/etc/apt/apt.conf.d/90debsums
|
| 700 |
DPkg::Post-Install-Pkgs {"xargs /usr/bin/debsums -sg";};
|
| 701 |
^D
|
| 702 |
</example>
|
| 703 |
per Joerg Wendland <joergland@debian.org> (untested).
|
| 704 |
</sect>
|
| 705 |
|
| 706 |
<sect id="pecuriarities">Other Debian peculiarities
|
| 707 |
|
| 708 |
<sect1 id="dpkg-divert">The <prgn>dpkg-divert</prgn> command
|
| 709 |
<p>
|
| 710 |
<!-- copied from manual page -->
|
| 711 |
File <strong>diversions</strong> are a way of forcing <prgn>dpkg</prgn> not to
|
| 712 |
install a file into its default location, but to a <strong>diverted</strong>
|
| 713 |
location. <strong>Diversions</strong> can be used through the &debian;
|
| 714 |
package scripts to move a file away when it causes a conflict. System
|
| 715 |
administrators can also use a diversion to override a package's configuration
|
| 716 |
file, or whenever some files (which aren't marked as
|
| 717 |
<strong>conffiles</strong>) need to be preserved by <prgn>dpkg</prgn>, when
|
| 718 |
installing a newer version of a package which contains those files<![%f-ref;[
|
| 719 |
(see <ref id="conffile">)]]>.
|
| 720 |
<example>
|
| 721 |
# dpkg-divert [--add] <var>filename</var> # add "diversion"
|
| 722 |
# dpkg-divert --remove <var>filename</var> # remove "diversion"
|
| 723 |
</example>
|
| 724 |
It's usually a good idea not to use <prgn>dpkg-divert</prgn> when it is
|
| 725 |
not absolutely necessary.
|
| 726 |
</sect1>
|
| 727 |
|
| 728 |
<sect1 id="equivs">The <package>equivs</package> package
|
| 729 |
<p>
|
| 730 |
If you compile a program from source, it is best to make it into a real
|
| 731 |
local debianized package (<tt>*.deb</tt>).
|
| 732 |
Use <tt>equivs</tt> as a last resort.
|
| 733 |
<example>
|
| 734 |
Package: equivs
|
| 735 |
Priority: extra
|
| 736 |
Section: admin
|
| 737 |
Description: Circumventing Debian package dependencies
|
| 738 |
This is a dummy package which can be used to create Debian
|
| 739 |
packages, which only contain dependency information.
|
| 740 |
</example>
|
| 741 |
</sect1>
|
| 742 |
|
| 743 |
<sect1 id="alternatives">Alternative commands
|
| 744 |
<p>
|
| 745 |
To make the command <prgn>vi</prgn> run <prgn>vim</prgn>, use
|
| 746 |
<prgn>update-alternatives</prgn>:
|
| 747 |
<example>
|
| 748 |
# update-alternatives --display vi
|
| 749 |
...
|
| 750 |
# update-alternatives --config vi
|
| 751 |
Selection Command
|
| 752 |
-----------------------------------------------
|
| 753 |
1 /usr/bin/elvis-tiny
|
| 754 |
2 /usr/bin/vim
|
| 755 |
*+ 3 /usr/bin/nvi
|
| 756 |
|
| 757 |
Enter to keep the default[*], or type selection number: 2
|
| 758 |
</example>
|
| 759 |
Items in the Debian alternatives system are kept in
|
| 760 |
<file>/etc/alternatives</file> as symlinks.
|
| 761 |
<p>
|
| 762 |
To set your favorite X window environment, apply
|
| 763 |
<prgn>update-alternatives</prgn> to
|
| 764 |
<file>/usr/bin/x-session-manager</file> and
|
| 765 |
<file>/usr/bin/x-window-manager</file>.
|
| 766 |
<![%f-ref;[
|
| 767 |
For details, see <ref id="custom-x">.
|
| 768 |
]]>
|
| 769 |
<p>
|
| 770 |
<file>/bin/sh</file> is a direct symlink to <file>/bin/bash</file> or
|
| 771 |
<file>/bin/dash</file>. It's safer to
|
| 772 |
use <file>/bin/bash</file> to be compatible with old Bashism-contaminated scripts but
|
| 773 |
better discipline to use <file>/bin/dash</file> to enforce POSIX compliance.
|
| 774 |
Upgrading to a 2.4 Linux kernel tends to set this to <file>/bin/dash</file>.
|
| 775 |
</sect1>
|
| 776 |
|
| 777 |
<sect1 id="sys-v">System-V <prgn>init</prgn> and runlevels
|
| 778 |
<p>
|
| 779 |
The default runlevel to boot into can be set in <file>/etc/inittab</file>.
|
| 780 |
<p>
|
| 781 |
Unlike other distributions, Debian makes the management of runlevel completely
|
| 782 |
the sysadmin's responsibility. Management of System-V style <prgn>init</prgn> on Debian is
|
| 783 |
intended to be performed through <prgn>update-rc.d</prgn> scripts.
|
| 784 |
<p>
|
| 785 |
Starting <file>/etc/init.d/<var>name</var></file> in runlevel 1,2,3 and stopping in
|
| 786 |
4,5 with sequencing priority number 20 (normal) can be done by:
|
| 787 |
<example>
|
| 788 |
# update-rc.d <var>name</var> start 20 1 2 3 . stop 20 4 5 .
|
| 789 |
</example>
|
| 790 |
Removing symbolic links while the script in <prgn>init.d</prgn> still exists can be done by:
|
| 791 |
<example>
|
| 792 |
# update-rc.d -f <var>name</var> remove
|
| 793 |
</example>
|
| 794 |
For editing runlevels, I cheat. I edit entries manually using the
|
| 795 |
<prgn>mv</prgn> command at the shell prompt of <prgn>mc</prgn> while copying
|
| 796 |
link entries using <tt>Alt-Enter</tt>. For example:
|
| 797 |
<example>
|
| 798 |
# mv S99xdm K99xdm # disable xdm (X display manager)
|
| 799 |
</example>
|
| 800 |
I even disable a daemon by inserting
|
| 801 |
<tt>exit 0</tt> at the start of an <prgn>init.d</prgn> script as a quick hack.
|
| 802 |
These are <tt>conffiles</tt> after all.
|
| 803 |
</sect1>
|
| 804 |
|
| 805 |
<sect1 id="disables">Disabled daemon services
|
| 806 |
<p>
|
| 807 |
The &debian; distribution takes system security seriously and expects
|
| 808 |
the system administrator to be competent. Thus, sometimes ease of use
|
| 809 |
appears to be a secondary concern and many daemon services come with
|
| 810 |
the highest security level, with the fewest services (or none)
|
| 811 |
available as their default install state.
|
| 812 |
<p>
|
| 813 |
Run <tt>ps aux</tt> or check the contents of <file>/etc/init.d/*</file> and
|
| 814 |
<file>/etc/inetd.conf</file>, if you have any doubts (about Exim, DHCP, ...).
|
| 815 |
Also check <file>/etc/hosts.deny</file><![%f-ref;[ as
|
| 816 |
in <ref id="loginctrl">]]>.
|
| 817 |
The <prgn>pidof</prgn> command is also useful (see
|
| 818 |
<manref name="pidof" section="8">).
|
| 819 |
<p>
|
| 820 |
X11 doesn't allow TCP/IP (remote) connections by default in recent
|
| 821 |
versions of &debian;.
|
| 822 |
<![%f-ref;[
|
| 823 |
See <ref id="xtcp">.
|
| 824 |
]]>
|
| 825 |
X forwarding in SSH is also disabled.
|
| 826 |
<![%f-ref;[
|
| 827 |
See <ref id="xssh">.
|
| 828 |
]]>
|
| 829 |
</sect1>
|
| 830 |
</sect>
|
| 831 |
|
| 832 |
</chapt>
|
| 833 |
|