Discussion:
Remount feature of mount
(too old to reply)
Liwei Jiang
2017-08-01 09:00:18 UTC
Permalink
Raw Message
My /proc/mounts is an empty file.
No. I have pulled and compiled the latest code. The same problem still
exist. It reports, "mount: '/usr/local' not in /proc/mounts"
That's a separate error.
Could you show me your /proc/mounts file?
Remount needs to get the previous mount's flags from /proc/mounts. For
$ grep sda1 /proc/mounts
/dev/sda1 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
Without that, remount doesn't (for example) know to set the relatime
flag on the remount, and if it doesn't that flag gets removed. A remount
has to apply your current flags as an offset to the previous flags,
meaning it needs to know the previous flags.
Way back in the dark ages mount used to maintain its own file
(/etc/mtab) with this info, but this couldn't reliably keep track of the
data: for example if you mounted or umounted anything in an overlapping
chroot, the host's /etc/mtab wouldn't get the updates. If a program ever
mounted anything with the system call instead of the mount command,
/etc/mtab wouldn't be updated. When the 'shared subtree' stuff went into
2.6.15 mounts became a per-process attribute and a single systemwide
/etc/mtab made no _sense_ anymore. And then we built containers on top
of that combining the "in a chroot" with "per-process-attribute" and
everybody finally gave up on /etc/mtab. (I was arguing they _should_ do
so back in 2005, but nobody listened back then...)
Since the kernel knows this information, the kernel exports it in
mtab/fstab format, so people could symlink /etc/mtab to that and always
get the right information. Newer mount commands just look for it
straight out of proc without needing the symlink.
Rob
--
Dragonslayer
Rob Landley
2017-08-01 21:48:45 UTC
Permalink
Raw Message
Post by Liwei Jiang
My /proc/mounts is an empty file.
This would be your problem then. Either /proc isn't mounted (in which
case what created /proc/mounts) or your kernel is confused (if /proc is
mounted how is /proc not _in_ /proc/mounts?)

Rob
Liwei Jiang
2017-08-01 04:33:59 UTC
Permalink
Raw Message
No. I have pulled and compiled the latest code. The same problem still
exist. It reports, "mount: '/usr/local' not in /proc/mounts"
Does mount support remount now? This command, "mount -o remount rw
/usr/local
" works well in BusyBox, but not work in Toybox.
http://lists.landley.net/pipermail/toybox-landley.net/2017-
July/009088.html
https://github.com/landley/toybox/commit/d4adb3f8e2ec39674e3
4ed518983ed6e85560c91
Can you reproduce the issue under the current code?
Rob
No. I have pulled and compiled the latest code. The same problem still
exists. It reports, "mount: '/usr/local' not in /proc/mounts"
Loading...