After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772306 - Volumes with multiple mount points are not handled correctly
Volumes with multiple mount points are not handled correctly
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: udisks2 volume monitor
git master
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2016-10-01 19:30 UTC by Ronan Arraes
Modified: 2016-10-10 12:27 UTC
See Also:
GNOME target: ---
GNOME version: 3.21/3.22


Attachments
gvfs-mount -l (517 bytes, text/plain)
2016-10-06 09:15 UTC, Ronan Arraes
  Details
udisksctl dump (24.14 KB, text/plain)
2016-10-06 09:15 UTC, Ronan Arraes
  Details
udisks2: Fix handling of volumes with multiple mountpoints (1.36 KB, patch)
2016-10-06 12:56 UTC, Ondrej Holy
committed Details | Review

Description Ronan Arraes 2016-10-01 19:30:37 UTC
I'm using openSUSE Tumbleweed. After the update to GNOME 3.22 (gvfs 1.30.0), I cannot unmount a device that is not listed in /etc/fstab anymore using gvfs.

For example, if I plug an USB-stick (which is not mentioned in /etc/fstab), and try to unmount it in nautilus, I see the message:

umount: /run/media/ronan.arraes/RONAN2: umount failed: Operation not permitted

This also happens when I use XFCE or the command:

gvfs-mount -u /run/media/ronan.arraes/RONAN2

Notice that I can unmount the devices using KDE or udiskctl by the following command:

udisksctl unmount -b /dev/sdb1

Everything was working fine in GNOME 3.20 (gvfs 1.28.3).

By the way, if the device is listed in /etc/fstab, then everything works fine.

Steps to reproduce
==================

1. Plug an USB stick that is not listed in /etc/fstab.
2. Open nautilus and hit eject button.
3. The error message will appear and the device will not be unmounted.
Comment 1 Ondrej Holy 2016-10-03 08:10:54 UTC
Thanks for your bug report.

It sounds weird. I can't reproduce with Fedora 25, nor openSUSE Tumbleweed Live:
http://mirror.karneval.cz/pub/linux/opensuse/tumbleweed/iso/openSUSE-Tumbleweed-GNOME-Live-i686-Snapshot20160928-Media.iso

However, SELinux is disabled currently on my Fedora 25 and it seems also it is disabled for the openSUSE Live. Do you have SELinux enabled? Does it help if you turn SELinux off? Can't this be a duplicate of the following bug?
https://bugzilla.gnome.org/show_bug.cgi?id=772307

Please check the following if the previous issue isn't relevant. Is gvfs-udisks2-volume-monitor process running? Is it running under "ronan.arraes" user? Did you run "udisksctl unmount -b /dev/sdb1" as "ronan.arraes" user?
Comment 2 Ronan Arraes 2016-10-03 16:24:25 UTC
Hi Ondrej Holy,

Thanks for the answer.

I'm downloading the Live CD right now to see if it works here. I have a default Tumbleweed installation, which does not have SElinux enabled, only apparmor. I disabled apparmor, but the problem continues.

Something is really strange, because I can unmount the partition using gnome-disks correctly.

Yes, gvfs-udisks2-volume-monitor is running under user `ronan.arraes`:

ps aux |grep gvfs
ronan.a+  2484  0.0  0.0 282484  7196 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfsd
ronan.a+  2489  0.0  0.0 415604  5112 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
ronan.a+  2570  0.0  0.1 457572  9616 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
ronan.a+  2598  0.0  0.1 359004  9976 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfs-afc-volume-monitor
ronan.a+  2604  0.0  0.0 272344  5932 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfs-mtp-volume-monitor
ronan.a+  2609  0.0  0.1 281432  8344 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
ronan.a+  2615  0.0  0.0 269976  6008 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfs-goa-volume-monitor
ronan.a+  2632  0.0  0.0 191572  5824 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfsd-metadata
ronan.a+  2726  0.0  0.1 358600  9416 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfsd-trash --spawner :1.5 /org/gtk/gvfs/exec_spaw/0
ronan.a+  2870  0.0  0.0 356112  7024 tty2     Sl+  12:56   0:00 /usr/lib/gvfs/gvfsd-burn --spawner :1.5 /org/gtk/gvfs/exec_spaw/1

