create new tag
view all tags

Pbuilder Component

Useful Articles

Building Packages

Once you have the pbuilder component installed and started you can simply build packages like this:

DIST=eoan sudo pbuilder build lcfg-example_1.2.71-1.dsc

(remove the sudo command if running as root).

The string passed in via the DIST environment variable is required and refers to one of your configured chroots.

The results will be stored in the location in the BUILDRESULT variable for the chroot (usually /var/cache/pbuilder/result/$DIST).

LCFG Configuration

A basic configuration using the pbuilder component is done something like this:


#include <lcfg/options/pbuilder.h>

The following options are supported:

Run lintian on the results of the build to check for common packaging errors
Make the results of a build available for subsequent builds through a local apt package repository.
This is necessary if you want to run pbuilder as a normal user. Add the users to the local pbuilder group or configure sudoers (via the lcfg sudo component) as required.

Currently the following chroots are configured by default:

  • Debian buster/stable
  • Ubuntu bionic
  • Ubuntu disco
  • Ubuntu eoan
  • Ubuntu focal


See lcfg/defaults/pbuilder.h for the current set of defaults. To set your own defaults for all chroots you can use the PBUILDER_DEFAULT macro, for example:


Some options are treated as lists so to make it easier to modify them we have PBUILDER_DEFAULT_BINDMOUNT and PBUILDER_DEFAULT_EXTRAPACKAGE, for example:



A distro is just a set of options which a chroot can inherit from. Using Debian as an example:

!pbuilder.distros              mADD(debian)

PBUILDER_DISTRO_OPTION(debian,COMPONENTS,main contrib non-free)

That configures the apt repository appropriately for a Debian based chroot.

You can then configure a chroot which inherits those settings like:



Adding a new chroot can usually be done quite simply with the PBUILDER_CHROOT macro, there is also a PBUILDER_CHROOT_OPTION macro for setting options. For example:

!pbuilder.chrt_aliases_buster mADD(stable)

That creates a new Debian-based chroot, named buster. It also gives the chroot an alias of stable so that either may be used in pbuilder commands.

You can inspect the generated configuration in the pbuilder.dir_chroots directory (which is usually <%sysinfo.path_lcfgconf%>/pbuilder/chroot).

To check the configuration for a chroot use the dumpconfig command, for example:

DIST=buster pbuilder dumpconfig


Hooks are scripts which are run at various stages of the build process. They are well described in the pbuilder manpage. The file name has an initial letter that signifies the stage at which it should be called, followed by a 2 digit number which controls the order in which scripts are called.

Several standard scripts are provided:

Runs lintian at the end of the build process to check for common packaging errors.
Makes the build results available for subsequent builds as a local apt repository.
Configures apt to use the Informatics Debian package repositories.

You can add your own scripts. They should be placed in the pbuilder.hooks_base directory (which is usually <%sysinfo.path_lcfgdata%>/pbuilder/hooks). Add the file name to the pbuilder.hooks resource and it will activated with a symlink into the pbuilder.hooks_dir directory (which is usually <%sysinfo.path_lcfgconf%>/pbuilder/hooks).

-- squinney - 2019-12-09

Topic revision: r1 - 2019-12-09 - squinney
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback