Package: sbuild
Version: 0.81.2
Severity: normal

When trying to build amp and spherepack on my Debian testing machine,
I get a build failure, but I don't if I use pbuilder.  Johannes
Schauer Marin Rodrigues has kindly identified the source of the
problem, in
https://lists.debian.org/debian-devel/2021/02/msg00167.html (my
question) and
https://lists.debian.org/debian-devel/2021/02/msg00168.html
(Josch's analysis).

It turns out that pbuilder sets up /dev/shm in the chroot environment
to be a tmpfs but sbuild does not (or at least gets the permissions
wrong): here's what I get when I test this:

On a regular build (using >> to indicate commands in debian/rules):
>> mount | grep shm
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
>> ls -ld /dev/shm
drwxrwxrwt 2 root root 80 Feb 11 07:06 /dev/shm

On an sbuild though:
>> mount | grep shm
make: [debian/rules:7: clean] Error 1 (ignored)
>> ls -ld /dev/shm
drwxr-xr-x 2 root root 40 Feb 10 10:06 /dev/shm

So /dev/shm is a real directory rather than a tmpfs, and is only
writable by root.

This can be fixed using Josch's workaround
(--chroot-setup-commands="chmod 777 /dev/shm") but it would be better
to have a more general solution.  There are two obvious fixes for
this:

(1) Running "mount -t tmpfs tmpfs /dev/shm" or
(2) Running "chmod 1777 /dev/shm"

at some point during the chroot setup.

The first is clearly more efficient.  However, the second is somewhat
more sophisticated because of the different operating systems; see
/usr/lib/pbuilder/pbuilder-modules for how they deal with it.

Best wishes,

   Julian

Reply via email to