Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Often I need to create packages which another package depend on (i.e. build dependencies). Instead of having all those packages first being build in my ppa (which can sometimes take some time), I would like to use the results directory from pbuilder as a source for the pbuilder itself.

How can I do this? Can I do this via a hook?

share|improve this question
up vote 5 down vote accepted

You can stick them in a simple repo created with dpkg-scanpackages and make that available via apache. Then update pbuilder's apt config to use your repo.

share|improve this answer
See also With Local Packages. Not sure if their OTHERMIRROR example, against local file system works right off. I took the easy route of using a localhost path for my extra package repo. – andol Sep 4 '10 at 22:01

This can be done a few ways. As mentioned by adol, the Ubuntu wiki has a nice example of how to do this by creating a local repository with mini-dinstall and adding that to your pbuilder config. Dennis' answer about using dpkg-scanpackages works as well.

I've been doing this recently with apt-ftparchive. I like this approach since I find it very light weight. Here's annotated example of what I do:

# From my ~/.pbuilderrc file

# Location of the dir where you keep pbuilder hook scripts.

# Path to your local repo to be used as a mirror written as apt source line.
OTHERMIRROR="deb file:///home/andrew/pbuilder/local_repo ./"

# Path to your local repo. This tells pbuilder to mount this directory so it is available in the chroot.

# As we need to have the apt-ftparchive command, we need to insure this package is installed.

You also need a pbuilder hook:

# From my ~/.pbuilder-hooks/D5update-local-repo file

# Path to the local repo.

# Generate a Packages file.
(cd $LOCAL_REPO ; apt-ftparchive packages . > Packages)

# Update to include any new packages in the local repo.
apt-get update

Now all you have to do is drop the packages into your local repo and they will be available to pbuilder. If you are trying to chain build a string of dependencies you can make you pbuilder results directory as your local repo directory.

You can probably imagine other variations on this. For instance, you could use dput with a post_upload_command to generate the Packages file instead of using the hook.

This Debian wiki page could also be helpful.

share|improve this answer
The hook file needs to be called D05... (two digit number) and needs to be executable. Also (at least when using pbuilder-dist) after adding the apt-utils extra package you have to call pbuilder-dist <dist> update --override-config once. And also also again with pbuilder-dist you need to set the OTHERMIRROR as an environment variable as it overrides the config-file setting. – BubuIIC Jun 13 '14 at 12:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.