[buildd-tools-devel] Bug#829125: schroot: schroot doesn't clean up its bind mounts if used concurrently

Dima Kogan dkogan at debian.org
Thu Jun 30 18:02:42 UTC 2016


Package: schroot
Version: 1.6.10-2
Severity: normal

Hi. I have a simple schroot of type=directory profile=desktop, so it has
some bind-mounts in it.

I start out with no schroot stuff mounted:

  $ mount | grep schroot

  $

Then I enter a schroot:

  $ schroot -c xxx zsh

  $ [ in chroot ]

If I look at the mounts, they make sense. Everything is bind-mounted
once:

  $ mount | grep schroot

  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15 type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  proc on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/proc type proc (rw,nosuid,nodev,noexec,relatime)
  sysfs on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/sys type sysfs (rw,nosuid,nodev,noexec,relatime)
  udev on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/dev type devtmpfs (rw,nosuid,relatime,size=16421320k,nr_inodes=4105330,mode=755)
  devpts on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/home type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/tmp type ext4 (rw,relatime,errors=remount-ro,data=ordered)

  $ mount | grep schroot | wc -l
  7

Then with this schroot open, I enter it again from a different terminal:

  $ schroot -c xxx zsh

  $ [ in chroot. again. ]

Looking at the mounts, I now see this:

  $ mount | grep schroot | wc -l

  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15 type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  proc on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/proc type proc (rw,nosuid,nodev,noexec,relatime)
  sysfs on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/sys type sysfs (rw,nosuid,nodev,noexec,relatime)
  udev on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/dev type devtmpfs (rw,nosuid,relatime,size=16421320k,nr_inodes=4105330,mode=755)
  devpts on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/home type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/tmp type ext4 (rw,relatime,errors=remount-ro,data=ordered)

  # ^^^^^^ These are identical to the mounts we had before

  /dev/sda1 on /run/schroot/mount/xxx-aeef8a02-8d83-4159-9916-75597e00b42d type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  proc on /run/schroot/mount/xxx-aeef8a02-8d83-4159-9916-75597e00b42d/proc type proc (rw,nosuid,nodev,noexec,relatime)
  sysfs on /run/schroot/mount/xxx-aeef8a02-8d83-4159-9916-75597e00b42d/sys type sysfs (rw,nosuid,nodev,noexec,relatime)
  udev on /run/schroot/mount/xxx-aeef8a02-8d83-4159-9916-75597e00b42d/dev type devtmpfs (rw,nosuid,relatime,size=16421320k,nr_inodes=4105330,mode=755)
  devpts on /run/schroot/mount/xxx-aeef8a02-8d83-4159-9916-75597e00b42d/dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
  devpts on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
  /dev/sda1 on /run/schroot/mount/xxx-aeef8a02-8d83-4159-9916-75597e00b42d/home type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  /dev/sda1 on /run/schroot/mount/xxx-aeef8a02-8d83-4159-9916-75597e00b42d/tmp type ext4 (rw,relatime,errors=remount-ro,data=ordered)

  # ^^^^^^ These are the same as the previous mounts, but:
  #        1. with a different UUID
  #        2. /dev/pts with the original UUID is mounted AGAIN for some reason

  $ mount | grep schroot | wc -l
  15   # We had 7 before, now we have 2x that many, plus the extra /dev/pts

So this is a bug. /dev/pts shouldn't have been mounted a second time,
especially not with the first UUID.

Now I go back to the first schroot, and exit it.

  $ exit
  E: 10mount: umount: /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/dev/pts: target is busy
  E: 10mount:         (In some cases useful info about processes that
  E: 10mount:          use the device is found by lsof(8) or fuser(1).)
  E: xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15: Chroot setup failed: stage=setup-stop

This is a bug, but maybe it makes some sense given what we saw before. The
second chroot mounted /dev/pts a second time, so it maybe looked busy.
However if I look at what is still mounted at this point, I see that
NOTHING got cleaned up. I'd hope that it would clean up everything
except the things it couldn't:

  $ mount | grep schroot | wc -l
  15

Now I go to the second schroot (the only one still open), and exit it.

  $ exit

  $ (outside the chroot)

That works ok. We now exited both schroots. Ideally nothing should be
mounted now. Instead we have:

  $ mount | grep schroot

  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15 type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  proc on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/proc type proc (rw,nosuid,nodev,noexec,relatime)
  sysfs on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/sys type sysfs (rw,nosuid,nodev,noexec,relatime)
  udev on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/dev type devtmpfs (rw,nosuid,relatime,size=16421320k,nr_inodes=4105330,mode=755)
  devpts on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/home type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  /dev/sda1 on /run/schroot/mount/xxx-5a4ddce3-2bbd-41ef-a415-d1d1c5e79d15/tmp type ext4 (rw,relatime,errors=remount-ro,data=ordered)

  $ mount | grep schroot | wc -l
  7

These are the UUIDs from the first schroot (the second one we exited).
So exiting the first schroot cleaned up the mounts from the SECOND
schroot, but left its own ones alone. This is a bug too.

Hopefully this is helpful. Thanks!



-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.6.0-1-amd64 (SMP w/20 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages schroot depends on:
ii  libboost-filesystem1.58.0       1.58.0+dfsg-5.1
ii  libboost-iostreams1.58.0        1.58.0+dfsg-5.1
ii  libboost-program-options1.58.0  1.58.0+dfsg-5.1
ii  libboost-system1.58.0           1.58.0+dfsg-5.1
ii  libc6                           2.22-12
ii  libgcc1                         1:6.1.1-7
ii  libpam0g                        1.1.8-3.3
ii  libstdc++6                      6.1.1-7
ii  libuuid1                        2.28-5
ii  schroot-common                  1.6.10-2

schroot recommends no packages.

Versions of packages schroot suggests:
pn  aufs-tools | unionfs-fuse  <none>
pn  btrfs-tools                <none>
ii  debootstrap                1.0.81
pn  lvm2                       <none>
pn  qemu-user-static           <none>

-- Configuration Files:
/etc/schroot/schroot.conf changed:
[xxx]
description=xxx
users=dima
root-users=dima
groups=sbuild
root-groups=root
type=directory
directory=/home/dima/root_xxx
shell=/bin/bash
preserve-environment=yes
profile=directory


-- no debconf information



More information about the Buildd-tools-devel mailing list