And yes, `udisksctl unmount -b /dev/sdb1" was executed as `ronan.arraes` user.

By the way, I tested this in three machines (openSUSE Tumbleweed) that were updated to GNOME 3.22 and all had the same problem. Also, I tried with two USB sticks, two HDDs, and one SD card. I could not unmount any of them as user using nautilus eject button.
Comment 3 Ronan Arraes 2016-10-03 16:50:56 UTC
Something is really wrong here. I downloaded the GNOME live CD and it is working perfectly, just as you said. However, if I install Tumbleweed in a VM, then it does not work. It is really really strange. Is there anything I can do?
Comment 4 Ronan Arraes 2016-10-03 17:33:23 UTC
I found a difference between the LiveCD and the installation. In the LiveCD, if I run `pkexec`, then I can execute any command as root without password, whereas in the default installation I must type the root password. Hence, the polkit rules are not the same. Can it explain the difference?
Comment 5 Ondrej Holy 2016-10-05 06:46:13 UTC
Thanks for the info. This is weird...

(In reply to Ronan Arraes from comment #3)
> Something is really wrong here. I downloaded the GNOME live CD and it is
> working perfectly, just as you said. However, if I install Tumbleweed in a
> VM, then it does not work. It is really really strange. Is there anything I
> can do?

I've installed it in VM finally (from the iso in the Comment 1) and I can't still reproduce it :-/ Truly, I haven't got any idea what could be wrong there...

(In reply to Ronan Arraes from comment #4)
> I found a difference between the LiveCD and the installation. In the LiveCD,
> if I run `pkexec`, then I can execute any command as root without password,
> whereas in the default installation I must type the root password. Hence,
> the polkit rules are not the same. Can it explain the difference?

I think this is an expected behavior because the LiveCD user doesn't have any password...
Comment 6 Ronan Arraes 2016-10-05 20:36:14 UTC
Hi Ondrej Holy,

Did you install Tumbleweed into a hard drive inside the VM? If I just execute the Live session, then unmounting works. Today, another user has reported the exactly same problem to the OpenSUSE bug:

https://bugzilla.opensuse.org/show_bug.cgi?id=1001554

I'm really lost here. I still can't find if it is a openSUSE bug, or a GNOME bug triggered by a set of configurations in openSUSE.
Comment 7 Ondrej Holy 2016-10-06 08:43:55 UTC
Yea, I installed Tumbleweed into the hard drive inside the VM and don't see any problems...

You've mentioned an idea, that umount is called instead of udisks. It can really happen in some specific cases, see:
https://git.gnome.org/browse/gvfs/tree/monitor/udisks2/gvfsudisks2mount.c#n967

Can you please confirm that the code spawning umount is really called (gdb, ltrace...)?
 
Can you please provide outputs from "gvfs-mount -l > gvfs-mount.log" and "udisksctl dump > udisksctl.log"?
Comment 8 Ronan Arraes 2016-10-06 09:15:11 UTC
Created attachment 337047 [details]
gvfs-mount -l
Comment 9 Ronan Arraes 2016-10-06 09:15:42 UTC
Created attachment 337048 [details]
udisksctl dump
Comment 10 Ronan Arraes 2016-10-06 09:24:17 UTC
Hi Ondrej Holy,

I uploaded the files you requested. However, I have no idea how can I be sure that this piece of code is being called.
Comment 11 Ronan Arraes 2016-10-06 10:05:04 UTC
Hi,

The things got more weird :)

If I install Tumbleweed from GNOME LiveCD (the link provided in comment #1), then I **do not** see the problem. However, if I install Tumbleweed from the Installation DVD, then I **see** the problem (http://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-Current.iso). Hence, it must be a configuration problem. However, I was not able to find what is different.
Comment 12 Ondrej Holy 2016-10-06 10:36:27 UTC
Thanks for the outputs...

This is correct:
Drive(0): SanDisk Ultra II
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
  Volume(0): Volume 843 GB
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    Mount(0): Volume 843 GB -> file:///media/data
      Type: GProxyMount (GProxyVolumeMonitorUDisks2)

But this is not:
Drive(1): PNY USB 3.0 FD
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
Mount(1): RONAN -> file:///run/media/ronan.arraes/RONAN
  Type: GProxyMount (GProxyVolumeMonitorUDisks2)

Volume is missing and thus "umount" is spawned probably instead if udisks_filesystem_call_unmount...

It should be there:
Drive(1): PNY USB 3.0 FD
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
  Volume(1): RONAN
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    Mount(1): RONAN -> file:///run/media/ronan.arraes/RONAN
      Type: GProxyMount (GProxyVolumeMonitorUDisks2)

I'm not currently sure where is a problem, needs to investigate udisksctl output and the relevant volume monitor codes...
Comment 13 Ondrej Holy 2016-10-06 10:45:44 UTC
Hmm, maybe the problem is that there are two mount points, and /var is considered as system mount and it is filtered out (this would be bug in gvfs probably)...

  org.freedesktop.UDisks2.Filesystem:
    MountPoints:        /run/media/ronan.arraes/RONAN
                        /var/run/media/ronan.arraes/RONAN

I wonder why are there two mount points... Do you see also two mountpoints for this drive on the LiveCD system, or on system installed from the LiveCD?
Comment 14 Ondrej Holy 2016-10-06 11:31:33 UTC
I can reproduce the problem simply if I manually mount my flash drive in some system path, e.g.:

$ gvfs-mount -l
Drive(1): SMI USB DISK
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
  Volume(0): test
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    Mount(0): test -> file:///run/media/oholy/test
      Type: GProxyMount (GProxyVolumeMonitorUDisks2)
...
$ sudo mount /dev/sdb1 /tmp/test
$ gvfs-mount -l
Drive(1): SMI USB DISK
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
Mount(2): test -> file:///run/media/oholy/test
  Type: GProxyMount (GProxyVolumeMonitorUDisks2)
...

We should fix this in GVfs, although I am not sure that the infrastructure is ready for such case... 

In the meantime you can try to figure out why /var mount point is there in your case and remove it somehow as a workaround...
Comment 15 Ronan Arraes 2016-10-06 11:49:31 UTC
Good! Thanks for the explanation. In fact, I cannot see two mount points in the installation that works. I only see in /run. I will try to figure out why it is mounting on /var also here.
Comment 16 Ronan Arraes 2016-10-06 12:42:12 UTC
Thank you very much Ondrej Holy.

The problem is that in my installation and in the installation from the standard DVD, the directory /var/run is not a symlink to /run

After removing /var/run (in maintenance mode) and symlinking to /run, everything started to work again.
Comment 17 Ondrej Holy 2016-10-06 12:56:34 UTC
Created attachment 337065 [details] [review]
udisks2: Fix handling of volumes with multiple mountpoints

Volume is not included currently if it has multiple mount points
and one of them is not considered as user interesting. Change this
logic and include all volumes with at least one user interesting
mount point.
Comment 18 Ondrej Holy 2016-10-06 13:33:34 UTC
The attached patch should fix your case (one interesting mount point and one or more uninteresting mounts), but there is a bit problem with multiple user interesting mount points, because the infrastructure e.g. g_volume_get_mount does expect only one mount per volume... but both mounts are listed in Nautilus and unmounting seems working properly for both of them.
Comment 19 Ondrej Holy 2016-10-10 12:27:30 UTC
Attachment 337065 [details] pushed as be0c464 - udisks2: Fix handling of volumes with multiple mountpoints