Installing and creating Autopackages in a chroot

This may be a little off-topic for this weblog, but since I spend quite some time researching this, I’ve decided to write about it anyway. When preparing a new release for Vuurmuur, I wanted to create an Autopackage as well. For those that are unaware of it Autopackage is a distribution independent installer for Linux binaries. Because creating packages for every distro including flavor and versions is way out of my reach, a general installer can save the day.

Because I had some issues with Autopackage 1.2.2 in Ubuntu Edgy, I tried getting a Debian Etch install in a chroot to build the package. However, while installing the autopackage-devel package I got some weird errors:

$ package install /data/Autopackage Development Environment 1.2.3.package

# Preparing package: Autopackage Development Environment
# Checking for required C library versions … passed
# Checking for autopackage runtime prefix … passed
Removing currently installed version of ‘Autopackage Development Environment’.
This may take a moment, please wait … done
# Installing package: Autopackage Development Environment (package 1 of 1)
# Preparing executables…
# Installing executables…
# Copying files to /usr/include
/usr/share/autopackage/apkg-script-utils: line 803: cd: include: No such file or directory
/usr/share/autopackage/apkg-script-utils: line 861: cd: include: No such file or directory
cp: cannot stat `*’: No such file or directory
# Copying files to /usr/libexec
/usr/share/autopackage/apkg-script-utils: line 803: cd: libexec: No such file or directory
/usr/share/autopackage/apkg-script-utils: line 861: cd: libexec: No such file or directory
cp: cannot stat `*’: No such file or directory
# Copying files to /usr/binreloc
/usr/share/autopackage/apkg-script-utils: line 803: cd: binreloc: No such file or directory
/usr/share/autopackage/apkg-script-utils: line 861: cd: binreloc: No such file or directory
cp: cannot stat `*’: No such file or directory
# Installing data files…
/usr/share/autopackage/apkg-script-utils: line 803: cd: share: No such file or directory
# Copying files to /usr/local
FAIL: Package Autopackage Development Environment could not be installed.

After a lot of researching and debugging I finally found out that I forgot to mount the /proc filesystem in the chroot. The /dev/stdin, /dev/stdout and /dev/stderr files should link to /proc/self/fd/0, 1 and 2 respectively. After fixing this installing the package worked fine. Next I tried creating packages and this worked as well. I probably won’t be using the chroot though, because the Autopackage team released 1.2.3 and this release fixed my issues with Ubuntu.