2006-3-8 pbuilder User's Manual pbuilder-doc Usage and operations documentation in progress ($Id$) Junichi Uekawa Introducing pbuilder Aims of pbuilder pbuilder stands for Personal Builder, and it is an automatic Debian Package Building system for personal environments. pbuilder aims to be an easy-to-setup system for auto-building Debian packages inside a clean-room environment, so that it is possible to verify that a package can be built on most Debian installations. The clean-room environment is achieved through the use of a chroot image, so that only minimal packages will be installed inside the chroot. The Debian distribution consists of free software accompanied with source. The source code within Debian's "main" section must build within Debian "main", with only the explicitly specified build-dependencies installed. The primary aim of pbuilder is different from other auto-building systems in Debian in that its aim is not to try to build as many packages as possible. It does not try to guess what a package needs, and in most cases it tries the worst choice of all if there is a choice to be made. In this way, pbuilder tries to ensure that packages tested against pbuilder will build properly in most Debian installations, hopefully resulting in a good overall Debian source-buildability. The goal of making Debian buildable from source is somewhat accomplished, and has seen good progress. It is known that Debian 3.0 has problems when building from source. But the version after, Debian 3.1 should be better, and the version after. Using pbuilder Creating a base chroot image pbuilder create will create a base chroot image. The distribution code-name needs to be specified with the command-line option. Usually, "sid" is used, and the default is now sid. debootstrap is used to create the bare minimum Debian installation, and then build-essential packages are installed on top of the minimum installation using apt-get inside the chroot. For fuller documentation of command-line options, see the pbuilder.8 manual page. Some configuration will be required for /etc/pbuilderrc for the mirror site The mirror site should preferably be a local mirror or a cache server, so as not to overload the public mirrors with a lot of access. Use of tools such as apt-proxy would be advisable. to use, and proxy configuration may be required to allow access through HTTP. See the pbuilderrc.5 manual page for details. Updating the base chroot image pbuilder update will update the chroot image. It will extract the chroot, invoke apt-get update and apt-get dist-upgrade inside the chroot, and then recreate the base tarball. It is possible to switch the distribution which the chroot tarball is targeted at at this point. Specify to change the distribution to sid. Only upgrading is supported. Debian does not generally support downgrading (yet?). For fuller documentation of command-line options, see the pbuilder.8 manual page Building a package using the chroot image To build a package inside the chroot, invoke pbuilder build . pbuilder will extract the chroot image to a temporary working directory, and satisfy the build-dependencies inside the chroot, and build the package. The built packages will be moved to a directory specified with the command-line option. The option can be used to specify which chroot image to use. pbuilder will extract a fresh chroot image created with pbuilder build and updated with pbuilder update, and populate the chroot with build-dependencies by parsing debian/control and invoking apt-get. For fuller documentation of command-line options, see the pbuilder.8 manual page Facilitating Debian Developers' typing, pdebuild pdebuild is a little wrapper script that does the most frequent of all tasks. A Debian Developer may try to do debuild, and build a package, inside a Debian source directory. pdebuild will allow similar control, and allow package to be built inside the chroot, to check that the current source tree will build happily inside the chroot. pdebuild calls dpkg-source to build the source packages, and then invokes pbuilder on the resulting source package. However, unlike debuild, the resulting deb files will be found in the directory. See the pdebuild.1 manual page for more details. There is a slightly different mode of operation available in pdebuild since version 0.97. pdebuild usually runs debian/rules clean outside of the chroot; however, it is possible to change the behavior to run it inside the chroot with the . It will try to bind mount the working directory inside chroot, and run dpkg-buildpackage inside. It has the following characteristics, and is not yet the default mode of operation. Satisfies build-dependency inside the chroot before creating source package. (which is a good point that current pdebuild cannot do). The working directory is modified from inside the chroot. Building with pdebuild does not guarantee that it works with pbuilder. If making the source package fails, the session using the chroot is wasted (chroot creation takes a bit of time, which should be improved with cowdancer). Does not work in the same manner as it used to; for example, does not have any effect. The build inside chroot is ran with the current user outside chroot. Configuration Files It is possible to specify all settings by command-line options. However, for typing convenience, it is possible to use a configuration file. /etc/pbuilderrc and ${HOME}/.pbuilderrc are read in when pbuilder is invoked. The possible options are documented in the pbuilderrc.5 manual page. It is useful to use --configfile option to load up a pre-set configuration file when switching between configuration files for different distributions. Please note ${HOME}/.pbuilderrc supersede system settings. For example, if you are upgrading from sarge to etch, you may need to adjust some part of your local setting just like new /usr/share/pbuilder/pbuilderrc, e.g., "unset DEBOOTSTRAPOPTS", to cope with the use of cdebootstrap. The same care is needed if you edited old system setting in /etc/pbuilderrc. Building packages as non-root inside the chroot pbuilder requires full root privilege when it is satisfying the build-dependencies, but most packages do not need root privilege, or fail to build when they are root. pbuilder can create a user which is only used inside pbuilder and use that user id when building, and use the fakeroot command when root privilege is required. BUILDUSERID configuration option should be set to a value for a user id that does not already exist on the system, so that it is more difficult for packages that are being built with pbuilder to affect the environment outside the chroot. When BUILDUSERNAME configuration option is also set, pbuilder will use the specified user name and fakeroot for building packages, instead of running as root inside chroot. Even when using the fakerooting method, pbuilder will run with root privilege when it is required. For example, when installing packages to the chroot, pbuilder will run under root privilege. To be able to invoke pbuilder without being root, you need to use user-mode-linux, as explained in . Using pbuilder for back-porting pbuilder can be used for back-porting software from the latest Debian distribution to the older stable distribution, by using a chroot that contains an image of the older distribution, and building packages inside the chroot. There are several points to consider, and due to the following reasons, automatic back-porting is usually not possible, and manual interaction is required: The package from the unstable distribution may depend on packages or versions of packages which are only available in unstable. Thus, it may not be possible to satisfy Build-Depends: on stable (without additional backporting work). The stable distribution may have bugs that have been fixed in unstable which need to be worked around. The package in the unstable distribution may have problems building even on unstable. Mass-building packages pbuilder can be automated, because its operations are non-interactive. It is possible to run pbuilder through multiple packages non-interactively. Several such scripts are known to exist. Junichi Uekawa has been running such a script since 2001, and has been filing bugs on packages that fail the test of pbuilder. There were several problems with auto-building: Build-Dependencies need to install non-interactively, but some packages are so broken that they cannot install without interaction (like postgresql). When a library package breaks, or gcc/gcj/g++ breaks, or even bison, a large number of build failures are reported. (gcj-3.0 which had no "javac", bison which got more strict, etc.) Some people were quite hostile against build failure reports. But most of these problems are now getting solved. Only about 10% of Debian now fails to build from source (29 Dec 2002). A script that was used by Junichi Uekawa is now included in the pbuilder distribution, as pbuildd.sh. It is available in /usr/share/doc/pbuilder/examples/pbuildd/ and its configuration is in /etc/pbuilder/pbuildd-config.sh. It should be easy enough to set up for people who are used to pbuilder. It has been running for quite a while, and it should be possible to set the application up on your system also. However, it is a new introduction, and please file bugs to the Debian BTS if you know of possible problems, or improved on the script considerably. To set up pbuildd, there are some points to be aware of. A file ./avoidlist needs to be available with the list of packages to avoid building. It will try building anything, even packages which are not aimed for your architecture. Because you are running random build scripts, it is better to use the fakeroot option of pbuilder, to avoid running the build under root privilege. Because not all builds are guaranteed to finish in a finite time, setting a timeout is probably necessary, or pbuildd may stall with a bad build. Some packages require a lot of disk space, around 2GB seems to be sufficient for the largest packages for the time being. If you find otherwise, please inform the maintainer of this documentation. Auto-backporting scripts There are some people who use pbuilder to automatically back-port a subset of packages to the stable distribution. I would like some information on how people are doing it, I would appreciate any feedback or information on how you are doing, or any examples. Using pbuilder for automated testing of packages pbuilder can be used for automated testing of packages. It has the feature of allowing hooks to be placed, and these hooks can try to install packages inside the chroot, or run them, or whatever else that can be done. Some known tests and ideas: Automatic install-remove-upgrade-remove-install-purge-upgrade-purge testsuite (distributed as an example, B91dpkg-i), or just check that everything installs somewhat (execute_installtest.sh). Automatically running lintian/linda (distributed as an example in /usr/share/doc/pbuilder/examples/B90linda). Automatic debian-test of the package? The debian-test package has been removed from Debian. A pbuilder implementation can be found as debian/pbuilder-test directory, implemented through B92pkg-test script. Using pbuilder for testing builds with alternate compilers Most packages are compiled with gcc or g++ and using the default compiler version, which was gcc 2.95 for Debian GNU/Linux 3.0 (i386). However, Debian 3.0 was distributed with other compilers, under package names such as gcc-3.2 for gcc compiler version 3.2. It was therefore possible to try compiling packages against different compiler versions. pentium-builder provides an infrastructure for using a different compiler for building packages than the default gcc, by providing a wrapper script called gcc which calls the real gcc. To use pentium-builder in pbuilder, it is possible to set up the following in the configuration: EXTRAPACKAGES="pentium-builder gcc-3.2 g++-3.2" export DEBIAN_BUILDARCH=athlon export DEBIAN_BUILDGCCVER=3.2 It will instruct pbuilder to install the pentium-builder package and also the GCC 3.2 compiler packages inside the chroot, and set the environment variables required for pentium-builder to function. Using User-mode-linux with pbuilder It is possible to use user-mode-linux by invoking pbuilder-uml instead of pbuilder. pbuilder-uml doesn't require root privileges, and it uses the copy-on-write (COW) disk access method of User-mode-linux which typically makes it much faster than the traditional pbuilder. User-mode-linux is a somewhat less proven platform than the standard Unix tools which pbuilder relies on (chroot, tar, and gzip) but mature enough to support pbuilder-uml since its version 0.59. And since then, pbuilder-uml has seen a rapid evolution. The configuration of pbuilder-uml goes in three steps: Configuration of user-mode-linux Configuration of rootstrap Configuration of pbuilder-uml Configuring user-mode-linux UML isn't completely trivial to set up. It would probably be useful to acquaint yourself with it a bit before attempting to use rootstrap or pbuilder-uml. For details, read /usr/share/doc/uml-utilities/README.Debian and the user-mode-linux documentation. (It's in a separate package, user-mode-linux-doc.) user-mode-linux requires the user to be in the uml-net group in order to configure the network unless you are using slirp. If you compile your own kernel, you may want to verify that you enable TUN/TAP support, and you might want to consider the SKAS patch. Configuring rootstrap rootstrap is a wrapper around debootstrap. It creates a Debian disk image for use with UML. To configure rootstrap, there are several requirements. Install the rootstrap package. TUN/TAP only: add the user to the uml-net group to allow access to the network adduser dancer uml-net TUN/TAP only: Check that the kernel supports the TUN/TAP interface, or recompile the kernel if necessary. Set up /etc/rootstrap/rootstrap.conf. For example, if the current host is 192.168.1.2, changing following entries to something like this seems to work. transport=tuntap interface=eth0 gateway=192.168.1.1 mirror=http://192.168.1.2:8081/debian host=192.168.1.198 uml=192.168.1.199 netmask=255.255.255.0 Some experimentation with configuration and running rootstrap ~/test.uml to actually test it would be handy. Using slirp requires less configuration. The default configuration comes with a working example. Configuring pbuilder-uml The following needs to happen: Install the pbuilder-uml package. Set up the configuration file /etc/pbuilder/pbuilder-uml.conf in the following manner. It will be different for slirp. MY_ETH0=tuntap,,,192.168.1.198 UML_IP=192.168.1.199 UML_NETMASK=255.255.255.0 UML_NETWORK=192.168.1.0 UML_BROADCAST=255.255.255.255 UML_GATEWAY=192.168.1.1 PBUILDER_UML_IMAGE="/home/dancer/uml-image" Also, it needs to match the rootstrap configuration. Make sure BUILDPLACE is writable by the user. Change BUILDPLACE in the configuration file to a place where the user has access. Run pbuilder-user-mode-linux create --distribution sid to create the image. Try running pbuilder-user-mode-linux build. Considerations for running pbuilder-uml pbuilder-user-mode-linux emulates most of pbuilder, but there are some differences. pbuilder-user-mode-linux does not support all options of pbuilder properly yet. This is a problem, and will be addressed as specific areas are discovered. /tmp is handled differently inside pbuilder-uml. In pbuilder-uml, /tmp is mounted as tmpfs inside UML, so accessing files under /tmp from outside user-mode-linux does not work. It affects options like , and when trying to build packages placed under /tmp. Parallel running of pbuilder-user-mode-linux To run pbuilder-uml in parallel on a system, there are a few things to bear in mind. The create and update methods must not be run when a build is in progress, or the COW file will be invalidated. If you are not using slirp, UML processes which are running in parallel need to have different IP addresses. Just trying to run the pbuilder-uml several times will result in failure to access the network. But something like the following will work: for IP in 102 103 104 105; do xterm -e pbuilder-user-mode-linux build --uml-ip 192.168.0.$IP \ 20030107/whizzytex_1.1.1-1.dsc & done When using slirp, this problem does not exist. Using pbuilder-uml as a wrapper script to start up a virtual machine It is possible to use pbuilder-uml for other uses than just building Debian packages. pbuilder-user-mode-linux login will let a user use a shell inside the user-mode-linux pbuilder base image, and pbuilder-user-mode-linux execute will allow the user to execute a script inside the image. You can use the script to install ssh and add a new user, so that it is possible to access inside the UML through ssh. Note that it is not possible to use a script from /tmp due to the way pbuilder-uml mounts a tmpfs at /tmp. The following example script may be useful in starting a sshd inside uml. #!/bin/bash apt-get install -y ssh xbase-clients xterm echo "enter root password" passwd cp /etc/ssh/sshd_config{,-} sed 's/X11Forwarding.*/X11Forwarding yes/' /etc/ssh/sshd_config- > /etc/ssh/sshd_config /etc/init.d/ssh restart ifconfig echo "Hit enter to finish" read Frequently asked questions Here, known problems and frequently asked questions are documented. This portion was initially available in README.Debian file, but moved here. pbuilder create fails It often happens that pbuilder cannot create the latest chroot. Try upgrading pbuilder and debootstrap. It is currently only possible to create software that handles the past. Future prediction is a feature which may be added later after we have become comfortable with the past. There are people who occasionally backport debootstrap to stable versions; hunt for them. When there are errors with the debootstrap phase, the debootstrap script needs to be fixed. pbuilder does not provide a way to work around debootstrap. Directories that cannot be bind-mounted Because of the way pbuilder works, there are several directories which cannot be bind-mounted when running pbuilder. The directories include /tmp, /var/cache/pbuilder, and system directories such as /etc and /usr. The recommendation is to use directories under the user's home directory for bind-mounts. Logging in to pbuilder to modify the environment It is sometimes necessary to modify the chroot environment. login will remove the contents of the chroot after logout. It is possible to invoke a shell using hook scripts. pbuilder update executes 'E' scripts, and a sample for invoking a shell is provided as C10shell. $ mkdir ~/loginhooks $ cp C10shell ~/loginhooks/E10shell $ sudo pbuilder update --hookdir ~/loginhooks/E10shell It is also possible to add --save-after-exec and/or --save-after-login options to the pbuilder login session to accomplish the goal. It is possible to add the --uml-login-nocow option to pbuilder-user-mode-linux login session as well. Setting BUILDRESULTUID for sudo sessions It is possible to set BUILDRESULTUID=$SUDO_UID in pbuilderrc to set the proper BUILDRESULTUID when using sudo. Notes on usage of $TMPDIR If you are setting $TMPDIR to an unusual value, of other than /tmp, you will find that some errors may occur inside the chroot, such as dpkg-source failing. There are two options, you may install a hook to create that directory, or set export TMPDIR=/tmp in pbuilderrc. Take your pick. An example script is provided as examples/D10tmp with pbuilder. Creating a shortcut for running pbuilder with a specific distribution When working with multiple chroots, it would be nice to work with scripts that reduce the amount of typing. An example script pbuilder-distribution.sh is provided as an example. Invoking the script as pbuilder-woody will invoke pbuilder with a woody chroot. Using special apt sources lists If you have some very specialized requirements on your apt setup inside pbuilder, it is possible to specify that through the option. Try something like: To use the local filesystem instead of http, it is necessary to do bind-mounting. is a command-line option useful for such cases. How to get pbuilder to run apt-get update before trying to satisfy build-dependency You can use hook scripts for this. D scripts are run before satisfying build-dependency. Different bash prompts inside pbuilder login To make distinguishing bash prompts inside pbuilder easier, it is possible to set environment variables such as PS1 inside pbuilderrc With versions of bash more recent than 2.05b-2-15, the value of the debian_chroot variable, if set, is included in the value of PS1 (the Bash prompt) inside the chroot. In prior versions of bash, Versions of bash from and before Debian 3.0 setting PS1 in pbuilderrc worked. example of debian_chroot export debian_chroot="pbuild$$" example of PS1 export PS1="pbuild chroot 32165 # " Using /var/cache/apt/archives for the package cache For the help of low-bandwidth systems, it is possible to use /var/cache/apt/archives as the package cache. Just specify it instead of the default /var/cache/pbuilder/aptcache. It is however not possible to do so currently with the user-mode-linux version of pbuilder, because /var/cache/apt/archives is usually only writable by root. Use of dedicated tools such as apt-proxy is recommended, since caching of packages would benefit the system outside the scope of pbuilder. pbuilder backported to stable Debian releases Currently stable backport to sarge is not known to be available. It should hopefully soon be available. Warning about LOGNAME not being defined You might see a lot of warning messages when running pbuilder. dpkg-genchanges: warning: no utmp entry available and LOGNAME not defined; using uid of process (1234) It is currently safe to ignore this warning message. Please report back if you find any problem with having LOGNAME unset. Setting LOGNAME caused a few problems when invoking chroot. Cannot Build-conflict against an essential package pbuilder does not currently allow Build-Conflicts against essential packages. It should be obvious that essential packages should not be removed from a working Debian system, and a source package should not try to force removal of such packages on people building the package. Avoiding the "ln: Invalid cross-device link" message By default, pbuilder uses hard links to manage the pbuilder package cache. It is not possible to make hard links across different devices; and thus this error will occur, depending on your set up. If this happens, set APTCACHEHARDLINK=no in your pbuilderrc file. Using fakechroot It is possible to use fakechroot instead of being root to run pbuilder; however, several things make this impractical. fakechroot overrides library loads and tries to override default libc functions when providing the functionality of virtual chroot. However, some binaries do no use libc to function, or override the overriding provided by fakechroot. One example is ldd. Inside fakechroot, ldd will check the library dependency outside of the chroot, which is not the expected behavior. To work around the problem, fakechroot provides a patch for debootstrap. Use that, so that ldd and ldconfig are overridden. Make sure you have set your path correctly, as described in /usr/share/doc/fakechroot/README.Debian Using debconf inside pbuilder sessions To use debconf inside pbuilder, setting DEBIAN_FRONTEND to readline in pbuilderrc should work. Setting it to dialog should also work, but make sure whiptail or dialog is installed inside the chroot. nodev mount options hinder pbuilder activity If you see messages such as this when building a chroot, you are mounting the filesystem with the nodev option. /var/lib/dpkg/info/base-files.postinst: /dev/null: Permission denied You will also have problems if you mount the filesystem with the noexec option, or nosuid. Make sure you do not have these flags set when mounting the filesystem for /var/cache/pbuilder or $BUILDPLACE. This is not a problem when using User-mode-linux. See 316135 for example. pbuilder is slow pbuilder is often slow. The slowest part of pbuilder is extracting the tar.gz every time pbuilder is invoked. That can be avoided by using pbuilder-user-mode-linux. pbuilder-user-mode-linux uses COW filesystem, and thus does not need to clean up and recreate the root filesystem. pbuilder-user-mode-linux is slower in executing the actual build system, due to the usual user-mode-linux overhead for system calls. It is more friendly to the hard drive. pbuilder with cowdancer is under development, to allow pbuilder to start up faster; when it is ready, it should be able to replace the current setup. Creating a chroot reminder You may want a sign that you are inside a chroot, when working with chroot. Check out the examples/F90chrootmemo hook script. It will create a file called /CHROOT inside your chroot. Why is there a source.changes file in ../? When running pdebuild, pbuilder will run dpkg-buildpackage to create a Debian source package to pass it on to pbuilder. File named XXXX_YYY_source.changes is what remains from that process. It is harmless unless you try to upload it to the Debian archive. This behavior is different when running through --use-pdebuild-internal amd64 and i386-mode amd64 architectures are capable of running binaries in i386 mode. It is possible to use pbuilder to run packages, using linux32 and debootstrap option. Specifically, a command-line option like the following will work. pbuilder create --distribution sid --debootstrapopts --arch --debootstrapopts i386 --basetgz /var/cache/pbuilder/base-i386.tgz --mirror http://ftp.jp.debian.org/debian linux32 pbuilder build --basetgz /var/cache/pbuilder/base-i386.tgz How to use ccache To use ccache with pbuilder, use the following for configuration. Note that the directory used for CCACHE_DIR needs to exist, and be writable by user within chroot. The default user within chroot is uid=1234. export CCACHE_DIR="/var/cache/pbuilder/ccache" export PATH="/usr/lib/ccache:${PATH}" EXTRAPACKAGES=ccache BINDMOUNTS="${CCACHE_DIR}" This entry created thanks to a blog posting. Troubleshooting and development Reporting bugs To report bugs, it would be important to have a log of what's going wrong. Most of the time, adding a --debug option and re-running the session should do the trick. Please send the log of such session along with your problem to ease the debugging process. Mailing list There is a mailing list for pbuilder on alioth (pbuilder-maint@lists.alioth.debian.org). You can subscribe through the alioth web interface. http://alioth.debian.org/mail/?group_id=30778. IRC Channel For coordination and communication, IRC channel #pbuilder on irc.oftc.net is used. Please log your intent there when you are going to start doing some changes and commiting some change. Development This section is a start of what I want to do later. pbuilder is now co-maintained at alioth. There is an alioth project page at http://alioth.debian.org/projects/pbuilder. CVS Repository is available through anonymous CVS cvs -d:pserver:anonymous@cvs.alioth.debian.org:/cvsroot/pbuilder login cvs -z3 -d:pserver:anonymous@cvs.alioth.debian.org:/cvsroot/pbuilder co pbuilder Testsuites are available in tests/ directory, and changes are expected not to break the testsuites. ./run-test.sh is a basic testsuite, which puts a summary in run-test.log, and run-test-cdebootstrap.log. ./run-test-regression.sh is a regression testsuite, which puts the result in run-test-regression.log When making changes, a description of the change targeted at developers should be documented in ChangeLog, and committed. A brief summary of the change targeting end users should be documented in debian/changelog, so that users can see them. Note that the description of debian/changelog is targeted at users, and ChangeLog is targeted at developers. For CVS commit messages, a cut-n-paste of ChangeLog diff should be enough. A TODO file is available in debian/TODO. It's mostly not well-maintained, but hopefully it will be more up-to-date when people start using it. emacs todoo-mode is used in editing the file. When releasing a new version of pbuilder, the version is tagged with the cvs tag releaseX_XXX. Other uses of pbuilder Using pbuilder for small experiments There are cases when some small experimenting is required, and you do not want to damage the main system, like when installing experimental library packages, or compiling with experimental compilers. For such cases, the pbuilder login command is available. pbuilder login is a debugging feature for pbuilder itself, but it also allows users to have a temporary chroot. Note that the chroot is cleaned after logging out of the shell, and mounting file systems inside it is considered harmful. Running little programs inside the chroot To facilitate using pbuilder for other uses, pbuilder execute is available. pbuilder execute will take a script specified in the command-line argument, and invoke the script inside the chroot. The script can be useful for sequences of operations such as installing ssh and adding a new user inside the chroot. Experimental or wish list features of pbuilder There are some advanced features, above that of the basic feature of pbuilder, for some specific purposes. Using LVM LVM2 has a useful snapshot function that features Copy-on-write images. That could be used for pbuilder just as it can be used for the user-mode-linux pbuilder port. It may prove to be faster, but it is not implemented yet, and so no measurement has been made, yet. User-mode-linux cow support has been preferred for pbuilder-uml, but the idea of using LVM is interesting. Using cowdancer cowdancer allows copy-on-write semantics on filesystem using hardlinks and hardlink-breaking-on-write tricks. pbuilder using cowdancer seems to be much faster and it is one ideal point for improvement. Using pbuilder without tar.gz The option of pbuilder will allow usage of pbuilder in a different way from conventional usage. It will try to use an existing chroot, and will not try to clean up after working on it. It is an operation mode more like sbuild. It should be possible to create chroot images for dchroot with the following commands: # pbuilder create --distribution potato --no-targz --basetgz /chroot/potato # pbuilder create --distribution woody --no-targz --basetgz /chroot/woody # pbuilder create --distribution sid --no-targz --basetgz /chroot/sid Reference materials Directory structure outside the chroot Directory Structure outside the chroot Directory Meaning /etc/pbuilderrc configuration file /usr/share/pbuilder/pbuilderrc Default configuration /var/cache/pbuilder/base.tgz Default location pbuilder uses for base.tgz, the tarball containing a basic Debian installation with only the build-essential packages. /var/cache/pbuilder/build/PID/ Default location pbuilder uses for chroot /var/cache/pbuilder/aptcache Default location pbuilder will use as apt cache, to store deb packages required during pbuilder build. /var/cache/pbuilder/result Default location pbuilder puts the deb files and other files created after build /var/cache/pbuilder/pbuilder-umlresult Default location pbuilder-user-mode-linux puts the deb files and other files created after build /var/cache/pbuilder/pbuilder-mnt Default location pbuilder-user-mode-linux uses for mounting the COW filesystem, for chrooting. /tmp pbuilder-user-mode-linux will mount tmpfs for work. ${HOME}/tmp/PID.cow pbuilder-user-mode-linux use this directory for location of COW filesystem. ${HOME}/uml-image pbuilder-user-mode-linux use this directory for UML full disk image.
Directory structure inside the chroot Directory Structure inside the chroot Directory Meaning /etc/mtab symlink to /proc/mounts. /tmp/buildd Default place used in pbuilder to place the Debian package to be processed. /tmp/buildd/packagename-version/ will be the root directory of the package being processed. HOME environment variable is set to this value inside chroot by pbuilder-buildpackage /run The script passwd as an argument to pbuilder execute is passed on. /tmp/hooks The location of hooks. /var/cache/apt/archives pbuilder copies the content of this directory to and from the aptcache directory of outside chroot. /tmp/XXXX pbuilder-user-mode-linux uses a script in /tmp to bootstrap into user-mode-linux
Minor details Documentation history This document was started on 28 Dec 2002 by Junichi Uekawa, trying to document what is known about pbuilder. This documentation is available from the pbuilder source tarball, and from the CVS repository of pbuilder (web-based access is possible). A copy of this documentation can be found on the Alioth project page for pbuilder. The homepage for pbuilder is http://www.netfort.gr.jp/~dancer/software/pbuilder.html The project has moved its hosting to alioth project since 4 Sep 2005. It is available http://pbuilder.alioth.debian.org/ Documentation is written using DocBook XML, with emacs PSGML mode, and using wysidocbookxml for live previewing. Possibly inaccurate Background History of pbuilder The following is a most possibly inaccurate account of how pbuilder came to happen, and other attempts to make something like pbuilder happen. This part of the document was originally in the AUTHORS file, to give credit to those who existed before pbuilder. The Time Before pbuilder There was once dbuild, which was a shell script to build Debian packages from source. Lars Wirzenius wrote that script, and it was good, short, and simple (probably). There was nothing like build-depends then (I think), and it was simple. It could have been improved, I could only find references and no actual source. debbuild was probably written by James Troup. I don't know it because I have never seen the actual code, I could only find some references to it on the net, and mailing list logs. sbuild is a perl script to build Debian packages from source. It parses Build-Depends, and performs other miscellaneous checks, and has a lot of hacks to actually get things building, including a table of what package to use when virtual packages are specified (does it do that still?). It supports the use of a local database for packages which do not have build-dependencies. It was written by Ronan Hodek, and I think it was patched and fixed and extended by several people. It is part of wanna-build, and used extensively in the Debian buildd system. I think it was maintained mostly by Ryan Murray. Birth of pbuilder wanna-build (sbuild) was (at the time of year 2001) quite difficult to set up, and it was never a Debian package. dbuild was something that predated Build-Depends. Building packages from source using Build-Depends information within a chroot sounded trivial; and pbuilder was born. It was initially a shell script with only a few lines, which called debootstrap and chroot and dpkg-buildpackage in the same run, but soon, it was decided that that's too slow. Yes, and it took almost an year to get things somewhat right, and in the middle of the process, Debian 3.0 was released. Yay. Debian 3.0 wasn't completely buildable with pbuilder, but the amount of packages which are not buildable is steadily decreasing. (I hope) And the second year of its life Someone wanted pbuilder to not run as root, and as User-mode-linux has become more useful as time passed, I've started experimenting with pbuilder-uml. pbuilder-uml has not been able to run as often as it should, and bootstrapping user-mode-linux environment has been pretty hard. Fifth year of pbuilder pbuilder is now widely adopted as a 'almost standard' tool for testing packages, and building packages in a pristine environment. There are other similar tools that do similar tasks, but they do not share the exact same goal. To commemorate this fact, pbuilder is now co-maintained with several people.