Running pbuilder (on bionic) in parallel when bind-mounting /dev/shm causes the host tmpfs to unmount

Bug #1813802 reported by Sam Mesterton-Gibbons
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pbuilder (Ubuntu)
New
Undecided
Unassigned

Bug Description

If I run something like:

vagrant@ubuntu-bionic:~/packaging/hello$ sudo pbuilder --build --configfile /etc/pbuilder/xenial-amd64/pbuilderrc --buildresult /home/vagrant/packaging/hello/result --bindmounts '/run/dbus /var/lib/dbus /dev/shm /run/shm' hello_2.10-1build1.dsc

And then in parallel (from another SSH session):
vagrant@ubuntu-bionic:~/packaging/hello2$ sudo pbuilder --build --configfile /etc/pbuilder/xenial-amd64/pbuilderrc --buildresult /home/vagrant/packaging/hello2/result --bindmounts '/run/dbus /var/lib/dbus /dev/shm /run/shm' hello_2.10-1build1.dsc

When the second command finishes the tmpfs on /dev/shm is unmounted. Unsurprisingly this causes chaos on the host system. This happens on Bionic but not Xenial, and originally came up on our physical Jenkins agents, but I've reproduced with Vagrant here by way of illustration.

It turns out that the `/dev/shm /run/shm` bind mount is unnecessary, as the RUNSHM option defaults to yes anyway, and removing it makes the problem go away. That being said, I don't know if the same behaviour would happen in the case of other bind mounts when running in parallel, and I'm not sure this should be happening.

Ubuntu version:
vagrant@ubuntu-bionic:~$ lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04

pbuilder version:
vagrant@ubuntu-bionic:~$ apt-cache policy pbuilder
pbuilder:
  Installed: 0.229.1
  Candidate: 0.229.1
  Version table:
 *** 0.229.1 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

The /etc/pbuilder/xenial-amd64/pbuilderrc file mentioned above:
```
# Distribution and Architecture settings
DISTRIBUTION="xenial"
ARCHITECTURE="amd64"
COMPONENTS="main restricted universe multiverse xenial-backports xenial-updates"

# Directories
BASETGZ="/var/cache/pbuilder/xenial-amd64-base.tgz"
BUILDPLACE="/var/cache/pbuilder/xenial-amd64/build"
BUILDRESULT="/var/cache/pbuilder/xenial-amd64/result"
APTCACHE="/var/cache/pbuilder/xenial-amd64/aptcache"
HOOKDIR="/etc/pbuilder/xenial-amd64/hooks"
CCACHEDIR="/var/cache/pbuilder/xenial-amd64/ccache"

# Build Options
CPUS=`grep -c ^processor /proc/cpuinfo`
DEBBUILDOPTS="-j${CPUS}"

# Environment Options
BINDMOUNTS="$BUILDRESULT /run/dbus /var/lib/dbus"
EXTRAPACKAGES="apt-utils wget eatmydata apt-transport-https ca-certificates gnupg gnupg2 "
DEBEMAIL=""
PBUILDERROOTCMD="sudo"
BUILDUSERID=12345

# Exports for the environment
export CCACHE_TEMPDIR="/var/cache/pbuilder/xenial-amd64/ccache/tmp"
export CCACHE_NOSTATS=1
export http_proxy=$http_proxy
export https_proxy=$https_proxy
export no_proxy=$no_proxy

#use eatmydata to avoid fsync in the chroots
export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}/usr/lib/x86_64-linux-gnu/libeatmydata.so"
```

Before running pbuilder:
vagrant@ubuntu-bionic:~$ mount | grep shm
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
vagrant@ubuntu-bionic:~$ ls -l /dev | grep shm
drwxrwxrwt 2 root root 40 Jan 29 16:51 shm

After:
vagrant@ubuntu-bionic:~$ mount | grep shm
<no output>
vagrant@ubuntu-bionic:~$ ls -l /dev | grep shm
drwxr-xr-x 2 root root 40 Jan 29 16:21 shm

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: pbuilder 0.229.1
ProcVersionSignature: Ubuntu 4.15.0-43.46-generic 4.15.18
Uname: Linux 4.15.0-43-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.5
Architecture: amd64
Date: Tue Jan 29 16:54:47 2019
PackageArchitecture: all
SourcePackage: pbuilder
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Sam Mesterton-Gibbons (samdbmg) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.