<div dir="ltr"><div class="gmail_quote"><div dir="ltr">I'm using LXC on Ubuntu 12.04 (Precise) on EC2. I am creating a container that uses the host's root filesystem. In the lxc config, I am bind-mounting a different passwd file on top of /etc/passwd:<div><br></div><div><div>lxc.mount.entry=/container/passwd etc/passwd none rw,bind 0 0</div><div><br></div><div>As expected, /etc/passwd on the host and /etc/passwd in the container are different inodes:</div><div><br></div><div>host# ls -i /etc/passwd</div><div>58046 /etc/passwd</div><div>host# ls -i /container/passwd</div><div>287145 /container/passwd</div><div><br></div><div>container# ls -i /etc/passwd</div><div>287145 /etc/passwd</div><div><br></div><div>What I did not expect is that now it is not possible to unlink /etc/passwd at the host level (or inside the container, although I don't care about that):</div><div><br></div><div>host# rm /etc/passwd</div><div><div>rm: cannot remove `/etc/passwd': Device or resource busy<br></div></div><div><div>host#  chsh -s /bin/false root</div><div>chsh: failure while writing changes to /etc/passwd</div></div><div><br></div><div>strace confirms that unlinkat() and rename() are returning EBUSY. (chsh creates a replacement for /etc/passwd and then rename()'s it into place.)</div><div><br></div><div>So, somehow, the fact that the host's /etc/passwd is *not* present in the container marks its inode as busy. I do not think it is as simple as "an inode that has been bind-mounted out of a namespace is busy" because a simple bind-mount test case does not reproduce it:</div><div><br></div><div><div># echo foo > foo</div><div># touch bar</div><div># mount --bind ./foo ./bar</div><div># cat bar</div><div>foo</div><div># touch new</div><div># mv new foo</div><div>#</div></div><div><br></div><div>This seems related to <a href="http://lwn.net/Articles/570338/" target="_blank">http://lwn.net/Articles/570338/</a>. However, in that article, a file which is bind-mounted into another namespace causes EBUSY from unlink/rename(). In my case, a file which is *not* bind-mounted into another namespace is causing EBUSY.</div><div><br></div><div>Can someone explain what is going on?</div><div><br></div><div>Thanks,</div><div><br></div><div>Barry</div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div></div></div>-- <br><div class="gmail_signature">Barry Jaspan<br><font size="1"><span style="color:rgb(102,102,102)">Senior Architect | </span><a style="color:rgb(102,102,102)" href="http://acquia.com" target="_blank">Acquia</a><br style="color:rgb(102,102,102)"><a style="color:rgb(102,102,102)" href="mailto:barry.jaspan@acquia.com" target="_blank">barry.jaspan@acquia.com</a><span style="color:rgb(102,102,102)"> | (c) 617.905.2208 | (w) 781-313-8298</span><br style="color:rgb(102,102,102)"><br style="color:rgb(102,102,102)"><font><a href="http://www.acquia.com/dev-cloud" target="_blank">Acquia Dev Cloud: You build killer websites. We do the rest.</a><a href="http://acquia.com/dev-cloud" target="_blank"></a></font></font><br><a href="http://www.acquia.com/about-us/newsroom/press-releases/inc-magazine-unveils-31st-annual-list-america-s-fastest-growing" target="_blank"><span style="font-size:13px;font-family:Arial;color:#1155cc;background-color:transparent;font-weight:bold;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline">Acquia</span><span style="font-size:13px;font-family:Arial;color:#1155cc;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline"> ranked #1 Software Vendor on the 2012 Inc 500</span></a><br><br></div>
</div>