0

I'm attempting to build a package using pbuilder, and would prefer to not install build dependencies on my host computer so I can keep it clean. Whenever It try to build a package, I get the following output because I don't have the dependencies installed.

$ pbuilder-dist saucy i386 build nautilus_3.8.2-0ubuntu1.dsc
I: Logging to /home/notgary/pbuilder/saucy-i386_result/last_operation.log
I: using fakeroot in build.
I: Current time: Tue Jul 23 20:52:19 BST 2013
I: pbuilder-time-stamp: 1374609139
I: Building the build Environment
I: extracting base tarball [/home/notgary/pbuilder/saucy-i386-base.tgz]
I: creating local configuration
I: copying local configuration
W: --override-config is not set; not updating apt.conf Read the manpage for details.
I: mounting /proc filesystem
I: mounting /dev/pts filesystem
I: Mounting /var/cache/pbuilder/ccache
I: policy-rc.d already exists
I: Obtaining the cached apt archive contents
I: Setting up ccache
I: Installing the build-deps
Traceback (most recent call last):
  File "/usr/bin/gdebi", line 80, in <module>
    debi = GDebiCli(options)
  File "/usr/share/gdebi/GDebi/GDebiCli.py", line 53, in __init__
    "--print-architecture"], stdout=PIPE).communicate()[0]
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
E: pbuilder-satisfydepends failed.
I: Copying back the cached apt archive contents
I: unmounting /var/cache/pbuilder/ccache filesystem
I: unmounting dev/pts filesystem
I: unmounting proc filesystem
I: cleaning the build env 
I: removing directory /var/cache/pbuilder/build//9113 and its subdirectories

How do I update pbuilder so it will resolve the dependencies automatically within it's own environment?

  • I think I see the issue. It appears you are using the gdebi resolver. This resolver uses gdebi *outside* the chroot to exec dpkg *inside* the chroot. If you don't have the libs to exec the i386 dpkg (especially if you don't even have libc6:i386) you will get File Not Found when trying to exec it. Try switching to the aptitude resolver which works *inside* the chroot. It is working fine on my system either way though, so alternatively you could make sure you have enough i386 libs to exec dpkg. – Jason Conti Jul 23 '13 at 22:35
  • @JasonConti, that was exactly the problem. Thanks a lot :) If you write it up as an answer, I'll accept and give you the credit. –  Jul 24 '13 at 12:05

2 Answers2

2

Looking at the source for /usr/share/gdebi/GDebi/GDebiCli.py we see that the pbuilder-dist script is dying when gdebi tries to exec dpkg. As it happens, we can get the strange OSError: [Errno 2] No such file or directory when trying to exec a 32-bit executable on a 64-bit system without libc6:i386 installed.

Investigating further into /usr/lib/pbuilder/pbuilder-satisfydepends-gdebi, we find that gdebi satisfies the dependencies from outside the chroot by executing dpkg inside the chroot,

INSTALL=$(/usr/bin/gdebi --quiet --root $CHROOT --apt-line $NO_RECOMMENDS $DEBIAN_CONTROL)
$CHROOTEXEC /usr/bin/apt-get install -y "${APTGETOPT[@]}" $INSTALL

So without the multiarch libraries necessary to execute a 32-bit dpkg on a 64-bit host, this is going to fail. Another option is to use the aptitude resolver, which works inside the chroot, so shouldn't have problems either way.

Jason Conti
  • 2,361
  • 1
  • 18
  • 15
0

I went though the same error in a recent pbuilder build and added the following snippet to the ~/.pbuilderrc file so it automatically installs and uses the aptitude resolver when the host and guest architecture differ.

if [ "${ARCH}" = "$(dpkg --print-architecture)" ]; then
    #gdebi resolution, requires gdebi-core
    if command -v "gdebi" >/dev/null 2>&1; then
        PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-gdebi" || true
        rm -rf "${HOOKDIR}/D01install_aptitude_resolver"
    else
        printf "%s\\n" '#!/bin/sh' > "${HOOKDIR}/D01install_aptitude_resolver"
        printf "%s\\n" 'apt-get install -y --no-install-recommends aptitude' >> "${HOOKDIR}/D01install_aptitude_resolver"
        chmod +x "${HOOKDIR}/D01install_aptitude_resolver"
    fi
else
    printf "%s\\n" '#!/bin/sh' > "${HOOKDIR}/D01install_aptitude_resolver"
    printf "%s\\n" 'apt-get install -y --no-install-recommends aptitude' >> "${HOOKDIR}/D01install_aptitude_resolver"
    chmod +x "${HOOKDIR}/D01install_aptitude_resolver"
fi
Javier López
  • 1,436
  • 2
  • 19
  • 29