|
|
|
|
Linux in a Nutshell, 3rd EditionBy Ellen Siever, Stephen Spainhour, Jessica P. Hekman, & Stephen Figgins3rd Edition August 2000 0-596-00025-1, Order Number: 0251 800 pages, $34.95 |
Chapter 5
Red Hat and Debian Package ManagersContents:
The Red Hat Package Manager
The Debian Package ManagerThis chapter describes the two major Linux packaging systems, the Red Hat Package Manager (RPM) and the Debian GNU/Linux Package Manager.
When you want to install applications on your Linux system, most often you'll find a binary or a source package containing the application you want, instead of (or in addition to) a .tar.gz file. A package is a file containing the files necessary to install an application. But note that while the package contains the files you need for installation, the application might require the presence of other files or packages that are not included, such as particular libraries (and even specific versions of the libraries), in order to be able to run. Such requirements are known as dependencies.
Package management systems offer many benefits. As a user, you may find you want to query the package database to find out what packages are installed on the system and their versions. As a system administrator, you need tools to install and manage the packages on your system. And, if you are also a developer, you need to know how to build a package for distribution.
Among other things, package managers:
Provide tools for installing, updating, removing, and managing the software on your system.
Let you install new or upgraded software directly across a network.
Tell you what software package a particular file belongs to or what files a package contains.
Maintain a database of packages on the system and their state, so you can find out what packages or versions are installed on your system.
Provide dependency checking, so you don't mess up your system with incompatible software.
Provide PGP, MD5, or other signature verification tools.
Provide tools for building packages.
Any user can list or query packages. However, installing, upgrading, or removing packages generally requires superuser privileges. This is because the packages normally are installed in systemwide directories that are writable only by root. Sometimes you can specify an alternate directory, to install, for example, a package into your home directory or into a project directory where you have write permission.
Both RPM and the Debian Package Manager back up old files before installing an updated package. Not only does this let you go back if there is a problem, but also if you've made changes (to configuration files, for example), they aren't completely lost.
The Red Hat Package Manager
The Red Hat Package Manager (RPM) is a freely available packaging system for software distribution and installation. In addition to Red Hat and Red Hat-based distributions, both SuSE and Caldera are among the Linux distributions that use RPM.
Using RPM is straightforward. A single command, rpm, has options to perform all the package functions. For example, to find out if the Emacs editor is installed on your system, you could say:
%rpm -q emacs
emacs-20.4-4In addition, the GNOME-RPM program provides an X-based graphical frontend to RPM (that can be run even if you are not running GNOME). This section describes the rpm command and then the gnorpm command that runs GNOME-RPM.
The rpm Command
RPM packages are built, installed, and queried with the rpm command. RPM package names usually end with a .rpm extension. rpm has a set of modes, each with its own options. The format of the rpm command is:
With a few exceptions, as noted in the lists of options that follow, the first option specifies the rpm mode (e.g., install, query, update, build, etc.), and any remaining options affect that mode.rpm[options] [packages]In the option descriptions that refer to packages, you'll sometimes see them specified as package-name and sometimes as package-file. The package name is the name of the program or application, such as gif2png. The package file is the name of the RPM file: gif2png-2.2.5-1.i386.rpm.
RPM provides a configuration file for specifying frequently used options. The system configuration file is usually /etc/rpmrc, and users can set up their own $HOME/.rpmrc file. You can use the --showrc option to show the values RPM will use for all the options that may be set in an rpmrc file:
rpm --showrcThe rpm command includes FTP and HTTP clients, so you can specify an ftp:// or http:// URL to install or query a package across the Internet. You can use an FTP or HTTP URL wherever package-file is specified in the commands presented here.
Any user can query the RPM database. Most of the other functions require superuser privileges.
General options
The following options can be used with all modes:
- --dbpath path
Use path as the path to the RPM database.
- --ftpport port
Use port as the FTP port.
- --ftpproxy host
Use host as a proxy server for all transfers. Specified if you are FTPing through a firewall system that uses a proxy.
- --help
Print a long usage message (running rpm with no options gives a shorter usage message).
- --justdb
Update only the database; don't change any files.
- --pipe command
Pipe the rpm output to command.
- --quiet
Display only error messages.
- --rcfile filename
Use filename as the configuration file instead of the system configuration file /etc/rpmrc or $HOME/.rpmrc.
- --root dir
Perform all operations within directory dir.
- --version
Print the version number of rpm.
- -vv
Print debugging information.
Install, upgrade, and freshen options
Install or upgrade an RPM package. The syntax of the install command is:
rpm -i[install-options] package_file ...rpm --install[install-options] package_file ...To install a new version of a package and remove an existing version at the same time, use the upgrade command instead:
rpm -U[install-options] package_file ...rpm --upgrade[install-options] package_file ...One feature of -U is that if the package doesn't already exist on the system, it acts like -i and installs it. To prevent that behavior, you can freshen a package instead; in that case, rpm upgrades the package only if an earlier version is already installed. The freshen syntax is:
rpm -F[install-options] package_file ...rpm --freshen[install-options] package_file ...Installation and upgrade options are:
- --allfiles
Install or upgrade all files.
- --badreloc
Used with --relocate to force relocation even if the package is not relocatable.
- --excludedocs
Don't install any documentation files.
- --excludepath path
Don't install any file whose filename begins with path.
- --force
Force the installation. Equivalent to using --replacepkgs, --replacefiles, and --oldpackage.
- -h, --hash
Print 50 hash marks as the package archive is unpacked. Use with --version for a nicer display.
- --ignorearch
Install even if the binary package is intended for a different architecture.
- --ignoreos
Install binary package even if the operating systems don't match.
- --ignoresize
Don't check disk space availability before installing.
- --includedocs
Install documentation files. This is needed only if excludedocs: 1 is specified in an rpmrc file.
- --nodeps
Don't check whether this package depends on the presence of other packages.
- --noorder
Don't reorder packages to satisfy dependencies before installing.
- --noscripts
Don't execute any preinstall or postinstall scripts.
- --notriggers
Don't execute any scripts triggered by package installation.
- --oldpackage
Allow an upgrade to replace a newer package with an older one.
- --percent
Print percent-completion messages as files are unpacked.
- --prefix path
Set the installation prefix to path for relocatable packages.
- --replacefiles
Install the packages even if they replace files from other installed packages.
- --replacepkgs
Install the packages even if some of them are already installed.
- --test
Go through the installation to see what it would do, but don't actually install the package.
Query options
The syntax for the query command is:
rpm -q[information-options] [package-options]rpm --query[information-options] [package-options]There are two subsets of query options: package selection options that determine what packages to query and information selection options that determine what information to provide.
Package selection options
- package_name
Query the installed package package_name.
- -a, --all
Query all installed packages.
- -f file, --file file
Find out what package owns file.
- -g group, --group group
Find out what packages have group group.
- -p package_file
Query the uninstalled package package_file.
- --querybynumber num
Query the numth database entry. Primarily useful for debugging.
- -qf, --queryformat num
Specify the format for displaying the query output, using tags to represent different types of data (e.g., NAME, FILENAME, DISTRIBUTION). The format specification is a variation of the standard printf formatting. (Use --querytags in the section "Miscellaneous options" to view a list of available tags.
- --specfile specfile
Query specfile as if it were a package.
- --triggeredby pkg
List packages that trigger installation of package pkg.
- --whatrequires capability
List packages that require the given capability to function.
- --whatprovides capability
List packages that provide the given capability.
Information selection options
- -c, --configfiles
List configuration files in the package.
- --changelog
Display the log of change information for the package.
- -d, --docfiles
List documentation files in the package.
- --dump
Dump information for each file in the package. This option must be used with at least one of -l, -c, or -d. The output includes the following information in this order:
path size mtime md5sum mode owner group isconfig isdoc rdev symlink- --filesbypkg
List all files in each package.
- -i
Display package information, including the name, version, and description.
- -l, --list
List all files in the package.
- --last
List packages by install time, with the latest packages listed first.
- --provides
List the capabilities this package provides.
- -R, --requires
List any packages this package depends on.
- -s, --state
List each file in the package and its state. The possible states are normal, not installed, or replaced.
- --scripts
List any package-specific shell scripts used during installation and uninstallation of the package.
Uninstall options
The syntax for the uninstall command is:
rpm -epackage_namerpm --erasepackage_nameThe uninstall options are:
- --allmatches
Remove all versions of the package. Only one package should be specified; otherwise, an error results.
- --nodeps
Don't check dependencies before uninstalling the package.
- --noscripts
Don't execute any preuninstall or postuninstall scripts.
- --notriggers
Don't execute any scripts triggered by the removal of this package.
- --test
Don't really uninstall anything; just go through the motions.
Verify options
The syntax for the verify command is:
rpm -V|-y| -- verify[package-selection-options]Verify mode compares information about the installed files in a package with information about the files that came in the original package and displays any discrepancies. The information compared includes the size, MD5 sum, permissions, type, owner, and group of each file. Uninstalled files are ignored.
The package selection options include those available for query mode, as well as the following:
- --nofiles
Ignore missing files.
- --nomd5
Ignore MD5 checksum errors.
- --nopgp
Ignore PGP checking errors.
The output is formatted as an eight-character string, possibly followed by a "c" to indicate a configuration file, and then the filename. Each of the eight characters in the string represents the result of comparing one file attribute to the value of that attribute from the RPM database. A period (.) indicates that the file passed that test. The following characters indicate failure of the corresponding test:
5 MD5 sum D Device G Group L Symlink M Mode (includes permissions and file type) S File size T Mtime U User Database rebuild options
The syntax of the command to rebuild the RPM database is:
rpm --rebuilddb[options]You also can build a new database:
rpm --initdb[options]The options available with the database rebuild mode are the --dbpath and --root options described earlier under "General options".
Signature check options
RPM packages may have a PGP signature built into them. PGP configuration information is read from /etc/rpmrc. The syntax of the signature-check mode is:
rpm --checksigpackage_file...rpm -Kpackage_file...The signature-checking options are:
- --nogpg
Don't check any GPG signatures.
- --nomd5
Don't check any MD5 signatures.
- --nopgp
Don't check any PGP signatures.
Two other options let you add signatures to packages:
- --addsign binary-pkgfile...
Generate and append new signatures to those that already exist in the specified binary packages.
- --resign binary-pkgfile...
Generate and insert new signatures in the specified binary packages, removing any existing signatures.
Miscellaneous options
Several additional rpm options are available:
- --querytags
Print the tags available for use with the --queryformat option in query mode.
- --setgids packages
Set file owner and group of the specified packages to those in the database.
- --setperms packages
Set file permissions of the specified packages to those in the database.
- --showrc
Show the values rpm will use for all options that can be set in an .rpmrc file.
FTP/HTTP options
The following options are available for use with ftp:// and http:// URLs in install, update, and query modes:
- --ftpport port
Use port for making an FTP connection on the proxy FTP server instead of the default port. Same as specifying the macro _ftpport.
- --ftpproxy host
Use host as the proxy server for FTP transfers through a firewall that uses a proxy. Same as specifying the macro _ftpproxy.
- --httpport port
Use port for making an HTTP connection on the proxy HTTP server instead of the default port. Same as specifying the macro _httpport.
- --httpproxy host
Use host as a proxy server for HTTP transfers. Same as specifying the macro _httpproxy.
Build options
The syntax for the build options is:
Specify -b to build a package directly from a spec file or -t to open a tarred gzipped file and use its spec file. Both forms take the following single-character step arguments:rpm -[b|t]step [build-options] spec-file ...
- p
Perform the prep stage, unpacking source files and applying patches.
- l
Do a list check, expanding macros in the files section of the spec file and verifying that each file exists.
- c
Perform the build stage. Done after the prep stage; generally equivalent to doing a make.
- i
Perform the install stage. Done after the prep and build stages; generally equivalent to doing a make install.
- b
Build a binary package. Done after prep, build, and install.
- s
Build a source package. Done after prep, build, and install.
- a
Build both binary and source packages. Done after prep, build, and install.
The following additional options can be used when building an rpm file:
- --buildarch arch
- --buildos os
For use with pre-3.0 versions of RPM. Build the package for architecture arch or the operating system os. Replaced in 3.0 with --target.
- --buildroot dir
Override the BuildRoot tag with dir when building the package.
- --clean
Clean up (remove) the build files after the package has been made.
- --rmsource
Remove the source files and the spec file when the build is done. Can be used as a standalone option with rpm to clean up files separately from creating the packages.
- --short-circuit
Can be used with -bc and -bi to skip previous stages.
- --sign
Add a PGP signature to the package.
- --target platform
When building the package, set the macros _target, _target_arch, and _target_os to the value indicated by platform.
- --test
Go through the motions, but don't execute any build stages. Used for testing spec files.
- --timecheck
Set the timecheck age (the maximum age in seconds of a file being packaged). Set to 0 to disable.
Two other options can be used standalone with rpm to recompile or rebuild a package:
- --rebuild source-pkgfile...
Like --recompile, but also build a new binary package. Remove the build directory, the source files, and the spec file once the build is complete.
- --recompile source-pkgfile...
Install the named source package, and prep, compile, and install the package.
RPM examples
Query the RPM database to find Emacs-related packages:
%rpm -q -a | grep emacsQuery an uninstalled package, printing information about the package, and list the files it contains:
%rpm -qpil ~/downloads/bash2-doc-2.03-8.i386.rpmInstall a package (assumes superuser privileges):
%rpm -i sudo-1.5.3-6.i386.rpmGNOME-RPM
GNOME-RPM is a graphical user frontend to rpm that runs under X. You can run gnorpm even if you are not running GNOME. When you run gnorpm, it opens a window that lets you manage your rpm packages via a graphical interface. The format of the gnorpm command is:
gnorpm[options]gnorpm options
The gnorpm options are:
- --geometry=geom
Specify the geometry of the main window in standard X geometry format (i.e., w×h+x+y).
- -i pkgfiles, --install pkgfiles
Install the specified packages.
- -p pkgs, --packages pkgs
The packages are in files, not in the rpm database (i.e., they haven't been installed yet).
- -q pkgs, --query pkgs
Display a query window for the specified installed packages.
- -qp pkgfiles, --query --packages pkgfiles
Display a query window for the specified package files. This is the same as specifying the -q and -p options.
- -U pkgfiles, --upgrade pkgfiles
Upgrade the specified packages.
- -K pkgfiles, --checksig pkgfiles
Check the signatures on the specified packages.
- -y pkgs, --verify pkgs
Verify the specified packages.
- -?, --help
Display a help message and exit.
- --root=dir
Specify the filesystem root to use.
- --usage
Display a brief usage message and exit.
The GNOME-RPM window
The GNOME-RPM main window has five parts. At the top is a menu bar with three buttons:
- Packages
Menu options are Query, Uninstall, and Verify.
- Operations
Menu options are Find, Web find, Install, and Preferences.
- Help
Provides online help for GNOME-RPM.
Below the menu bar is a toolbar, with buttons to Install, Unselect, Uninstall, Query, Verify, Find, and Web find. At the very bottom of the window is a status bar.
The rest of the window is the main panel. On the left is the package panel, which displays package folders in a tree structure. Clicking on a folder selects it; double-click to display the contents of the folder (i.e., the packages in that folder) on the righthand panel. Clicking on a package selects it; you then can use the menus and the toolbar buttons to operate on the package. You can select several packages at the same time and operate on them as a group. Right-clicking on a package icon selects the package if it isn't already and presents a menu with Query, Uninstall, and Verify options.
See the GNOME-RPM documentation and online help for full details.
The Debian Package Manager
Debian GNU/Linux provides several package management tools, primarily intended to facilitate the building, installation, and management of binary packages. Debian package names generally end in .deb. The Debian package management tools include:
- dpkg
Until recently, the most important of the Debian packaging tools and still the primary package management program. Used to install or uninstall packages or as a frontend to dpkg-deb.
- dpkg-deb
Lower-level packaging tool. Used to create and manage the Debian package archives. Accepts and executes commands from dpkg or can be called directly.
- dselect
An interactive frontend to dpkg.
- apt-get
The currently available piece of the Advanced Package Tool (APT), which is still being developed and is intended to be a modern, user-friendly package management tool. Can be run from the command line or selected as a method from dselect. One of the features of apt-get is that you can use it to get and install packages across the Internet by specifying an ftp:// or http:// URL. Another feature is that you can use it to upgrade all packages currently installed on your system in a single operation.
Files
Some important files used by the Debian package management tools are:
- control
Comes with each package; documents dependencies; contains the name and version of the package, a description, maintainer, installed size, and so on.
- conffiles
Comes with each package and contains a list of the configuration files associated with the package.
- preinst, postinst, prerm, postrm
Scripts that can be included in a package to be run before installation, after installation, before removal, or after removal of the package.
- /var/lib/dpkg/available
Contains information about packages available on the system.
- /var/lib/dpkg/status
Contains information about the status of packages available on the system.
- /etc/apt/sources.list
A list for APT of package sources, used to locate packages. The sources are listed one per line, in order of preference.
- /etc/apt/apt.conf
The main APT configuration file.
Package States and Selection States
The possible states that a package can be in are:
- config-files
Only the configuration files for the package are present on the system.
- half-configured
The package is unpacked and configuration was started but not completed.
- half-installed
Installation was started but not completed.
- installed
The package is unpacked and configured.
- not-installed
The package is not installed.
- unpacked
The package is unpacked but not configured.
The possible package selection states are:
- deinstall
The package has been selected for deinstallation (i.e., for removal of everything but configuration files).
- install
The package has been selected for installation.
- purge
The package has been selected to be purged (i.e., for removal of everything including the configuration files).
Package Flags
There are two possible package flags that can be set for a package. They are:
- hold
The package is not to be handled by dpkg, unless forced with the --force-hold option.
- reinst-required
The package is broken and needs to be reinstalled. Such a package cannot be removed, unless forced with the --force-reinstreq option.
Scripts
In addition to the commands described in the next subsection, several shell and Perl scripts are included with the package manager for use in building packages:
- dpkg-buildpackage
Help automate package building. Shell script.
- dpkg-distaddfile
Add an entry for a file to debian/files. Perl script.
- dpkg-genchanges
Generate an upload control file from the information in an unpacked, built, source tree and the files it has generated. Perl script.
- dpkg-gencontrol
Read information from an unpacked source tree and display a binary package control file on standard output. Perl script.
- dpkg-name
Rename Debian packages to their full package names. Shell script.
- dpkg-parsechangelog
Read and parse the changelog from an unpacked source tree and write the information to standard output in machine-readable form. Perl script.
- dpkg-scanpackages
Create a Packages file from a tree of binary packages. The Packages file is used by dselect to provide a list of packages available for installation. Perl script.
- dpkg-shlibdeps
Calculate shared library dependencies for named executables. Perl script.
- dpkg-source
Pack and unpack Debian source archives. Perl script.
Debian Package Manager Command Summary
apt-cdrom
apt-cdrom [options] command
Add a new CD-ROM to APT's list of available sources. Currently, the only command is add, which is required (except with the --help option). The database of CD-ROM IDs that APT maintains is /var/state/apt/cdroms.list.
Options
Options can be specified on the command line or they may be set in the configuration file. Boolean options set in the configuration file can be overridden on the command line in a number of different ways, a couple of which are --no -opt and -opt=no, where opt is the single-character or full name of the option.
- -a, --thorough
Do a thorough package scan. May be needed with some old Debian CD-ROMs.
- -c, --config-file
Specify a configuration file to be read after the default configuration file.
- -d, --cdrom
Specify the CD-ROM mount point, which must be listed in /etc/fstab. The configuration option is Acquire::cdrom::mount.
- -f, --fast
Do a fast copy, assuming the files are valid and don't all need checking. Specify this only if this disk has been run before without error. The configuration option is APT::CDROM::Fast.
- -h, --help
Print help message and exit.
- -m, --no-mount
Don't mount or unmount the mount point. The configuration option is APT::CDROM::NoMount.
- -n, --just-print, --recon, --no-act
Check everything, but don't actually make any changes. The configuration option is APT::CDROM::NoAct.
- -o, --option
Set a configuration option. Syntax is -o group::tool=option (e.g., APT::CDROM=Fast).
- -r, --rename
Prompt for a new label and rename the disk to the new value. The configuration option is APT::CDROM::Rename.
- -v, --version
Print the version information and exit.
apt-get
apt-get [options] command [package...]
A command-line tool for handling packages. Will eventually be a backend to APT.
Commands
- autoclean
Like clean, but remove only package files that can no longer be downloaded.
- clean
Clear the local repository of retrieved package files.
- check
Update the package cache and check for broken packages.
- dist-upgrade
Like upgrade but also handle dependencies intelligently.
- dselect-upgrade
Used together with dselect. Track the changes made by dselect to the Status field of available packages and take actions necessary to realize that status.
- install package...
Install one or more packages. Specify the package name, not the full filename. Other required packages also are retrieved and installed. With a hyphen appended to the package name, the package is removed if it is already installed.
- remove package...
Remove one or more packages. Specify the package name, not the full filename. With a plus sign appended to the name, the package is installed.
- source package...
Find source packages and download them into the current directory. If specified with --compile, the source packages are compiled into binary packages. With --download-only, the source packages are not unpacked.
- update
Resynchronize the package overview files from their sources. Must be done before an upgrade or dist-upgrade.
- upgrade
Install the latest versions of all packages currently installed. Run update first.
Options
Options can be specified on the command line or they may be set in the configuration file. Boolean options set in the configuration file can be overridden on the command line in one of several ways, a couple of which are --no -opt and -opt=no, where opt is the single-character or full name of the option.
- -b, --compile, --build
Compile source packages after download.
- -c, --config-file
Specify a configuration file to read after the default.
- -d, --download-only
Retrieve package files, but don't unpack or install them. The configuration option is APT::Get::Download-only.
- -f, --fix-broken
Try to fix a system with broken dependencies. Can be used alone or with a command. The configuration option is APT::Get::Fix-Broken.
- --force-yes
Force yes. Causes APT to continue without prompting if it is doing something that could damage your system. Use with great caution and only if absolutely necessary. The configuration option is APT::Get::force-yes.
- -h, --help
Display a help message and exit.
- --ignore-hold
Ignore a hold placed on a package. Use with dist-upgrade to override many undesired holds. The configuration option is APT::Get::Ignore-Hold.
- -m, --ignore-missing, --fix-missing
Ignore missing or corrupted packages or packages that cannot be retrieved. Can cause problems when used with -f.
- --no-download
Disable package downloading; use with --ignore-missing to force APT to use only the packages that have already been downloaded.
- --no-upgrade
Do not upgrade packages. Use with install to prevent upgrade of packages that are already installed. The configuration option is APT::Get::no-upgrade.
- -o, --option
Set a configuration option. Syntax is -o group::tool=option (e.g., APT::Get=force-yes).
- --print-uris
Print URIs of files instead of fetching them. Print path, destination filename, size, and expected MD5 hash. The configuration option is APT::Get::Print-URIs.
- -q, --quiet
Quiet. Omit progress indicators, produce only logging output. Add a q to make even quieter.
- -s, --simulate, --just-print, --dry-run, --recon, --no-act
Go through the motions, but don't actually make any changes to the system. The configuration option is APT::Get::Simulate.
- -u, --show-upgraded
Print a list of all packages to be upgraded. The configuration option is APT::Get::Show-Upgraded.
- -v, --version
Display the version and exit.
- -y, --yes, --assume-yes
Automatically reply "yes" to prompts and run noninteractively. Abort if there is an error. The configuration option is APT::Get::Assume-Yes.
dpkg
dpkg [options] action
A tool for installing, managing, and building packages. Serves as a frontend to dpkg-deb.
dpkg actions
These actions are carried out by dpkg itself:
- -i pkgfile, --install pkgfile
Install the package specified as pkgfile. With -R or --recursive, pkgfile must be a directory.
- --unpack pkgfile
Unpack the package, but don't configure it. With -R or --recursive, pkgfile must be a directory.
- --configure [packages|-a|--pending]
Reconfigure one or more unpacked packages. If -a or --pending is given instead of packages, configure all packages that are unpacked but not configured.
- -r, --remove [packages|-a|--pending]
- --purge [packages|-a|--pending]
Remove or purge one or more installed packages. Removal gets rid of everything except the configuration files listed in debian/conffiles; purging also removes the configuration files. If -a or --pending is given instead of packages, dpkg removes or purges all packages that are unpacked and marked (in /var/lib/dpkg/status) for removing or purging.
- --print-avail package
Print the details about package from /var/lib/dpkg/available.
- --update-avail pkgs-file
- --merge-avail pkgs-file
Update the record of available files kept in /var/lib/dpkg/available. This information is used by dpkg and dselect to determine what packages are available. Update will replace the information with the contents of the pkgs-file, distributed as Packages. Merge combines the information from Packages with the existing information.
- -A pkgfile, --record-avail pkgfile
Update the record of available files kept in /var/lib/dpkg/available with information from pkgfile. This information is used by dpkg and dselect to determine what packages are available. With -R or --recursive, pkgfile must be a directory.
- --forget-old-unavail
Forget about uninstalled unavailable packages.
- --clear-avail
Remove existing information about what packages are available.
- -l, --list [pkg-name-pattern]
List all packages whose names match the specified pattern. With no pattern, list all packages in /var/lib/dpkg/available. The pattern can include standard shell wildcard characters and may have to be quoted to prevent the shell from doing filename expansion.
- -s packages, --status packages
Report the status of one or more packages by displaying the entry in the status database /var/lib/dpkg/status.
- -C, --audit
Search for partially installed packages and suggest how to get them working.
- --get-selections [pattern]
Get list of package selections and write to standard output. With pattern specified, write selections that match the pattern.
- --set-selections
Set package selections based on input file read from standard input.
- --yet-to-unpack
Search for uninstalled packages that have been selected for installation.
- -L packages, --listfiles packages
List installed files that came from the specified package or packages.
- -S filename-pattern, --search filename-pattern
Search installed packages for a filename. The pattern can include standard shell wildcard characters and may have to be quoted to prevent the shell from doing filename expansion.
- --print-architecture
Print target architecture.
- --print-gnu-build-architecture
Print the GNU version of the target architecture.
- --print-installation-architecture
Print host architecture for installation.
- --compare-versions ver1 op ver2
Perform a binary comparison of two version numbers. The operators lt le eq ne ge gt treat a missing version as earlier. The operators lt-nl le-nl ge-nl gt-nl treat a missing version as later (where nl is "not later"). There is a third set of operators (< << <= = >= >> >) that is provided for compatibility with control-file syntax. dpkg returns zero for success (i.e., the condition is satisfied) and nonzero otherwise.
- --help
Print help message and exit.
- --force-help
Print help message about the --force-list options and exit.
- -Dh, --debug=help
Print debugging help message and exit.
- --license
Print dpkg license information and exit. Accepts the spelling --licence in addition to --license.
- --version
Print dpkg version information and exit.
dpkg-deb actions
The following actions can be specified for dpkg and are passed to dpkg-deb for execution. Also see dpkg-deb.
- -b dir [archive], --build dir [archive]
Build a package.
- -c archive, --contents archive
List the contents of a package.
- -e, --control archive dir
Extract control information from a package.
- -f archive [control-fields], --field archive [control-fields]
Display the control field or fields of a package.
- -I archive [control-files], --info archive [control-files]
Show information about a package.
- --fsys-tarfile archive
Display the filesystem tar- file contained by a package.
- -x archive dir, --extract archive dir
Extract the files from a package.
- -X archive dir, --vextract archive dir
Extract and display the filenames from a package.
Options
- --abort-after=num
Abort processing after num errors. Default is 50.
- -B, --auto-deconfigure
When a package is removed, automatically deconfigure any other package that depended on it.
- -Doctal, --debug=octal
Turn on debugging, with the octal value specifying the desired level of debugging information. Use -Dh or --debug=help to display the possible values. You can OR the values to get the desired output.
- -E, --skip-same-version
Don't install the package if this version is already installed.
- --force-list, --no-force-list, --refuse-list
Force or refuse to force an operation. list is specified as a comma-separated item of options. With --force, a warning is printed, but processing continues. --refuse and --no-force cause processing to stop with an error. The force/refuse options are:
- architecture
Process even if intended for a different architecture.
- auto-select
Select or deselect packages to install or remove them. Forced by default.
- bad-path
Some programs are missing from the path.
- configure-any
Configure any unconfigured package that the package depends on.
- conflicts
Permit installation of conflicting packages. Can result in problems from files being overwritten.
- depends
Turn dependency problems into warnings.
- depends-version
Warn of version problems when checking dependencies, but otherwise ignore.
- downgrade
Install even if a newer version is already installed. Forced by default.
- hold
Process packages even if they are marked to be held.
- not-root
Try to install or remove even when not logged on as root.
- overwrite
- overwrite-dir
Overwrite one package's directory with a file from another package.
- overwrite-diverted
Overwrite a diverted file with an undiverted version.
- remove-essential
Remove an essential package. Note that this can cause your system to stop working.
- remove-reinstreq
Remove packages that are broken and are marked to require reinstallation.
- -G
Don't install a package if a newer version is already installed. The same as --refuse-downgrade.
- --ignore-depends=pkglist
Dependency problems result only in a warning for the packages in pkglist.
- --largemem
Specify that dpkg can use as much memory as it needs.
- --new
New binary package format. This is a dpkg-deb option.
- --no-act
Go through the motions, but don't actually write any changes. Used for testing. Be sure to specify before the action; otherwise changes might be written.
- --nocheck
Ignore the contents of the control file when building a package. This is a dpkg-deb option.
- -O, --selected-only
Process only packages that are marked as selected for installation.
- --old
Old binary package format. This is a dpkg-deb option.
- -R, --recursive
Recursively handle .deb files found in the directories specified with -A, --install, --unpack, and --avail and their subdirectories.
- -R, --root=dir, --admindir=dir, --instdir=dir
Change default directories. admindir contains administrative files with status and other information about packages; it defaults to /var/lib/dpkg. instdir is the directory in which packages are installed and defaults to /. Changing the root directory to dir automatically changes instdir to dir and admindir to /dir/var/lib/dpkg.
- --smallmem
Specify that dpkg should try to preserve memory.
dpkg-deb
dpkg-deb action [options]
Backend command for building and managing Debian package archives. Also see dpkg; you'll often want to use dpkg to pass commands through to dpkg-deb, rather than call dpkg-deb directly.
Actions
- -b dir [archive], --build dir [archive]
Create an archive from the filesystem tree starting with directory dir. The directory must have a DEBIAN subdirectory containing the control file and any other control information. If archive is specified and is a filename, the package is written to that file; if no archive is specified, the package is written to dir.deb. If the archive already exists, it is replaced. If archive is the name of a directory, the dpkg-deb looks in the control file for the information it needs to generate the package name. (Note that for this reason, you cannot use --no-check with a directory name.)
- -c archive, --contents archive
List the filesystem-tree portion of archive.
- -e, --control archive dir
Extract control information from archive into the directory dir, which is created if it doesn't exist.
- -f archive [control-fields], --field archive [control-fields]
Extract information about one or more fields in the control file for archive. If no fields are provided, print the entire control file.
- -h, --help
Print help information and exit.
- -I archive [control-files], --info archive [control-files]
Provide information about binary package archive. If no control files are provided, print a summary of the package contents; otherwise, print the control files in the order they were specified. An error message is printed to standard error for any missing components.
- --fsys-tarfile archive
Extract the filesystem tree from archive, and send it to standard output in tar format. Can be used with tar to extract individual files from an archive.
- --license
Print the license information and exit. Accepts the spelling --licence in addition to --license.
- --version
Print the version number and exit.
- -x archive dir, --extract archive dir
- -X archive dir, --vextract archive dir
Extract the filesystem tree from archive into the specified directory, creating dir if it doesn't already exist. -x (--extract) works silently, while -X (--vextract) lists the files as it extracts them. Do not use this option to install packages; use dpkg instead.
Options
- -D
Turn on debugging.
- --new
Build a new-style archive format (this is the default).
- --no-check
Don't check the control file before building an archive. This lets you build a broken archive.
- --old
Build an old-style archive format.
dpkg-split
dpkg-split [action] [options]
Split a binary package into smaller pieces and reassemble the pieces, manually or in automatic mode. The automatic mode maintains a queue of parts for reassembling. Useful for transferring to and from floppy disks.
Actions
- -a -o output part, --auto -o output part
Add part to the queue for automatic reassembly and if all the parts are available, reassemble the package as output.
- -d [packages], --discard [packages]
Discard parts from the automatic-assembly queue. If any packages are specified, discard only parts from those packages. Otherwise, empty the queue.
- -I parts, --info parts
Print information about the part file or files specified.
- -j parts, --join parts
Join the parts of a package file together from the parts specified. The default output file is package-version.deb.
- -l, --listq
List the contents of the queue of parts waiting for reassembly, giving the package name, the parts that are on the queue, and the number of bytes.
- -s full-package [prefix], --full-package [prefix]
Split the package full-package into parts, named prefixNofM.deb. The prefix defaults to the full-package name without the .deb extension.
- -h, --help
Print help message and exit.
- --license
Print the license information and exit. Accepts the spelling --licence in addition to --license.
- --version
Print the version information and exit.
Options
- --depotdir
Specify an alternate directory depotdir for the queue of parts waiting for reassembly. Default is /var/lib/dpkg.
- --msdos
Force --split output filenames to be MS-DOS-compatible.
- -Q, --npquiet
Do not print an error message for a part that doesn't belong to a binary package when doing automatic queuing or reassembly.
- -o output, --output output
Use output as the filename for a reassembled package.
- -S num, --partsize num
When splitting, specify the maximum part size (num) in kilobytes. Default is 450 KB.
dselect
dselect [options] [action]
A screen-oriented user frontend to dpkg. The primary user interface for installing and managing packages. See dpkg and dpkg-deb for information on building packages.
Actions
If dselect is run with no action specified on the command line, it displays the following menu:
The asterisk (on the first line here) shows the currently selected option. Any of the menu items can be specified directly on the command line as an action (access, update, select, install, config, remove, quit) to go directly to the desired activity. For example:* 0. [A]ccess Choose the access method to use. 1. [U]pdate Update list of available packages, if possible. 2. [S]elect Request which packages you want on your system. 3. [I]nstall Install and upgrade wanted packages. 4. [C]onfig Configure any packages that are unconfigured. 5. [R]emove Remove unwanted software. 6. [Q]uit Quit dselect.%dselect accessIf you enter quit on the command line, dselect exits immediately without doing anything. An additional command-line action is menu, which displays the menu and is equivalent to omitting the action.
Options
- --admindir dir
Change the directory that holds internal data files to dir. Default is /var/lib/dpkg.
- -D [file], --debug [file]
Turn on debugging. Send output to file if specified.
- --help
Print help message and exit.
- --license
Print the license information and exit. Accepts the spelling --licence in addition to --license.
- --version
Print version information and exit.
Back to: Linux in a Nutshell, 3rd Edition
© 2001, O'Reilly & Associates, Inc.
webmaster@oreilly.com