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 765457 - Flash drives not displayed in sidebar after a reboot
Flash drives not displayed in sidebar after a reboot
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: udisks2 volume monitor
git master
Other Linux
: Normal minor
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on: 765900
Blocks: 765924
 
 
Reported: 2016-04-23 09:04 UTC by Quentin Marlats
Modified: 2016-05-20 08:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
monitor: Add g_drive_is_removable() support (9.58 KB, patch)
2016-05-02 11:05 UTC, Ondrej Holy
none Details | Review
monitor: Add g_drive_is_removable() support (9.32 KB, patch)
2016-05-10 10:07 UTC, Ondrej Holy
needs-work Details | Review
monitor: Add g_drive_is_removable() support (9.32 KB, patch)
2016-05-12 14:35 UTC, Ondrej Holy
committed Details | Review

Description Quentin Marlats 2016-04-23 09:04:32 UTC
When we plug a flash drive, Nautilus displays it in the sidebar. But when we keep the flash drive plugged and we reboot the computer, the sidebar doesn't show the flash drive anymore; we can only access to it with "Other locationsé".

To reproduce:
 - Plug a flash drive; it will be displayed by Nautilus in the sidebar
 - Shutdown computer
 - Start computer
 - The flash drive will not be displayed in the sidebar, even if it's mounted; you can access to it only with "Other locations"
 - To make the flash drive reappear in the sidebar, you have to unplug then replug it (unmount and remount will not redisplaying it in the sidebar)

The bug was on Nautilus 3.18 and now is on 3.20. I use ArchLinux.
Comment 1 Carlos Soriano 2016-04-25 06:59:09 UTC
This is on purpose from GVFS. I also wonder whether is a good idea or not, so worth discussing.
Comment 2 Ondrej Holy 2016-04-25 08:11:27 UTC
Hmm, I can't reproduce it on Fedora, could you please provide outputs from "gvfs-mount -li" before and after the reboot with the connected flash drive?

I suppose "internal drives" are not shown in the sidebar by default. Carlos, am I correct? So I suppose there is a problem with detection whether it is "internal drive" or "removable drive". Carlos, what needs to be set for the mount to be shown in the sidebar?
Comment 3 Carlos Soriano 2016-04-25 11:46:38 UTC
hey, yeah you are correct Ondrej.

This is the code, if this returns true it's shown in the sidebar: https://git.gnome.org/browse/gtk+/tree/gtk/gtkplacessidebar.c#n867

