pbuilder(8)
โจ pbuilder(8) โจ
okay bestie, welcome to pbuilder โ the personal package builder ๐
(it's a section 8 manual page, iykyk)
๐ธ NAME ๐ธ
pbuilder โ personal package builder ๐ซถ
๐ SYNOPSIS ๐
pbuilder create [options]
pbuilder update [options]
pbuilder build [options] .dsc-file
pbuilder clean
pbuilder login [options]
pbuilder execute [options] -- script [script options]
pbuilder dumpconfig
pbuilder debuild [options]
๐ฆ DESCRIPTION ๐ฆ
So basically, this is the front end program to the pbuilder suite of programs โ it's the main character ๐ of the whole operation. What's it for? Creating and maintaining a chroot environment, and then building Debian packages inside that chroot environment. That's the whole vibe, fr fr. โจ
๐ COMMANDS ๐
create
Creates a base.tgz for the distribution you specified. ๐
update, up, u
Updates the base.tgz for the distribution you specified. AND โ plot twist โ by specifying the --override-config option, you can install a brand new apt-line using whatever options and settings are sitting in the configuration file for that base.tgz. Slay. ๐
For example, to switch the distribution of an existingbase.tgztosid, specify the--distribution sid --override-configoptions toupdate.
build, b
Builds the package specified by .dsc-file in the chroot environment that was created using the base.tgz. ๐ฅ
clean
Cleans up the directory specified by the configuration BUILDPLACE and APTCACHE specified in /etc/pbuilderrc. (yes, the one true config file, periodt) ๐ง
login, l
Logs you into the chroot, and then cleans up afterwards. โ ๏ธ Any changes you make will NOT be kept. Only use this for temporary and debugging purposes, bestie โ it's giving "no thoughts, head empty, throwaway session". Do not bind-mount filesystems directly inside the chroot. Use the --bindmounts option to mount instead, okay? ๐
execute, e
Execute a script or command inside the chroot, in a similar manner to login. ๐
The file specified in the command-line argument will be copied into the chroot, and invoked.
The remaining arguments are passed on to the script.
dumpconfig
Dumps configuration information โ it's for debugging, bestie. ๐
debuild
Builds a Debian package from the Debian source directory. The current directory should have the usual debian/ directory.
Same as pdebuild --use-pdebuild-internal ๐
โญ OPTIONS โญ
okay so, the command is followed by options of the form --option name which will modify the semantics as explained below. They are applied from left-to-right, and when there are conflicting options, the rightmost options will have effect. (rightmost wins, no cap.) ๐
--basetgz [basetgz-location]โ Specifies the location ofbase.tgz.
This option will define the default distribution and apt-lines when used in pbuilder update and pbuilder create. โจ
--buildplace [location of build]โ Specifies the location where building andbase.tgzupdating and creation takes place. This is a temporary work directory. ๐ ๏ธ
A subdirectory of that directory using the current PID of the process is used.
--buildresult [location to put build result]โ Specifies the location the build result gets into after building. Thedebfiles and other files that have resulted from build are copied there. Note that the default value is NOT the current directory, or.., but another place:/var/cache/pbuilder/result. This is to avoid overwriting already existing deb files with the newly generated ones. ๐ซถ--mirror [mirror location]โ Specifies the URL of the Debian mirror to be specified insources.listinside the chroot. This option is only valid when distribution is being specified, forupdateandbuildtargets. The format is something like:http://http.us.debian.org/debianwhich should point to your favourite mirror. ๐ช
This option can optionally be omitted, and left blank, in which case, this part is skipped.
Note that these URLs specified topbuilderwill be used from within the chroot, and specifyingfile:/somewhere/will most probably fail. ๐
--othermirror [deb http://xxx/xxx/ ./ | other deb lines... ]โ The lines which is added to thesources.list, delimited with|. Likedeb http://local/mirror stable main|deb file:/usr/local/mirror ./๐ธ
The deb lines here are the ones that will appear at the top of the sources.list inside the chroot. Be sure to follow the syntax rules of sources.list(5). These lines appear at the beginning of the constructed sources file, so this is the place to list your local mirror sites; apt will then use them in preference to the ones listed in --mirror. ๐
--distribution [distribution]โ Specifies the distribution used. The supported values are the onesdebootstrapsupports, plusexperimentalwhich is special cased inpbuilder. For instance you may use:sidorexperimental. ๐--architecture [architecture]โ Specifies the build architecture (as described indpkg-architecture(1)). It'll be the architecture used when creating the chroot, defaults to the system one. The supported values are the onesdebootstrapsupports. ๐๏ธ--host-arch [architecture]โ Specifies the host architecture (as described indpkg-architecture(1)). Defaults to the build architecture. Use this flag if you are interested in doing a cross architecture build.pbuilderwill make sure the environment is correctly set up, including addingnochecktoDEB_BUILD_OPTIONSandDEB_BUILD_PROFILES. ๐--no-auto-crossโ Suppress automatic addition ofnochecktoDEB_BUILD_OPTIONSandDEB_BUILD_PROFILESin case of cross-building. All the other configuration (adding the architecture todpkg, updating the apt cache, installing the cross toolchain, passing--host-archtodpkg-buildpackage, etc) is done nonetheless; specify this flag twice to prevent that from happening too. ๐--components [components]โ Specifies the default distribution components to use. eg."main contrib non-free". Default is"main". โจ--override-configโ Specify to use different apt set up inside the chroot than it was used for creating thebase.tgz. Specify this when you want to dopbuilder updatewith a different distribution target set up. ๐
--distribution, --components, --mirror, --othermirror options are only valid when --override-config option is specified in update target, or when pbuilder create is being called.
--http-proxy [proxy]โ Specifies the http proxy URL. Something likehttp://xxx.xxx.xxx.xxx:8080/should do. ๐--use-network [yes|no]โ Specifyyeswhen you do not want to disable network access during build. Network is not available on a Debian buildd, so you might want to keep the default ofno. Disabling network access currently only works on Linux. ๐ง--aptcache [location of retrieved package files]โ Specifies the location where the packages downloaded by apt should be cached. Use--aptcache ""if you want caching to be turned off. ๐พ--debdeltaโ This option is used in theupdatetarget, and enable the use ofdebdelta(if it is already installed, otherwise will be installed the first time this option is used). ๐งฉ--configfile [configuration file to load]โ Additional configuration file to read after all other configuration files have been read. ๐--hookdir [location of user scripts]โ Specifies the location where scripts for user intervention during thecreateandupdateprocess are stored. Scripts are executed inside the chroot. The script names must be in the formX<digit><digit><whatever-else-you-want>much like boot scripts. The scripts must be executable and may be either binaries or interpreted scripts. If it is a script in other than Bourne Shell or Perl, it is up to the user to ensure the interpreter was previously installed in the chrooted environment. Files ending in~or.bakare ignored. ๐ช
Although it may not seem necessary, pbuilder --update does not invoke the hooks if --hookdir is empty, so if you want to avoid running hooks, run pbuilder with --hookdir "". ๐
If there is a distribution hook, for example, if there was a file sid inside the hook directory, and the script was creating the chroot for sid distribution, pbuilder will call debootstrap with that as the 4th parameter in the chroot creation process. This allows for use of custom debootstrap hook script. โจ
A<digit><digit><whatever-else-you-want> is for build target. It is executed before build starts; after unpacking the build system, and unpacking the source, and satisfying the build-dependency. ๐จ
B<digit><digit><whatever-else-you-want> is executed after build system finishes building, successfully, before copying back the build result. ๐
C<digit><digit><whatever-else-you-want> is executed after build failure, before cleanup. ๐
D<digit><digit><whatever-else-you-want> is executed before unpacking the source inside the chroot, after setting up the chroot environment. Create $TMP, and $TMPDIR if necessary. ๐ฆ
This is called before build-dependency is satisfied. Also useful for calling apt-get update. ๐
E<digit><digit><whatever-else-you-want> is executed after pbuilder update and pbuilder create finishes apt-get work with the chroot, before umounting kernel file systems (/proc) and creating the tarball from the chroot. ๐งต
F<digit><digit><whatever-else-you-want> is executed just before user logs in, or program starts executing, after chroot is created in login or execute target. ๐ช
G<digit><digit><whatever-else-you-want> is executed just after debootstrap finishes, and configuration is loaded, and pbuilder starts mounting /proc and invoking apt-get install in create target. ๐ฑ
H<digit><digit><whatever-else-you-want> is executed just after unpacking the chroot, mounting proc and any bind mount specified in BINDMOUNTS. It's executed for every target that requires the unpacked chroot. It's useful if you want to dynamically change the chroot guts before anything starts using it. ๐ซ
I<digit><digit><whatever-else-you-want> is executed after build system finishes building, successfully, after copying back the build results. ๐
In your hook, these environment variables are available, bestie โ memorize them, they're your backstage passes:
PBUILDER_OPERATIONโ a string telling you which pbuilder command got called. Possible values arebuild,clean,create,debuild,dumpconfig,execute,login,update.BUILDDIRโ the place where the build happens, and the sources are inside a directory named<package>-<version>.DISTRIBUTIONโ the name of the used distribution, as provided by theDISTRIBUTIONconfig value, or the--distributioncommand line flag.BUILD_ARCHโ the build architecture, aka the architecture the package is building on.HOST_ARCHโ the host architecture, aka the architecture the package is building for.
--debbuildoptsoptions โ the list of options that get passed on todpkg-buildpackage. Multiple flags are additive and are appended to the value ofDEBBUILDOPTSas specified inpbuilderrc. Wanna clear the whole list? Pass the empty string, like--debbuildopts "". Multiple options are delimited with spaces, like--debbuildopts "-j100 -E".--profilesprofile1[,profile2] โ comma-separated list of build profiles to use during the build. It overrides a possibleDEB_BUILD_PROFILESenvironment variable that's already defined. override queen behavior ๐--logfilefile to log โ specifies the logfile to create. The messages generated during execution get written to the specified file, and to standard output.--loglevelI โ specify how much output you want from pbuilder. Valid values areE(errors only),W(errors and warnings),I(errors, warnings and informational) andD(everything including some debug messages).--binary-archโ specify to build only architecture specific targets instead of all targets. This instructs pbuilder to respect onlyBuild-Depends,Build-Depends-Arch,Build-Conflicts,Build-Conflicts-Archsource relationships, and callsdpkg-buildpackagewith-B.
Setting --debbuildopts after this option will re-set some parts of the effects.
Use this option rather than using --debbuildopts -B. fr fr, this is the way.
--binary-indepโ specify to build only architecture independent targets instead of all targets. This instructs pbuilder to respect onlyBuild-Depends,Build-Depends-Indep,Build-Conflicts,Build-Conflicts-Indepsource relationships, and callsdpkg-buildpackagewith-A.
Setting --debbuildopts after this option will re-set some parts of the effect.
Use this option rather than using --debbuildopts -A. iykyk
--source-only-changes,--no-source-only-changesโ specify whether or not to generate an additional.changesfile for a source-only upload, whilst still producing a full.changesfile for any binary packages built.--bin-nmuchangelog message โ specify to build a binary-NMU instead of a standard package. This option takes the changelog message to pass to the binary-NMU package as parameter.--bin-nmu-maintainermaintainer โ specify the maintainer name and email address to be displayed in the changes file. If no maintainer is provided, it defaults to the last uploader.--bin-nmu-versionversion number โ specify the number to append to the version in the binary-NMU package. If no number is provided, it defaults to1.--bin-nmu-timestamptimestamp โ specify the timestamp to use in the generatedchagnelogentry. If no timestamp is provided, it defaults to current time. If you want to specify the time as a number of seconds since1970-01-01 00:00:00 UTC, prepend an at sign (@) like@1478786376.--bindmountsbind-mount-points โ bind-mount the specified directories to inside the chroot. bind-mount-points is a space-delimited list of directories to bind-mount, which should be specified in a space-delimited manner, surrounded in double quotations, like:"/srv /somedir /someotherdir"--debootstrapopts --variant=buildd --keyring /usr/share/keyrings/debian-archive-keyring.gpgโ add extra command-line options todebootstrap.
Specify multiple options through multiple instances of this option, for example:
--debootstrapopts --arch=arm --debootstrapopts --variant=buildd
--debootstrapdebootstrap โ use the specified debootstrap implementation asdebootstrap. Known implementations arecdebootstrap,qemu-debootstrapanddebootstrap, and the default is to usedebootstrap.--allow-untrustedโ allow untrusted (no key installed) and unsigned repositories.
Warning: enabling this option may allow remote attackers to compromise the system. ๐ Better use signed repositories and --keyring to add the key(s). please bestie, be safe.
--keyringpath/to/keyring โ additional keyrings to use for package verification with apt, not used for debootstrap (use--debootstrapoptsfor that). Use this to add (local) signed repositories. By default thedebian-archive-keyringpackage inside the chroot is used. Can be specified multiple times.
Keyrings are copied into /etc/apt/trusted.gpg.d in the chroot. APT supports it since version 0.7.25.1, firstly available in the Debian release codenamed "squeeze" (released on 2011). For older chroots, use a G hook to run apt-key manually.
--save-after-login,--save-after-execโ save the chroot image after exiting from the chroot instead of deleting changes. Effective forloginandexecutesession.--autocleanaptcacheโ clean apt cache automatically, to runapt-get autocleanto only keep the packages which are required for the version of Debian. This is useful when you keep a aptcache directory for each distribution and want to keep the size of the aptcache down. declutter era ๐ฟ--helpโ show a brief help message.
๐ฅ MORE SPECIFIC OPTIONS ๐ฅ
Some options are more involved to pbuilder internal than others. The following options are available. we're going deeper, babes ๐ฆ
--removepackagespackages to remove โ removes the packages on creating thebase.tgz. Use this option to remove potentially dangerous or undesirable packages, likelilowhich nobody will need to have inside a chroot.
Packages should be specified in a space-delimited manner, surrounded in double quotations, like "lilo gcc mawk"
--extrapackagespackages to add โ adds packages specified as an addition to the default, which isbuild-essentialby default. This is used inbuildandcreate(after successfully creating the initial chroot) andupdate.
The packages should be specified as a space-delimited list, or by specifying --extrapackages multiple times.
--debemailmaintainer-name <email-address> โ specifies thatdpkg-buildpackagebe called with-mmaintainer-name <email-address>instead of the default value specified in the environment variable, orpbuilderrc
This option is almost obsolete, use --debbuildopts instead. she's giving legacy ๐
--pkgname-logfileโ alternative option to the--logfileoption. Automatically creates a logfile that is named by the.dscfile name, only really applicable for thebuildtarget.
The file extension is specified by PKGNAME_LOGFILE_EXTENSION in pbuilderrc
--aptconfdirAPT configuration directory to use โ uses the apt configuration file found in the specified directory as the chroot configuration./etc/aptis one example, so that the same configuration can be used inside the chroot.
This option overrides other options, and may cause some inconsistency problems. chaos warning ๐
--timeouttimeout in sleep time โ time out building after sleeping the set time. Specify something like--timeout 10hin the command line. Default is no timeout.--no-targzโ not usingbase.tgzfor operation. The--buildplacewill not be deleted and reconstructed from a.tar.gzfile. Also, pbuilder will not add its process ID to the--buildplaceas it usually would.
Useful when experimenting with chroots, or trying to create chroots outside control of pbuilder.
--compressprogโ program to use for compression of thebase.tgz. The default is to usegzip, and any program that can be used to compress data using a pipe can be used.
If set to "pigz", compression and decompression is gzip compatible but will use all available CPUs. parallel slay โก If set to "cat", there will be no compression at all (so compression/decompression will be a lot faster but takes much more space on the disk).
--twiceโ build the package twice in a row. Useful to ensure the package cleans up properly. The resulting packages are the ones from the second build. double the build, double the vibes โจ--preserve-buildplaceโ do not clean the--buildplaceif it has the same contents as the.tar.gzfile, and no modifications are done.
For preserving the build place for create and update targets, see debug option.
As with --no-targz, suppresses appending pbuilder's process ID to the --buildplace.
This is useful if you want to attempt to build a large number of packages successively, but you expect that many of them cannot have their build dependencies satisfied.
It will clean up the build place on failure, or after a successful build.
--debugโ turn on Debug mode of pbuilder, to be verbose about errors, and try to avoid cleanup processing when error happens inupdateandcreatetargets.--inputfilefilename โ add extra file to be copied toBUILDDIRinside the build environment.
available in build and login and execute targets.
๐ FILES ๐
/etc/pbuilderrcโ the system-wide configuration file for pbuilder. the big boss config ๐/usr/share/pbuilder/pbuilderrcโ the default settings for pbuilder, used as fallback for all values that is not specified in/etc/pbuilderrc.${HOME}/.pbuilderrcโ the personal configuration file for pbuilder, which overrides settings set in other configuration files.
Note that${HOME}is usually/root(if you are running pbuilder throughsudo). yeah, sudo said so ๐
๐ธ EXAMPLES ๐ธ
Okay bestie, these are the real moments โ watch how it actually goes down. โจ
๐ pbuilder create
So you run this and the terminal just starts doing the thing. It looks like:
# pbuilder create
Distribution is sid.
Building the build environment
-> running debootstrap
/usr/sbin/debootstrap
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
.
.
The . . at the bottom is just debootstrap doing its little thing and the output going on and on. Not me hyping up dots but okay. ๐
๐ pbuilder update
# pbuilder update
W: /home/dancer/.pbuilderrc does not exist
Building the build Environment
-> extracting base tarball [/var/cache/pbuilder/base.tgz]
.
.
Not the W: warning jumpscare ๐ โ that's literally just it telling you there's no .pbuilderrc at /home/dancer/.pbuilderrc, and it keeps going anyway. Then it pulls out the base tarball at /var/cache/pbuilder/base.tgz and does its whole routine.
๐ฆ pbuilder build
# pbuilder build dsh_*.dsc
I: using fakeroot in build.
Current time: Sat Jan 20 12:03:34 JST 2007
pbuilder-time-stamp: 1169262214
Building the build Environment
-> extracting base tarball [/home/dancer/DEBIAN/pbuilder/pbuilder/testsuite/tmp.FeeAX18779/testimage]
-> creating local configuration
.
.
Notice how it uses fakeroot for the build, prints the Current time, drops a pbuilder-time-stamp, extracts the base tarball (here from that whole long testsuite path), and then makes the local configuration. Chef's kiss. ๐
๐ BUGS
This program is starting to have too many options already.
That's it, that's the bug report, and honestly? Fair. The options have options at this point. ๐ญ
๐ AUTHOR
Initial coding, and the main maintenance, is done by Junichi Uekawa <dancer@debian.org>. The user hooks code was added by Dale Amon <amon@vnl.com>. Give them their flowers fr fr ๐
The homepage is available at https://pbuilder.alioth.debian.org
๐ SEE ALSO
/usr/share/doc/pbuilder/pbuilder-doc.htmlpdebuild(1)pbuilderrc(5)
And that's the whole page, bestie โ this Debian classic, dated 2016 March, filed under pbuilder(8). Go forth, build your packages in a clean little sandbox, and slay. ๐
โจ๐ซถ
๐ฆ where this page comes from
- debian bookworm: pbuilder 0.231 ยท GPL-2.0-or-later
- debian trixie: pbuilder 0.231.1 ยท GPL-2.0-or-later
- epel 10: pbuilder 0.231.1-5.el10_1 ยท GPL-2.0-or-later
- epel 9: pbuilder 0.231.1-4.el9 ยท GPL-2.0-or-later
- fedora 43: pbuilder 0.231.1-6.fc43 ยท GPL-2.0-or-later
- fedora 44: pbuilder 0.231.3-2.fc44 ยท GPL-2.0-or-later
- opensuse-leap 16.0: pbuilder 0.231-bp160.1.4 ยท GPL-2.0-or-later
- ubuntu jammy: pbuilder 0.231build1 ยท GPL-2.0-or-later
- ubuntu noble: pbuilder 0.231build1 ยท GPL-2.0-or-later
- ubuntu questing: pbuilder 0.231.1
- ubuntu resolute: pbuilder 0.231.3 ยท GPL-2.0-or-later
- ubuntu stonking: pbuilder 0.231.3 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms