<div dir="ltr">My /proc/mounts is an empty file.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 1, 2017 at 4:12 PM, Rob Landley <span dir="ltr"><<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 07/31/2017 11:30 PM, Liwei Jiang wrote:<br>
> No. I have pulled and compiled the latest code. The same problem still<br>
> exist. It reports, "mount: '/usr/local' not in /proc/mounts"<br>
<br>
</span>That's a separate error.<br>
<br>
Could you show me your /proc/mounts file?<br>
<br>
Remount needs to get the previous mount's flags from /proc/mounts. For<br>
example, my root filesystem (ubuntu 14.04's defaults) has:<br>
<br>
$ grep sda1 /proc/mounts<br>
/dev/sda1 / ext4 rw,relatime,errors=remount-ro,<wbr>data=ordered 0 0<br>
<br>
Without that, remount doesn't (for example) know to set the relatime<br>
flag on the remount, and if it doesn't that flag gets removed. A remount<br>
has to apply your current flags as an offset to the previous flags,<br>
meaning it needs to know the previous flags.<br>
<br>
Way back in the dark ages mount used to maintain its own file<br>
(/etc/mtab) with this info, but this couldn't reliably keep track of the<br>
data: for example if you mounted or umounted anything in an overlapping<br>
chroot, the host's /etc/mtab wouldn't get the updates. If a program ever<br>
mounted anything with the system call instead of the mount command,<br>
/etc/mtab wouldn't be updated. When the 'shared subtree' stuff went into<br>
2.6.15 mounts became a per-process attribute and a single systemwide<br>
/etc/mtab made no _sense_ anymore. And then we built containers on top<br>
of that combining the "in a chroot" with "per-process-attribute" and<br>
everybody finally gave up on /etc/mtab. (I was arguing they _should_ do<br>
so back in 2005, but nobody listened back then...)<br>
<br>
Since the kernel knows this information, the kernel exports it in<br>
mtab/fstab format, so people could symlink /etc/mtab to that and always<br>
get the right information. Newer mount commands just look for it<br>
straight out of proc without needing the symlink.<br>
<span class="HOEnZb"><font color="#888888"><br>
Rob<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Dragonslayer</div>
</div>