This article is intended for those who are interested in building deb packages for Ubuntu using chroots, and also pbuilder or sbuild users. If these words are not familiar for you probably this article is not the one you want to read. If you want to start reading about deb packaging, go to the Packaging Guide.

cowdancer is a package in Ubuntu that contains cowbuilder, it is a wrapper for pbuilder to build packages without the unnecessary compress/uncompress step, in fact using COW (Copy-On-write). cowdancer requires that you've pbuilder installed, if you don't please read the pbuilder HOWTO first for guidance. Please note that there is no need to create a chroot using pbuilder, cowbuilder you need /etc/pbuilderrc only. If you have one or more chroots in place, it's fine.


Install cowdancer package, running for example:

sudo aptitude install cowdancer

Setting up your first COW chroot

  • Make sure your /etc/pbuilderrc is ok. Pay special attention for directories, mirror and distribution related variables. components is a special one, you will need to uncomment it and keep at least main and universe in.

Let cowbuilder debootstrap the chroot for you running:

sudo cowbuilder --create --distribution <DISTRIBUTION> --basepath <RESULTPATH>
  • You need to run as root (using sudo above) because cowbuilder uses debootstrap, fakeroot doesn't work too since it will run chroot command after debootstrap.
  • If it works well you will end with a minimal installation of DISTRIBUTION into RESULTPATH and note that it's not compressed as in pbuilder.

Hint: Use something unique for each distribution in your RESULTPATH, for example hardy-cow. It will be useful if you need to build for multiple releases in the same machine (a must for backporters).

Building a package on top of you first COW chroot

  • If you have a source package, just run:

sudo cowbuilder --build <DSCFILE> --basepath <RESULTPATH>
  • If you have nothing around to build, downloading hello running `apt-get source hello' and run:

sudo cowbuilder --build hello*dsc --basepath <RESULTPATH>

The source and binary(ies) will be in the directory configured into /etc/pbuilderrc, that's why cowbuilder is just really a wrapper for pbuilder that keep out tarballs out of your way using hardlinks.

CowdancerHowto (last edited 2008-08-06 16:36:04 by localhost)