FS#38908 - [cifs-utils] umounting user-mounts requires root
Attached to Project:
Arch Linux
Opened by René Herman (rene) - Friday, 14 February 2014, 03:21 GMT
Last edited by Tobias Powalowski (tpowa) - Monday, 12 May 2014, 20:04 GMT
Opened by René Herman (rene) - Friday, 14 February 2014, 03:21 GMT
Last edited by Tobias Powalowski (tpowa) - Monday, 12 May 2014, 20:04 GMT
|
Details
Description:
While this behavior has been reported in various incarnations before (for arch linux and elsewhere) I have been unable to find an answer to this problem: although mounting a CIFS filesystem that has a "user" entry in /etc/fstab works fine, unmounting it does not: [rene@e600 ~]$ grep eva /etc/fstab //LIVINGROOM/media /mnt/eva cifs noauto,user,guest 0 0 [rene@e600 ~]$ mount /mnt/eva [rene@e600 ~]$ umount /mnt/eva umount: /mnt/eva: umount failed: Operation not permitted An earlier report at https://bugs.archlinux.org/task/27948 got closed as "fixed" right after assignee asked whether or not the problem was still open and was told that, yes, it was... :-/ I believe the core issue is systemd systems turning /etc/mtab into a /proc/self/mounts symlink, and upon seeing the current cifs-utils being compiled with --disable-systemd, I tried recompiling without that flag, hoping it would enable some relevant code in mount.cifs. Unfortunately, this did not solve anything. With respect to the "libmount" mention in the earlier report, cifs-utils is indeed not linked to anything of the sort it seems, and there's no information in /run/mounts/utab after "mount /mnt/eva". The behavior is CIFS-specific. Other user-mounts, such as for NFS, do work: [rene@e600 ~]$ mount /mnt/nas [rene@e600 ~]$ cat /run/mount/utab SRC=nas:/shares/Main/Shared\040Folders TARGET=/mnt/nas ROOT=/ ATTRS=addr=192.168.1.170 OPTS=user=rene [rene@e600 ~]$ umount /mnt/nas [rene@e600 ~]$ I suppose this isn't (purely) an upstream issue? Googling for the issue, I did encounter similar reports also for example for ubuntu, but most seemed to be very old and/or FUSE related, and none of them provided a solution. I'm also confused as to why that earlier report was closed... Package version: cifs-utils 6.2-1 |
This task depends upon
Closed by Tobias Powalowski (tpowa)
Monday, 12 May 2014, 20:04 GMT
Reason for closing: Fixed
Additional comments about closing: util-linux-2.24.2
Monday, 12 May 2014, 20:04 GMT
Reason for closing: Fixed
Additional comments about closing: util-linux-2.24.2
Well, it is. The fact that Arch moved to /etc/mtab as a symlink wasn't encouraged by systemd so much as it was by util-linux. Regardless of who pushed this, it's right thing to do. The kernel is smarter than userspace, so rely on the kernel rather than what's essentially a userspace-maintained copy of /proc/mounts.
This specific problem is fixed in util-linux, assuming that your mount helper is SUID (and it appears to be, in this case):
http://github.com/karelzak/util-linux/commit/7e0c06194f5e65eb2a9a
Alternatively, cifs-utils upstream could implement libmount in their mount helper, but that's a feature request for another tracker.
So it is. Not yet in the at the moment of writing current arch version of util-linux (2.24.1-1), but that indeed works:
[rene@e600 ~]$ grep eva /etc/fstab
//LIVINGROOM/media /mnt/eva cifs noauto,user,guest 0 0
[rene@e600 ~]$ mount /mnt/eva
[rene@e600 ~]$ umount /mnt/eva
[rene@e600 ~]$
Just in case someone finds it useful, I have attached the patch from the above commit (retrieved by appending ".patch" to the link) and the needed patch to the util-linux 2.24.1 PKGBUILD to this comment.
Was it a coincidence that I stumbled over this when it was just fixed, or hadn't it been broken for long?
PKGBUILD.patch (0.8 KiB)