unshare -m does not work as expected

Marius Gedminas marius at pov.lt
Fri Apr 26 12:06:39 UTC 2013


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20130426/ab8466bd/attachment.pgp>


More information about the ubuntu-users mailing list