Skip to content
Latchkey

dpkg-buildpackage: Usage, Options & Common CI Errors

dpkg-buildpackage drives the full Debian source-to-.deb package build.

dpkg-buildpackage orchestrates building a Debian package from a debian/ directory. In CI the recurring blockers are unmet build dependencies and the signing step, which is why -us -uc -b is the standard unattended invocation.

What it does

dpkg-buildpackage runs the Debian package build sequence defined by debian/rules: it checks build-deps, runs the clean/build/binary targets, and produces .deb (and optionally source) artifacts plus a .changes file. It is the canonical Debian packaging entry point.

Common usage

Terminal
dpkg-buildpackage -us -uc -b       # binary-only, unsigned
dpkg-buildpackage -us -uc          # source + binary, unsigned
sudo apt-get build-dep .           # install build deps first
dpkg-buildpackage -us -uc -b -j4   # parallel build
debuild -us -uc -b                 # wrapper with lintian

Options

FlagWhat it does
-bBuild binary packages only
-usDo not sign the source .dsc
-ucDo not sign the .changes file
-SBuild a source package only
-j<N>Pass parallelism to the build
-dDo not check build dependencies

Common errors in CI

"dpkg-checkbuildconflicts/dpkg-buildpackage: error: Unmet build dependencies: foo (>= 1.0)" - install them, typically with apt-get build-dep . or mk-build-deps, before building. Without -us -uc the build tries to gpg-sign and fails in headless CI ("gpg: no default secret key"). Always pass them for unsigned CI artifacts. "debian/rules: No such file" means you are not at the package source root. Use a clean chroot (sbuild/pbuilder) for reproducible, dependency-isolated builds.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →