Debian package versioning


Start here: section 5.6.12 of the Debian Policy Manual, or see the man page for deb-version.

The package version is


A package without a Debian revision number indicates the software was written to be a Debian package.


slapd (2.4.44+dfsg-5+deb9u2): The upstream version is 2.4.44+dfsg and the Debian revision is 5+deb9u2.

linux-base (4.5~deb8u1): The upstream version is 4.5~deb8u1 and there is NO Debian revision number.

The first number in the Debian revision indicates how often the Debian package has been revised, starting over at 1 when the upstream version changes. The +deb9u2 indicates that the Debian packaging itself has not changed, but that a patch has been added to the Debian package build to address some security or other type of bug.

Version ordering

The package installation system when upgrading packages choose to overwrite an older version of a package with a newer package. In this case "newer" means the version number is larger. Thus, how versions are compared is important. To compare two versions, you can use

dpkg --compare-versions 11a lt 100a && echo true

(Source: StackOverflow.)

For the detailed algorithm on version comparisons, see section 5.6.12 of the Debian Policy Manual.

Using tilde (~) in the Debian version

The tilde character is sometimes used in the Debian version portion of the version and has the unusual characteristic of forcing the version to be sorted earlier (assuming the initial portions are the same). This is easiest to see with an example:

1.2-4~a~a < 1.2-4~a < 1.2-4~b < 1.2-4 < 1.2-5~a < 1.2-5 < 1.3-1

In particular, this is useful in when bulding "temporary" backports. This is best illustrated with an example. Assume the stable release is buster (10) and that the package mypackage has version 6-1 in buster. Version 8-1 is in sid and you want to use this version on your buster servers. So you build the package for buster and give it the version 8-1~bp10+1. You then install this version on all of your buster servers. When it is time to upgrade your servers to bullseye (11), if version 8-1 is (still) the current version in bullseye, then bullseye's version will take precedence over version 8-1~bp10+1 ensuring that you get the official Debian package installed.

See section 5.6.12 of the Debian Policy Manual for more details.


You may see the string +dfsg added to the end of version string. From What does "dfsg" or "ds" in the version string mean?:

"+dfsg.N" and '+ds.N" are a conventional way of extending a version string, when the Debian package's upstream source tarball is actually different from the source released upstream. The former is used when upstream's source release contains elements that do not satisfy the Debian Free Software Guildelines (DFSG) and hence may not be distributed as source in the Debian system, the latter (standing for "Debian Source') is used when the modification are for other non-DFSG reasons.