deb (file format)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Debian package
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

deb is the format, as well as extension of the software package format for the Debian Linux distribution and its derivatives.


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.[2]

The common program for handling these packages is dpkg, usually via other programs such as apt/aptitude or other APT front-ends such as Synaptic or KPackage.[3]

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.[4]

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.[5] In particular, documentation files are normally omitted. udeb packages are not installable on a standard Debian system, but are used in Debian-Installer.


Diagram showing an 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.[6] This package contains three sections:[7]

  • 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.[8]
  • 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.[9][10]
  • 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.[11][12]

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.[13]

File header[edit]

Each file stored in an 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).[14]

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.[15] The other two file headers are to define the control and data sections.[16]

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.[17][18][19][20]
  • md5sums contains MD5 checksums of all files in the package in order to detect corrupt or incomplete files.[21]
  • conffiles lists the files of the package that should be treated as configuration files. Configuration files are not overwritten during an update unless specified.[22]
  • preinst, postinst, prerm and postrm are optional scripts that are executed before or after installing, updating or removing the package.[23][24]
  • config is an optional script that supports the debconf configuration mechanism.[25]
  • shlibs list of shared library dependencies.[26][27]


See also[edit]

External links[edit]


  1. ^ "Media Type Registration for vnd.debian.binary-package". Internet Assigned Numbers Authority. Retrieved 21 May 2014. 
  2. ^
  3. ^
  4. ^
  5. ^
  6. ^
  7. ^
  8. ^
  9. ^
  10. ^
  11. ^
  12. ^
  13. ^
  14. ^
  15. ^
  16. ^
  17. ^
  18. ^
  19. ^
  20. ^
  21. ^
  22. ^
  23. ^
  24. ^
  25. ^
  26. ^
  27. ^
  28. ^
  29. ^
  30. ^
  31. ^