and I believe the problem is maybe around https://git.gnome.org/browse/gvfs/tree/monitor/udisks2/gvfsudisks2drive.c#n239 ?
Comment 4 Quentin Marlats 2016-04-25 14:48:44 UTC
Okay here is the output of "gvfs-mount -li" (I've only kept the concerned disk):
 - Before reboot: http://pastebin.com/M5Ra1TWw
 - After reboot: http://pastebin.com/82X75xHu
 - The diff between the two: http://pastebin.com/DeJH38TG
So the difference is "can_stop".
Comment 5 Carlos Soriano 2016-04-26 08:16:26 UTC
(In reply to Quentin Marlats from comment #4)
> Okay here is the output of "gvfs-mount -li" (I've only kept the concerned
> disk):
>  - Before reboot: http://pastebin.com/M5Ra1TWw
>  - After reboot: http://pastebin.com/82X75xHu
>  - The diff between the two: http://pastebin.com/DeJH38TG
> So the difference is "can_stop".

Thanks for the info. So seems the issue is the one pointed out in comment #3.
Comment 6 Ondrej Holy 2016-04-26 09:49:11 UTC
You are right, but don't know what we can do with it. AFAIK there isn't any reliable way how to determine whether the device is internal/external. The heuristic used in the code expects that external devices are plugged in during the session, which obviously fails in this case...

Designers wanted to hide internal devices by default to reduce the number of entries in the sidebar. I think it is ok to hide also e.g. external disks if they are always connected though it is a bit confusing. 

I don't see the bug with my flash drive because it is ejectable. So this is basically udisks2 bug, however there is also a note in the udisks2 documentation that this is only a guess:
https://udisks.freedesktop.org/docs/latest/gdbus-org.freedesktop.UDisks2.Drive.html#gdbus-property-org-freedesktop-UDisks2-Drive.Ejectable

Carlos, do you have some idea? I would close this as WONTFIX.
Comment 7 Carlos Soriano 2016-04-26 09:54:40 UTC
> Carlos, do you have some idea? I would close this as WONTFIX.

I agree with you, is udisk2 bug. So instead of a WONTFIX, I guess it's NOTGNOME, and would be good to fix it on udisk2.

I agree we cannot rely on can_stop for can_eject not being good enough... Probably I should remove that can_stop check in the sidebar. But I added it because the can_eject was failing most of the times and users reported that most of the ejectable drives were on the other-locations :/
Comment 8 Ondrej Holy 2016-04-26 11:16:50 UTC
I found Removable property, which might be useful (we don't use it in gvfs currently):
https://udisks.freedesktop.org/docs/latest/gdbus-org.freedesktop.UDisks2.Drive.html#gdbus-property-org-freedesktop-UDisks2-Drive.Removable

Quentin, could you please provide output from "udisksctl dump" before and after reboot as you did with "gvfs-mount -li" please? I wonder what is value of "Removable" property in such cases, but I afraid it corresponds with "Ejectable".

It seems that udisks2 more or less reflects /sys/block/sdb/removable, so it is rather kernel bug...
Comment 9 Quentin Marlats 2016-04-26 13:31:26 UTC
Yep:
 - Before reboot: http://pastebin.com/qnaSW0JK
 - After reboot: http://pastebin.com/3KG8B7V5
 - The diff: http://pastebin.com/fTRZHJJ0
It seems that UDisks2 detects the flash drive as removable after reboot. :-)
Comment 10 Carlos Soriano 2016-04-26 13:49:47 UTC
(In reply to Quentin Marlats from comment #9)
> Yep:
>  - Before reboot: http://pastebin.com/qnaSW0JK
>  - After reboot: http://pastebin.com/3KG8B7V5
>  - The diff: http://pastebin.com/fTRZHJJ0
> It seems that UDisks2 detects the flash drive as removable after reboot. :-)

That's really good news. Could we get a confirmation from udisk2 devs Ondrej?
Comment 11 Ondrej Holy 2016-04-26 13:56:46 UTC
Thanks for the logs. So maybe we can add g_drive_is_removable to propagate this flag, which can be used to determine internal/external drives. I will try to get some feedback from udisks guys...
Comment 12 Ondrej Holy 2016-04-28 07:03:30 UTC
Hmm Removable is FALSE for my internal disk and it is TRUE (even after restart) for internal/external optical mechanics, flash drive, card reader, so it seems to be usable for our purpose...

Removable is TRUE for drives on usb/sdio/ieee1394 buses, see:
https://cgit.freedesktop.org/udisks/tree/src/udiskslinuxdrive.c#n875

It should work as we intended according to Peter Hatina from storaged.
Comment 13 Ondrej Holy 2016-05-02 11:05:24 UTC
Created attachment 327141 [details] [review]
monitor: Add g_drive_is_removable() support

Nautilus wants to show entries in the sidebar only for removable devices. It uses currently sort of conditions to determine which devices should be shown. Those condition fails in some cases unfortunatelly. Lets provide g_drive_is_removable() which uses udisks Removable property to determine which devices should be shown. It should return true for all drives with removable media, or flash media, or drives on usb and firewire buses.

Add support for this property also in gvfs-mount tool.

Bump GLib version accordingly.
Comment 14 Ondrej Holy 2016-05-10 10:07:03 UTC
Created attachment 327567 [details] [review]
monitor: Add g_drive_is_removable() support

Removed redundant variable...
Comment 15 Emmanuele Bassi (:ebassi) 2016-05-12 09:00:03 UTC
Review of attachment 327567 [details] [review]:

::: monitor/proxy/gproxydrive.c
@@ +246,3 @@
+  while (g_variant_iter_loop (iter_expansion, "{sv}", &key, &value))
+    {
+      if (!g_strcmp0 (key, "is-removable"))

Please, use `g_str_equal (key, "is-removable")`. It's a lot more readable, and keys in a {sv} cannot be NULL — at most they are empty strings.
Comment 16 Ondrej Holy 2016-05-12 14:35:05 UTC
Created attachment 327716 [details] [review]
monitor: Add g_drive_is_removable() support

Thanks for the review!
Comment 17 Emmanuele Bassi (:ebassi) 2016-05-12 14:49:12 UTC
Review of attachment 327716 [details] [review]:

Looks good to me, but I'm not the GVFS maintainer, so I'll just put the 'reviewed' status and a +1 for pushing it to master.
Comment 18 Ondrej Holy 2016-05-20 08:53:42 UTC
Comment on attachment 327716 [details] [review]
monitor: Add g_drive_is_removable() support

commit b798655