deb (file format)

From Wikipedia, the free encyclopedia
  (Redirected from Debian package)
Jump to: navigation, search
Debian package
Application-x-deb.svg
The GNOME icon for deb files
Filename extension .deb, .udeb
Internet media type application/vnd.debian.binary-package[1]
Developed by Debian
Type of format Package management system
Container for Software package
Extended from ar archive, tarball
Website deb(5)

deb is the extension of the Debian software package format and the most often used name for such binary packages.

Design[edit]

GDebi installing a .deb package

Debian packages are standard Unix ar archives that include two tar archives optionally compressed with gzip (zlib), Bzip2, lzma, or xz (lzma2): one archive holds the control information and another contains the installable data.

The common program for handling these packages is dpkg, usually via other programs such as apt/aptitude, the Ubuntu Software Center, Synaptic or Gdebi.

Debian packages can be converted into other package formats and vice versa using alien, and created from source code using checkinstall or the Debian Package Maker.

Some core Debian packages are available as udebs (“micro debs”), and are typically used only for bootstrapping a Debian installation. Although these files use the udeb filename extension, they adhere to the same structure specification as ordinary deb files. However, unlike their deb counterparts, udeb packages contain only essential functional files.[2] In particular, documentation files are normally omitted. udeb packages are not installable on a standard Debian system, but are used in Debian-Installer.

Implementation[edit]

Diagram showing a example file structure of a .deb file
Frhed hex editor displaying the raw data of a Debian package.

Since Debian 0.93, a deb package is implemented as an ar archive. This package contains three sections:

  • Global Header: This contains the file signature and the first file header which includes the debian-binary package identifier and the deb format version number. This is 2.0 for current versions of Debian.
  • Control Section: This contains a control archive (Usually named control.tar, control.tar.gz or control.tar.xz). This archive includes all package meta-information. It tells dpkg what to configure when the package is being installed.
  • Data Section: This contains a data archive (Usually named data.tar, data.tar.gz, data.tar.bz2, data.tar.lzma or data.tar.xz). This archive includes the actual installable files.

File signature[edit]

The file signature is a single field containing the magic ASCII string "!<arch>" followed by a single LF control character (0x0A). This is used to identify the file as a ar archive.

File header[edit]

Each file stored in a ar archive includes a file header to store information about the file. The common format is as follows. Numeric values are encoded in ASCII and all values right-padded with ASCII spaces (0x20).

Offset Length Name Format
0 16 File identifier ASCII
16 12 File modification timestamp Decimal
28 6 Owner identifier Decimal
34 6 Group identifier Decimal
40 8 File mode Octal
48 10 File size in bytes Decimal
58 2 Ending characters 0x60 0x0A

Directly following a file header is the file data for the file described in the header. .deb files use three file headers, the first is used to identify the ar archive as a Debian package. This is done in the first file header by setting the file identifier to debian-binary, then using the file data section to define the package version number. The other two file headers are to define the control and data sections.

Control archive[edit]

The control archive contents can include the following files:

  • control contains a brief description of the package as well as other information such as its dependencies.[3][4]
  • md5sums contains MD5 checksums of all files in the package in order to detect corrupt or incomplete files.[5]
  • conffiles lists the files of the package that should be treated as configuration files. Configuration files are not overwritten during an update unless specified.
  • preinst, postinst, prerm and postrm are optional scripts that are executed before or after installing, updating or removing the package.[6][7]
  • config is an optional script that supports the debconf configuration mechanism.
  • shlibs list of library dependencies.[8][9]

Adoption[edit]

See also[edit]

References[edit]

External links[edit]