[Bug 1813802] [NEW] Running pbuilder (on bionic) in parallel when bind-mounting /dev/shm causes the host tmpfs to unmount
Sam Mesterton-Gibbons
1813802 at bugs.launchpad.net
Tue Jan 29 17:06:44 UTC 2019
Public bug reported:
If I run something like:
vagrant at 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 at 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 at ubuntu-bionic:~$ lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04
pbuilder version:
vagrant at 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 at ubuntu-bionic:~$ mount | grep shm
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
vagrant at ubuntu-bionic:~$ ls -l /dev | grep shm
drwxrwxrwt 2 root root 40 Jan 29 16:51 shm
After:
vagrant at ubuntu-bionic:~$ mount | grep shm
<no output>
vagrant at 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)
** Affects: pbuilder (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug bionic uec-images
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to pbuilder in Ubuntu.
https://bugs.launchpad.net/bugs/1813802
Title:
Running pbuilder (on bionic) in parallel when bind-mounting /dev/shm
causes the host tmpfs to unmount
Status in pbuilder package in Ubuntu:
New
Bug description:
If I run something like:
vagrant at 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 at 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 at ubuntu-bionic:~$ lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04
pbuilder version:
vagrant at 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 at ubuntu-bionic:~$ mount | grep shm
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
vagrant at ubuntu-bionic:~$ ls -l /dev | grep shm
drwxrwxrwt 2 root root 40 Jan 29 16:51 shm
After:
vagrant at ubuntu-bionic:~$ mount | grep shm
<no output>
vagrant at 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)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pbuilder/+bug/1813802/+subscriptions
More information about the foundations-bugs
mailing list