dh_builddeb - Linux


dh_builddeb automates building Debian packages from source control. It is primarily designed for packaging software distributed using the Debian build system.


dh_builddeb [options] [build profile]


  • -a | –arch=: Specify the target architecture (e.g., i386, amd64). Default: current architecture.
  • -c | –component=: Override the default component (e.g., main, contrib).
  • -e | –extra=: Specify an additional file to include in the package.
  • -f | –fail-on-warnings: Exit with an error if any warnings are encountered.
  • -i | –install: Perform an installation after building the package.
  • -l | –override-debian-dir=: Use a custom directory for Debian files.
  • -n | –no-auto-build: Prevent automatic source package extraction and configuration.
  • -p | –package=: Override the default package name.
  • -r | –release=: Override the default release (e.g., testing, stable).
  • -t | –type=: Specify the package type (e.g., deb, udeb). Default: deb.
  • -v | –verbose: Enable verbose output.


Example 1: Building a simple package


Example 2: Building a package with a custom package name

dh_builddeb -p my-custom-package

Example 3: Installing the package after build

dh_builddeb -i

Common Issues

  • Package dependencies not detected: Ensure that all required dependencies are specified in the debian/control file.
  • Build errors: Consult the build log for details. Check for missing dependencies, incorrect permissions, or configuration issues.
  • Permission denied errors: Ensure that the user has write access to the Debian files directory.


Example: Creating a Debian package using a shell script


# Prepare source files
echo "Preparing source files..."
git clone https://example.com/project.git

# Build Debian package
echo "Building Debian package..."
cd project

# Upload package to repository
echo "Uploading package to repository..."
dpkg-scansources /path/to/sources.list /path/to/Debian

Related Commands

  • dch: Generate a Debian changelog entry.
  • debhelper: Provides a framework for packaging Debian packages.
  • dpkg-buildpackage: Build Debian packages.
  • dpkg-deb: Manipulate Debian packages.
  • lintian: Check the quality of Debian packages.