unshare -m does not work as expected

Kevin Wilson wkevils at gmail.com
Fri Apr 26 12:29:10 UTC 2013


Hi,
Thanks for your quick answer.
 /etc/mtab is not relevant here.  /etc/mtab  is relevant when you run the
"mount" command.

cat /proc/mounts is handled by show_vfsmnt() in the kernel ( no  /etc/mtab  )

cat /proc/<pid>/mountinfo is handled by show_mountinfo() in the kernel
  (no /etc/mtab )

Could not find help with goohle. Once place suggested that it is the
share flag; But this is not the case here as I said.

rgs
Kevin


On Fri, Apr 26, 2013 at 3:06 PM, Marius Gedminas <marius at pov.lt> wrote:
> On Fri, Apr 26, 2013 at 02:50:01PM +0300, Kevin Wilson wrote:
>> I am trying this simple sequence:
>>
>> unshare -m /bin/bash
>> mount /dev/sd3 /mnt/sda3
>>
>> then from a different terminal I run:
>> mount | grep sda2
>>
>> And I see this mount (which was not mounted before running this mount command)
>> cat /proc/self/mountinfo | grep share (on the second terminal, and
>> also on  the first) does not find anything.
>> So we don't have here a shared mount.
>>
>> Now, I would expect not to see sda3 mounted on the second terminal.
>> I created a child with a different namespace in the first terminal.
>>
>> Why do I see it ?
>
> Perhaps because /etc/mtab is a regular file that is shared by both of
> your namespaces?
>
> You could replace /etc/mtab with a symlink to /proc/mounts, IIRC, but
> there are some subtle caveats in some situations.  I don't remember the
> details, unfortunately.  Google might help, perhaps.
>
> Marius Gedminas
> --
> * philiKON wonders what niemeyer is committing :)
> *** benji_york is now known as benji
> <benji> murder?
>                 -- #zope3-dev
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>




More information about the ubuntu-users mailing list