Raspberry Pi_Eng_17.2.2 Package Management Tool – dpkg


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


17.2.2  Package Management Tool dpkg

 

The "dpkg" tool is the software based on Debian's package management system, which is used to install or remove ".deb" packages and provide information about packages.

 

The "dpkg" package includes the various programs together needed to actually run the packaging system, such as "dpkg-deb", "dpkg-split", "dpkg-query", "dpkg-statoverride", "dpkg-divert" and "dpkg-trigger" as well as the "dpkg" program.

 

The "dpkg" itself is a low level tool, and runs in a CLI mode to enter all commands in text format. It usually fetches packages remotely and handles complex package inter-relationships using higher-level tools such as "APT", "aptitude", and "synaptic".

.

Use the "dpkg" command when managing packages using the "dpkg" tool. When this command is executed, internal commands such as "dpkg-deb" and "dpkg-query" are executed internally according to the designated action and option.

 

This command has the format of specifying the action and option as follows.

 

[Command Format]

dpkg [option...] action

 

[Command Overview]

   This manages the package of system.

   User privilege          -- Normal user.

 

[Detail Description]

   "dpkg" is designed to specify one action at a time, and can optionally specify options.

 

[Main Option]

   Action

-i, --install package-file...

Install the package. If --recursive or -R option is specified, package-file must refer to a directory instead.

--unpack package-file...

Unpack the package, but don't configure it. If --recursive or R option is specified, package-file must refer to a directory instead.

--configure package...|-a|--pending

 

Configure a package which has been unpacked but not yet configured.

If -a or --pending is given instead of package, all unpacked but unconfigured packages are configured.

-r, --remove package...|-a|--pending

Remove an installed package. This removes everything except conffiles, which may avoid having to reconfigure the package if it is reinstalled later (conffiles are configuration files that are listed in the DEBIAN/conffiles control file). If -a or pending is given instead of a package name, then all packages unpacked, but marked to be removed in file /var/lib/dpkg/status, are removed.

-P, --purge package...|-a|--pending

 

Purge an installed or already removed package. This removes everything, including conffiles. If -a or --pending is given instead of a package name, then all packages unpacked or removed, but marked to be purged in file /var/lib/dpkg/status, are purged.

-V, --verify [package-name...]

 

Verifies the integrity of package-name or all packages if omitted, by comparing information from the files installed by a package with the files metadata information stored in the dpkg database. The origin of the files metadata information in the database is the binary packages themselves. That metadata gets collected at package unpack time during the installation process.

 

 

   Action related with "dpkg-query"

-l, --list package-name-pattern...

List packages matching given pattern.

 

The first three columns of the output show the desired action, the package status, and errors, in that order.

Desired action:

           u = Unknown

           i = Install

           h = Hold

           r = Remove

           p = Purge

Package status:

           n = Not-installed

           c = Config-files

           H = Half-installed

           U = Unpacked

           F = Half-configured

           W = Triggers-awaiting

           t = Triggers-pending

           i = Installed

Error flags:

           <empty> = (none)

           R = Reinst-required

-s, --status package-name...

Report status of specified package.

 

-L, --listfiles package-name...

List files installed to your system from package-name.

 

-S, --search filename-search-pattern...

Search for a filename from installed packages.

 

-p, --print-avail package-name...

Display details about package-name, as found in /var/lib/dpkg/available. Users of APT-based frontends should use apt-cache show package-name instead.

 

   Action related with "dpkg-deb"

-b, --build directory [archive|directory]

Build a deb package.

-c, --contents archive

List contents of a deb package.

-e, --control filename [directory]

Extract control-information from a package.

-x, --extract archive directory

Extract the files contained by package.

-X, --vextract archive directory

Extract and display the filenames contained by a package.

-f, --field archive [control-field...]

Display control field(s) of a package.

--fsys-tarfile archive

Display the filesystem tar-file contained by a Debian package.

 

-I, --info archive [control-file...]

Show information about a package.

 

   Option

-B, --auto-deconfigure

When a package is removed, there is a possibility that another installed package depended on the removed package. Specifying this option will cause automatic deconfiguration of the package which depended on the removed package.

--ignore-depends=package,...

Ignore dependency-checking for specified packages (actually, checking is performed, but only warnings about conflicts are given, nothing else).

--admindir=dir

 

Change default administrative directory, which contains many files that give information about status of installed or uninstalled packages, etc. (Defaults to /var/lib/dpkg)

--instdir=dir

 

Change default installation directory which refers to the directory where packages are to be installed. instdir is also the directory passed to chroot(2) before running package's installation scripts, which means that the scripts see instdir as a root directory. (Defaults to /)