5

I'm trying to create a build environment for Lucid, and calling cowbuilder --create --distribution lucid fails with the messages below:

Get:1 http://us-east-1.ec2.archive.ubuntu.com lucid Release.gpg [189B]
Hit http://us-east-1.ec2.archive.ubuntu.com lucid Release
Hit http://us-east-1.ec2.archive.ubuntu.com lucid/main Packages
Fetched 189B in 0s (2376B/s)
Reading package lists...
I: Obtaining the cached apt archive contents
Reading package lists...
Building dependency tree...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
apt is already the newest version.
Package cowdancer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package cowdancer has no installation candidate
I: unmounting dev/pts filesystem
I: unmounting proc filesystem
pbuilder create failed
  forking: rm -rf /opt/cowbuilder 
Daenyth
  • 768

2 Answers2

8

Try adding the following to your ~/.pbuilderrc:

COMPONENTS="main universe multiverse restricted"

or, as SunSparc suggested, enter the command as follows:

COMPONENTS="main universe multiverse restricted" cowbuilder --create --distribution lucid

cowbuilder is in the universe component for lucid. I don't see the create operation trying to access universe in the output you included in your question.

The file ~/.pbuilderrc can be set up to set many pbuilder options that are used for cowbuilder as well.

user.dz
  • 49,176
John S Gruber
  • 13,436
8

The critical error message (below) baffled me for a little bit until I walked through exactly what cowbuilder (and the underlying pbuilder tool) are trying to do.

Package cowdancer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

It is a confusing message because it only appears when executing cowbuilder --create. In other words, when I invoke this command, it complains about missing a package I already installed. Weird.

Here is the missing link: cowbuilder--and by extension, pbuilder--are trying to create a clean, minimal, chroot environment, inside which there are no extra packages installed. Even though cowbuilder is already installed outside the chroot, it appears to want to be installed inside the chroot as well. Inside and outside the chroot are totally different worlds. Outside the chroot (the regular environment), your /etc/apt/sources.list file is king. But inside, it is a different set of rules. The default pbuilder environment only includes the most critical and minimal repositories necessary for a base/clean install.

The accepted answer talks about adding the "COMPONENTS" argument and specifying some additional repositories. It did not work for me. I tried adding the COMPONENTS value to the /etc/pbuilderrc file, my local .pbuilderrc file, and also doing that on the command line as an environment variable. No luck. I did find a few references that mentioned how the COMPONENTS argument is not supported for cowbuilder.

Finally, I stumbled upon a blog post that talked about adding a variable named OTHERMIRROR to the /etc/pbuilderrc file. For me, I simply added the following:

OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu saucy main restricted universe multiverse | deb http://archive.ubuntu.com/ubuntu saucy-backports main restricted universe multiverse | deb http://archive.ubuntu.com/ubuntu saucy-security main restricted universe multiverse | deb http://archive.ubuntu.com/ubuntu saucy-updates main restricted universe multiverse"

[Note that you can update/change saucy to whatever you would like (e.g. trusty, raring, precise, or even wheezy and sid provided you have the appropriate debian mirrors, etc.).

Then, I simply ran the following from the command line and everything was created successfully and I was able to proceed:

sudo cowbuilder --create  # defaults to using current distribution

Obviously you can change distributions using the "--distribution" command line argument. It takes a few minutes to establish the initial environment, but once it is created, you can easily update the packages, etc. using cowbuilder.

The cowbuilder page on the Debian website talks about creating an Ubuntu-specific cowbuilder. It mentions that cowdancer has been moved to the universe repository. They reference running the following command to build a cowbuilder environment on Ubuntu:

DIST=trusty sudo cowbuilder --create --distribution trusty --components "main universe"

The --components="main universe" flag is the critical piece to ensure the creation process has access to all the necessary repositories.