← Back to team overview

kernel-packages team mailing list archive

[Bug 1574514] Re: Strange behaviour with mount --bind

 

This has to do with the propagation behavior of the bind mount.

# mount --bind src dest
# findmnt -o+PROPAGATION | grep dest
├─.../dest                   shared

Shared propagation means that mounts and unmounts in any of the mirrors
propagate to the others. To change this:

# mount --make-private dest
# findmnt -o+PROPAGATION | grep dest
├─.../dest                   private
# mount ... src/mnt
# touch src/mnt/foo
# ls src/mnt
foo lost+found
# ls dest/mnt

dest/mnt will have the same contents as before the mount in src.

I think I remember something about the default behavior changing with
the switch to systemd, from private to shared, but I can't remember for
sure. If you're seeing a different behavior than in older, upstart-based
releases of Ubuntu that may be why.

Marking this bug invalid because the kernel's behavior is exactly what's
expected.

** Changed in: linux (Ubuntu)
       Status: Confirmed => Invalid

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1574514

Title:
  Strange behaviour with mount --bind

Status in linux package in Ubuntu:
  Invalid

Bug description:
  The following problem appears with Ubuntu wily 15.10 and xenial 16.04:

  I bind-mount my rootfs to a temporary folder. I explicitly use --bind
  and NOT --rbind. The result is as expected: I only see the files which
  are in the rootfs, any other mounts are invisible in this directory.
  But when I mount another directory later, It automatically also gets
  mounted in my temporary directory.

  Example (tested with the Live CD xubuntu-16.04-desktop-amd64.iso):

  root@xubuntu:~# mkdir /mnt/source
  root@xubuntu:~# mkdir /mnt/target
  root@xubuntu:~# mount --bind / /mnt/source
  root@xubuntu:~# ls /mnt/source/mnt/target/
  root@xubuntu:~# mount -t tmpfs none /mnt/target
  root@xubuntu:~# touch /mnt/target/testfile
  root@xubuntu:~# ls /mnt/source/mnt/target/
  testfile

  The testfile in the last line SHOULD NOT APPEAR because
  /mnt/source/mnt/target/ should not be mounted.

  I don't find an explanation for this behaviour.

  I found this because I wanted to run:

  tar cpC /mnt/source/ . | tar xpC /mnt/target/

  The command began to cyclic copy
  /mnt/source/mnt/target/mnt/target/mnt/target/mnt/target/

  This scenario always worked in the past versions of Ubuntu and Debian

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: linux-image-4.4.0-21-generic 4.4.0-21.37
  ProcVersionSignature: Ubuntu 4.4.0-21.37-generic 4.4.6
  Uname: Linux 4.4.0-21-generic x86_64
  ApportVersion: 2.20.1-0ubuntu2
  Architecture: amd64
  AudioDevicesInUse:
   USER        PID ACCESS COMMAND
   /dev/snd/controlC0:  xubuntu    1766 F.... pulseaudio
  CasperVersion: 1.376
  Date: Mon Apr 25 08:40:52 2016
  IwConfig:
   enp0s3    no wireless extensions.
   
   lo        no wireless extensions.
  LiveMediaBuild: Xubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
  Lsusb:
   Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
   Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  MachineType: innotek GmbH VirtualBox
  ProcEnviron:
   TERM=xterm
   PATH=(custom, no user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  ProcFB:
   
  ProcKernelCmdLine: file=/cdrom/preseed/hostname.seed boot=casper initrd=/casper/initrd.lz quiet splash --- keyboard-configuration/layoutcode=ch
  PulseList: Error: command ['pacmd', 'list'] failed with exit code 1: No PulseAudio daemon running, or not running as session daemon.
  RelatedPackageVersions:
   linux-restricted-modules-4.4.0-21-generic N/A
   linux-backports-modules-4.4.0-21-generic  N/A
   linux-firmware                            1.157
  RfKill:
   
  SourcePackage: linux
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 12/01/2006
  dmi.bios.vendor: innotek GmbH
  dmi.bios.version: VirtualBox
  dmi.board.name: VirtualBox
  dmi.board.vendor: Oracle Corporation
  dmi.board.version: 1.2
  dmi.chassis.type: 1
  dmi.chassis.vendor: Oracle Corporation
  dmi.modalias: dmi:bvninnotekGmbH:bvrVirtualBox:bd12/01/2006:svninnotekGmbH:pnVirtualBox:pvr1.2:rvnOracleCorporation:rnVirtualBox:rvr1.2:cvnOracleCorporation:ct1:cvr:
  dmi.product.name: VirtualBox
  dmi.product.version: 1.2
  dmi.sys.vendor: innotek GmbH

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1574514/+subscriptions


References