mount.8: mtab as symlink
Hi Karel,
on coreutils' mailing list, we regularly receive complaints about df(1) not working properly with bind mounts, and it turns out that the users' system still has /etc/mtab as a regular file. (There were recently a lot of attempts to fix issues with duplicate mounts and over-mounting - and thus eclipsing - of source or target.)
Well, there might be a bug in df(1), anyway, we'd like to advise the user to switch to mtab as a symlink to /proc/mounts or /proc/self/mounts as it is common nowadays on many distros. But then the user reads "man 8 mount" ...
It is possible to replace /etc/mtab by a symbolic link to /proc/mounts, and especially when you have very large numbers of mounts things will be much faster with that symlink, but some information is lost that way, and in particular using the "user" option will fail.
... and is scared about the last sentence.
Is this still true? I don't have problems with mounting "user" file systems (apart from ntfs-3g) here. What are the problems, and if they still exist, could the details be added to the man page, please?
Thanks & have a nice day,
Berny
Karel Zak
maintainerQuoted 8 lines · Bernhard Voelker
It is possible to replace
/etc/mtabby a symbolic link to/proc/mounts, and especially when you have very large numbers of mounts things will be much faster with that symlink, but some information is lost that way, and in particular using the "user" option will fail.... and is scared about the last sentence.
Is this still true? I don't have problems with mounting "user"
Oops, this is really obsolete info. Fixed. Thanks!
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 8 lines · Karel Zak
Quoted 5 lines · Bernhard Voelker
It is possible to replace
/etc/mtabby a symbolic link to/proc/mounts, and especially when you have very large numbers of mounts things will be much faster with that symlink, but some information is lost that way, and in particular using the "user" option will fail.Oops, this is really obsolete info. Fixed. Thanks!
So how does umount determine that a device was mounted by a user and thus that the user is alllowed to unmount it again? In my /proc/mounts there is no indication that a user mounted a partition (apart from the "nosuid,nodev,noexec" hint, but that is no guarantee). Does it require a certain minimum kernel version?
And what if the mount option is "users"? And in both cases, what if root mounted such a partition? How does umount figure out that a user may still not unmount it?
Benno
Signature · 1 line
http://www.fastmail.fm - Same, same, but different...
Quoted 2 lines · Benno Schulenberg
So how does umount determine that a device was mounted by a user and thus that the user is alllowed to unmount it again?
man sys-utils/mount.8 # the new one! ;-)
user Allow an ordinary user to mount the filesystem.
The name of the mounting user is written to mtab (or to the private libmount file in /run/mount on system without regular mtab) so that he can unmount the filesystem again.
Have a nice day,
Berny
Quoted 5 lines · Bernhard Voelker
Quoted 2 lines · Benno Schulenberg
So how does umount determine that a device was mounted by a user and thus that the user is alllowed to unmount it again?
man sys-utils/mount.8 # the new one! ;-)
:) Ah, the man page is too big!
Quoted 5 lines
user Allow an ordinary user to mount the filesystem.
The name of the mounting user is written to mtab (or to the private libmount file in/run/mounton system without regular mtab) so that he can unmount the filesystem again.
There is no /run directory on my system. So this probably means that this mechanism requires a minimum kernel version? Or should that be /var/run/mount?
By the way, Karel, what are these 'helper=' and 'uhelper=' things that are mentioned in umount.8? Shouldn't these be mentioned in mount.8 too, and more extensively? But... how can uhelper ever be specified when a mountpoint isn't defined in /etc/fstab?
Benno
Signature · 1 line
http://www.fastmail.fm - The way an email service should be
Karel Zak
maintainerQuoted 16 lines · Benno Schulenberg
Quoted 5 lines · Bernhard Voelker
Quoted 2 lines · Benno Schulenberg
So how does umount determine that a device was mounted by a user and thus that the user is alllowed to unmount it again?
man sys-utils/mount.8 # the new one! ;-)
:) Ah, the man page is too big!
Quoted 5 lines
user Allow an ordinary user to mount the filesystem.
The name of the mounting user is written to mtab (or to the private libmount file in/run/mounton system without regular mtab) so that he can unmount the filesystem again.
Quoted 3 lines
There is no /run directory on my system. So this probably means that this mechanism requires a minimum kernel version? Or should that be
/var/run/mount?
All this is userspace stuff only, if you don't have /run than it uses old obsolete /dev/.mount/utab
Quoted 3 lines
By the way, Karel, what are these 'helper=' and 'uhelper=' things that are mentioned in umount.8? Shouldn't these be mentioned in mount.8 too, and more extensively?
Not sure, it's implemented for very special purpose when udisks mount a device that should be umounted again by udisks. I don't think we want to do any advertisement for this functionality.
Quoted 2 lines
But... how can uhelper ever
be specified when a mountpoint isn't defined in/etc/fstab?
It's never specified in fstab, it's specified by udisks when it calls mount(8).
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 8 lines · Karel Zak
Quoted 3 lines · Benno Schulenberg
By the way, Karel, what are these 'helper=' and 'uhelper=' things that are mentioned in umount.8? Shouldn't these be mentioned in mount.8 too, and more extensively?
Not sure, it's implemented for very special purpose when udisks mount a device that should be umounted again by udisks. I don't think we want to do any advertisement for this functionality.
So... should it be removed from the man page of umount too? If so, the third patch in the upcoming series does that.
Benno
Signature · 2 lines
http://www.fastmail.fm - Access all of your messages and folders
wherever you areKarel Zak
maintainerQuoted 7 lines · Benno Schulenberg
Quoted 5 lines · Karel Zak
Quoted 3 lines · Benno Schulenberg
By the way, Karel, what are these 'helper=' and 'uhelper=' things that are mentioned in umount.8? Shouldn't these be mentioned in mount.8 too, and more extensively?
Quoted 6 lines
Quoted 3 lines
Not sure, it's implemented for very special purpose when udisks mount a device that should be umounted again by udisks. I don't think we want to do any advertisement for this functionality.
So... should it be removed from the man page of umount too? If so, the third patch in the upcoming series does that.
Please, no. It's described in the section where is description of the API between umount(8) and external helpers. IMHO 'helper=' and 'uhelper=' makes sense there.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
helper= and uhelper=
Quoted 7 lines · Karel Zak
Quoted 2 lines · Benno Schulenberg
So... should it be removed from the man page of umount too? If so, the third patch in the upcoming series does that.
Please, no. It's described in the section where is description of the API between umount(8) and external helpers. IMHO 'helper=' and 'uhelper=' makes sense there.
Well, you applied the third patch in the series of six anyway, :) so the mention of those [u]helper markers was removed. I'll submit a patch later to restore them, worded more clearly. But first let's make sure that I understand what they mean.
First there was commit f19c952b2fc07ddd7a698cf3a213a9a16d13e7ba "umount: use helper= for all UIDs", where 'phelper' is renamed to 'helper', because it serves not just for root. But two weeks earlier there was commit c56226697342ddd663492f77768e7a7cb8e579a1 "umount: call /sbin/umount.<uhelper> for root user too".
So, if I understand well, uhelper= and helper= would behave exactly the same under all circumstances?
$ udisks --mount /dev/sda3 Mounted /org/freedesktop/UDisks/devices/sda3 at /media/Mint Petra
$ grep sda3 /etc/mtab /dev/sda3 /media/Mint\040Petra ext4 rw,nosuid,nodev,uhelper=udisks 0 0
$ ./umount -v /dev/sda3
(Oh, that last command is surprising: it doesn't say anything. I would expect it to say that /dev/sda3 was successfully unmounted. Oh, and why isn't sda3 'noexec' here although it was mounted by a user?)
So when using udisks, a uhelper= marker will be put into the /etc/mtab file (the real one). Is there any program that will put a helper= marker in the /etc/mtab file? (I call it a 'marker' because it is not a mount
option: putting it in /etc/fstab makes no sense, and using it on the command line does not work).
$ ./mount -o uhelper=udisks /dev/sda3 lt-mount: only root can use "--options" option
$ sudo ./mount -o uhelper=udisks /dev/sda3 lt-mount: can't find /dev/sda3 in /etc/fstab
Benno
Signature · 1 line
http://www.fastmail.fm - Choose from over 50 domains or use your own
Karel Zak
maintainerRe: helper= and uhelper=
Quoted 1 line · Benno Schulenberg
Well, you applied the third patch in the series of six anyway, :)
oh, I usually check if the patch applies to code to do more detailed review and I forgot you have talked about uhelper= too.
Quoted 2 lines
so the mention of those [u]helper markers was removed. I'll submit a patch later to restore them, worded more clearly. But first let's
please
Quoted 4 lines
make sure that I understand what they mean.
So, if I understand well, uhelper= and helper= would behave exactly the same under all circumstances?
We have three types of umount helpers
umount.<type> where <type> is filesystem type (e.g. umount.nfs)
umount.<helper> this is exactly the same like mount.<type> but the name is
from helper= mtab option
If you want to umount any filesystem and you have no root permissions then the filesystem has to be in fstab (and in mtab with 'user' option).
umount.<uhelper> helper for unprivileged users, the filesystem does
not have to be in fstab, the entry in mtab is enough.
Note that all helpers are always executed without root permissions, the helper has to be suid or use any other way to do umount(2).
Quoted 10 lines
$ udisks --mount /dev/sda3 Mounted /org/freedesktop/UDisks/devices/sda3 at /media/Mint Petra$ grep sda3 /etc/mtab /dev/sda3 /media/Mint\040Petra ext4 rw,nosuid,nodev,uhelper=udisks 0 0$ ./umount -v /dev/sda3(Oh, that last command is surprising: it doesn't say anything. I would expect it to say that
/dev/sda3was successfully unmounted. Oh, and
well, report it to udisk
Quoted 1 line
why isn't sda3 'noexec' here although it was mounted by a user?)
udisks have any policy for this purpose ... and "noexec" is pseudo security optimization, you can copy the file to you $HOME and execute. The options nosuid,nodev are more important. Anyway, all this is controlled by udisks.
Quoted 3 lines
So when using udisks, a uhelper= marker will be put into the
/etc/mtabfile (the real one). Is there any program that will put a helper= marker in the/etc/mtabfile?
I don't remember any program with "helper=", but it means nothing.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Re: helper= and uhelper=
Quoted 3 lines · Karel Zak
If you want to umount any filesystem and you have no root permissions then the filesystem has to be in fstab (and in mtab with 'user' option).
To be more precise, when wanting to unmount while not having superuser permissions, and there is no uhelper=somethingvalid marker in the mtab file, then the filesystem has to be in /etc/fstab with the option 'users' (and no marker needs to be present in mtab, and even if it is, it will be ignored), or the /etc/fstab file contains the option 'user' and the /etc/mtab file contains 'user=yourname'. Right?
Benno
Signature · 1 line
http://www.fastmail.fm - A fast, anti-spam email service.