Hi,
I've just wasted some time to find out why pbuilder had stopped working,
and fails with this strange message:
I: policy-rc.d already exists
I: Installing the build-deps
I: user script /var/cache/pbuilder/build/cow.10311/tmp/hooks/D80no-man-db-rebuild starting
I: Preseed man-db/auto-update to false
I: user script /var/cache/pbuilder/build/cow.10311/tmp/hooks/D80no-man-db-rebuild finished
-> Attempting to satisfy build-dependencies
-> Creating pbuilder-satisfydepends-dummy package
Package: pbuilder-satisfydepends-dummy
Version: 0.invalid.0
Architecture: i386
Maintainer: Debian Pbuilder Team <pbuilder-maint@lists.alioth.debian.org>
Description: Dummy package to satisfy dependencies with aptitude - created by pbuilder
This package was created automatically by pbuilder to satisfy the
build-dependencies of the package being currently built.
Depends: debhelper (>= 9), dh-apache2, po4a (>= 0.22)
dpkg-deb: building package `pbuilder-satisfydepends-dummy' in `/tmp/satisfydepends-aptitude/pbuilder-satisfydepends-dummy.deb'.
dpkg-deb: error: failed to make temporary file (control member): No such file or directory
E: pbuilder-satisfydepends failed.
I've noticed that `cowbuilder --update' also has stopped working:
pbuilder update failed
E: could not update with cowdancer, try --no-cowdancer-update option
forking: rm -rf /var/cache/pbuilder/build//cow.11010
And no, --no-cowdancer-update didn't fix anything.
Anyway, it turned out that I've recently installed libpam-tmpdir, which caused
TMPDIR to be set to /tmp/user/0 inside the chroot. But nothing in the
pbuilder log indicates this fact. Moreover the final error message:
dpkg-deb: building package `pbuilder-satisfydepends-dummy' in `/tmp/satisfydepends-aptitude/pbuilder-satisfydepends-dummy.deb'.
suggests that /tmp is used for storing temporary files!
I've just found the fact is documented in pbuilder's documentation:
6. Notes on usage of $TMPDIR
If you are setting $TMPDIR to an unusual value, of other than /tmp, you will find that some errors may occur
inside the chroot, such as dpkg-source failing.
There are two options, you may install a hook to create that directory, or set
export TMPDIR=/tmp
in pbuilderrc. Take your pick.
An example script is provided as examples/D10tmp with pbuilder.
But in my opinion documenting it is not enough! If something worked perfectly fine for a few years, and than suddenly
has stopped working, I guess, nobody will look into documentation.
To fix this bug, please do one of the following things:
- check if $TMPDIR exists in chroot at very first step of pbuilder's
processing, and fail with a clear message (possibly referring to
the above documentation) in case it doesn't
OR:
- add the `export TMPDIR=/tmp' to /etc/pbuilderrc installed by default by the package
OR:
- always internally create the $TMPDIR if it does not exists
(note: this is not the same as installing the D10tmp hook by default,
as this hook does not work for `cowbuilder --update')
OR:
- use value of $TMPDIR internally by pbuilder itself, so the processing
would most probably fail at:
"I user script /var/cache/pbuilder/build/cow.10311/tmp/user/0/hooks/D80no-man-db-rebuild"
^^^^^^^^^^^^
(but still such a failure would require some user's investigation)
Regards,
robert
Hi,
I'm obviously beaten by bug #725434 when trying to use gbp on a stable
box with libpam-tmpdir. I followed the workaround and added a hook
script:
$ cat .pbuilder/D10tmp
#!/bin/bash
# Work around #725434
# example file to be used with --hookdir
#
#create $TMP and $TMPDIR
echo "*******************************************************"
echo "* Use workaroud for bug #725434 and create *"
echo "* TMP=$TMP *"
echo "* TMPDIR=$TMPDIR *"
echo "*******************************************************"
[ -n "$TMP" -a ! -d "$TMP" ] && mkdir -p "$TMP" || true
[ -n "$TMPDIR" -a ! -d "$TMPDIR" ] && mkdir -p "$TMPDIR" || true
which left the following log entry
I: user script /var/cache/pbuilder/build/cow.101629/tmp/hooks/D10tmp starting
*******************************************************
* Use workaroud for bug #725434 and create *
* TMP=/tmp/user/0 *
* TMPDIR=/tmp/user/0 *
*******************************************************
I: user script /var/cache/pbuilder/build/cow.101629/tmp/hooks/D10tmp finished
and the problem described in the bug report is not occuring any more.
However, I get a very similar and most probably related problem way
later in the package build process:
dh_md5sums -O--buildsystem=pybuild
dh_builddeb -O--buildsystem=pybuild
dpkg-deb: building package `python-pyfaidx' in `../python-pyfaidx_0.4.2-0~bpo8+1_all.deb'.
dpkg-deb: error: failed to make temporary file (control member): Permission denied
dh_builddeb: dpkg-deb --build debian/python-pyfaidx .. returned exit code 2
dpkg-deb: building package `python3-pyfaidx' in `../python3-pyfaidx_0.4.2-0~bpo8+1_all.deb'.
dpkg-deb: error: failed to make temporary file (control member): Permission denied
dh_builddeb: dpkg-deb --build debian/python3-pyfaidx .. returned exit code 2
dpkg-deb: building package `python-pyfaidx-examples' in `../python-pyfaidx-examples_0.4.2-0~bpo8+1_all.deb'.
dpkg-deb: error: failed to make temporary file (control member): Permission denied
dh_builddeb: dpkg-deb --build debian/python-pyfaidx-examples .. returned exit code 2
debian/rules:10: recipe for target 'binary' failed
make: *** [binary] Error 1
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
E: Failed autobuilding of package
The interesting thing here is that while TMP=/tmp/user/0 this
dir is empty and the packaging is done in /tmp/buildd. If I do
# cd /tmp/buildd/python-pyfaidx-0.4.2
# dh_builddeb -O--buildsystem=pybuild
dpkg-deb: building package `python-pyfaidx' in `../python-pyfaidx_0.4.2-0~bpo8+1_all.deb'.
dpkg-deb: building package `python3-pyfaidx' in `../python3-pyfaidx_0.4.2-0~bpo8+1_all.deb'.
dpkg-deb: building package `python-pyfaidx-examples' in `../python-pyfaidx-examples_0.4.2-0~bpo8+1_all.deb'.
this obviously works fine. (BTW, the package in question is in
git://anonscm.debian.org/debian-med/python-pyfaidx.git but this problem
exists for any package.)
I can very easily build the package when simply using the export-dir of
gbp cd to the build directory and simply use pdebuild. So the problem
is definitely created by gbp.
Any clue?
Kind regards
Andreas.
umh, something tells me this is not enough: hooks are run as root, while the build is not, so the build user would not be able to write there. Currently the build username or user ID is not exported to the hooks, so the better you can do is to chmod 777 TMPDIR and TMP (programs using /tmp should be able to use that securely anyway...) the directory where the package is kept and the build is done is hardcoded to /tmp/buildd/ till 0.216, where it was made configurable and moved to /build/. JOOI, can you try with pbuilder from backports and see whether with the changed build place something different happen? yes, because you're building as root, which can write anywhere he likes :) s/gbp/pbuilder/
Hi Mattia,
I can confirm that this works.
I forget to say that I'm just doing this:
$ apt-cache policy pbuilder
pbuilder:
Installed: 0.215+nmu4~bpo8+1
Candidate: 0.215+nmu4~bpo8+1
Version table:
*** 0.215+nmu4~bpo8+1 0
501 http://httpredir.debian.org/debian/ jessie-backports/main amd64 Packages
100 /var/lib/dpkg/status
0.215+nmu3 0
500 http://httpredir.debian.org/debian/ jessie/main amd64 Packages
If you think so... At least it is pbuilder only if called by gbp.
Kind regards
Andreas.
ok, thanks. well, please `apt update` :) I uploaed 0.219~bpo8+1 2 days ago ^^
* Mattia Rizzolo <mattia@mapreri.org>, 2015-10-20, 16:18: POSIX says that one should use $TMPDIR as a directory for temporary files. I you know software that uses $TMP, $TEMP, $TEMPDIR or something else for this purpose, please file bugs. :) ITYM 1777. Without sticky bit set, other users could remove your temporary files or directories and replace them with their own, which would not end well.
This also affects sbuild. To avoid the issue, I've added the following to
my ~/.sbuildrc:
$external_commands = {
"chroot-setup-commands" => [
'runuser -u sbuild -- mkdir -v -m 1777 -p "/tmp/user/1000"',
],
};
Regards, David