nautilus does not show external drives in sidebar if plugged in on reboot

Bug #1618370 reported by Rocko
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Nautilus
Unknown
Medium
gvfs (Ubuntu)
Fix Released
High
Unassigned

Bug Description

nautilus 3.20 should show external drivers in its sidebar (I believe this is the case since 3.19). It always shows my SD card drive in the sidebar, but it only shows external USB drives in the sidebar if I plug them in once I have logged into the desktop. If they are plugged in during a reboot and I log in, they only appear in 'Other Locations' (and the SD card does not appear there; I don't know if that's a bug or not).

If I unmount the external drives and remount them, they still only appear in 'Other Locations'. I have to unmount them, remove them and plug them back in for them to appear in the sidebar.

The attached shows nautilus with 3 drives plugged in. The SD card appears in the sidebar, but the USB drives (a btrfs and another with a btrfs and a ntfs partition) only are in 'Other Locations'.

ProblemType: Bug
DistroRelease: Ubuntu 16.10
Package: nautilus 1:3.20.2-0ubuntu1
Uname: Linux 4.7.2-040702-generic x86_64
ApportVersion: 2.20.3-0ubuntu7
Architecture: amd64
CurrentDesktop: Unity
Date: Tue Aug 30 17:03:44 2016
GsettingsChanges: b'org.gnome.nautilus.window-state' b'geometry' b"'890x550+65+24'"
InstallationDate: Installed on 2016-07-04 (56 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
JournalErrors:
 Error: command ['journalctl', '-b', '--priority=warning', '--lines=1000'] failed with exit code 1: Hint: You are currently not seeing messages from other users and the system.
       Users in the 'systemd-journal' group can see all messages. Pass -q to
       turn off this notice.
 No journal files were opened due to insufficient permissions.
SourcePackage: nautilus
UpgradeStatus: Upgraded to yakkety on 2016-07-24 (36 days ago)

Revision history for this message
Rocko (rockorequin) wrote :
Revision history for this message
Rocko (rockorequin) wrote :

Now the mounted drive doesn't show anywhere in nautilus! I plugged the drive in this time, and although it appears in the unity launcher (megitsune), nautilus isn't showing it in either the sidebar or 'Other Locations'.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue you are reporting is an upstream one and it would be nice if somebody having it could send the bug to the developers of the software by following the instructions at https://wiki.ubuntu.com/Bugs/Upstream/GNOME. If you have done so, please tell us the number of the upstream bug (or the link), so we can add a bugwatch that will inform us about its status. Thanks in advance.

Changed in nautilus (Ubuntu):
importance: Undecided → Low
Revision history for this message
Rocko (rockorequin) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Upstream says it's fixed in the newest not-stable-yet serie and can't easily be backported so I guess that's not going to be fixed for 16.10 but rather next cycle

Changed in nautilus (Ubuntu):
status: New → Fix Committed
Revision history for this message
Rocko (rockorequin) wrote :

Drat. So is the recommendation to use another file manager such as Nemo?

Revision history for this message
Rocko (rockorequin) wrote :

The upstream bug is marked a duplicate of https://bugzilla.gnome.org/show_bug.cgi?id=765924, "Improve external drives detection" (which specifically mentions the issue of drives not being recognised if they are plugged in at login), and the fix according to this bug appears to be in commit https://git.gnome.org/browse/gtk%2B/commit/?id=55751fc.

So I got the ubuntu source for gtk+3.0-3.29.9, and it looks like it already has that commit in it. Firstly, it includes these files:

./debian/patches/0001-Improve-external-drives-detection.patch
./.pc/0001-Improve-external-drives-detection.patch

and secondly, the changes in that commit is in the source for the files:

configure.ac
gtk/gtkplacessidebar.c
gtk/gtkplacesview.c

Does that mean the patch that is supposed to fix this bug is already applied in Ubuntu's version of gtk+? If so, it doesn't work.

Revision history for this message
Rocko (rockorequin) wrote :

Other Places doesn't work at all anymore - clicking on it does nothing. Should I report this as another bug, or is it a known issue?

Revision history for this message
Sebastien Bacher (seb128) wrote :

you should report a new bug

Changed in nautilus:
importance: Unknown → Medium
status: Unknown → Invalid
Revision history for this message
Sebastien Bacher (seb128) wrote :

right, gtk has the patch but we might need https://git.gnome.org/browse/gvfs/commit/?id=b7986553f as well there if somebody wants to try backporting that one...

Revision history for this message
Rocko (rockorequin) wrote :

The patch for that commit works without any changes with the current gvfs in yakkety (1.28.2). With the patch applied I see the is_removable variable using the gvfs-mount -li command, eg:

Drive(0): WDC WD40EZRX-00SPEB0
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
  ids:
   unix-device: '/dev/sda'
  themed icons: [drive-harddisk-usb] [drive-harddisk] [drive]
  symbolic themed icons: [drive-harddisk-usb-symbolic] [drive-harddisk-symbolic] [drive-symbolic] [drive-harddisk-usb] [drive-harddisk] [drive]
  is_removable=0
  is_media_removable=0
  has_media=1

Unfortunately that variable is set to zero for all my drives, irrespective of whether they are external or are plugged in at reboot, so now I don't see anything appear in the sidebar, not even the SD card. (Actually, I see something appear briefly when I insert the card and then it disappears.)

Upstream, they think that is_removable is just a copy of /sys/block/<device>/removable, and for me that is set to zero for USB and SD devices (but not for CDs). For instance, with kernel 4.6.0-10, for a USB device /dev/sdb:

$ readlink -f /sys/block/sdb/device
/sys/devices/pci0000:00/0000:00:0c.0/usb2/2-1/2-1:1.0/host3/target3:0:0/3:0:0:0

$ cat /sys/block/sdb/removable
0

I wonder if that variable is supposed to represent removable media as opposed to a removable drive?

Changed in nautilus:
status: Invalid → Confirmed
Revision history for this message
Rocko (rockorequin) wrote :

Ok, I'm pretty certain that https://bug765457.bugzilla-attachments.gnome.org/attachment.cgi?id=327716 (from bug https://bugzilla.gnome.org/show_bug.cgi?id=765457) is the patch that fixes this issue, because I'm looking at nautilus' sidebar right now and my drives show up both after being hotplugged and after a reboot.

There's a lot more info in the upstream bug https://bugzilla.gnome.org/show_bug.cgi?id=770923 (which is now closed as not-a-gnome-bug), but to summarise:

* Gnome modified nautilus v3.22 to (additionally) use the Removable property exposed by udisks2 when deciding to show volumes in the sidebar and Other Locations.

* This required patches to gvfs, glib, gtk+ to support a new function, g_drive_is_removable(). See comment #8 at the upstream bug for the related bugs and patches. It also mentions nautilus but that's only for 'Other Locations', not the sidebar.

* For 3.20, Debian has already backported these patches to glib and gtk+ (and possibly nautilus).

* The only patch missing is the gvfs patch at https://bug765457.bugzilla-attachments.gnome.org/attachment.cgi?id=327716.

* The gvfs patch applies cleanly to Ubuntu's version of gvfs (1.28.2-1ubuntu1), and with it applied, my drive appears in the nautilus sidebar even after reboot.

The only caveat I have is that it took me a while to figure out how to get the patched gfvs daemons running in Ubuntu, as "sudo make install" installs them to /usr/local/lib/libexec, but Ubuntu keeps running the daemons from /usr/lib/gvfs. I eventually found systemd files for the daemons in /usr/lib/systemd/user and modified the gfvs-udisks2-volume-monitor.service to run from /usr/local/libexec. It didn't work after the first reboot, so I changed it back (I commented out my new ExecStart line and restored the old one) and rebooted again. However, something persisted because ps xa now shows that all the gvfs daemons are being run from /usr/local/libexec (and not just the udisks one) and, most importantly, nautilus' sidebar is working fine.

If anyone can tell me how I eventually managed to get the daemons running from the correct place and how to get them working again if Ubuntu changes its mind, that would be fantastic...

Changed in nautilus:
status: Confirmed → Unknown
Rocko (rockorequin)
no longer affects: nautilus (Ubuntu)
Revision history for this message
Rocko (rockorequin) wrote :

How do I request a backport for the gvfs patch? I can't assign the upstream bug to the gvfs associated package in this bug and I can't delete the association with the 'nautilus' package, although it is not relevant.

The rationale for backporting the gvfs patch is:

1. Upstream applied four patches to improve detection of drives in nautilus (four patches to add the g_drive_is_removable() function).

2. Three of the patches have been backported but the gvfs patch was missed.

3. The gvfs patch fixes the issue where USB drives are not shown in nautilus' sidebar if they are attached at reboot.

4. As far I can tell it doesn't introduce any new issues. (The purpose of the patch is essentially for gvfs to treat USB drives as external (removable) drives by using the information provided by udisks2.)

Changed in gvfs (Ubuntu):
importance: Undecided → High
status: New → Triaged
tags: added: rls-y-incoming
Revision history for this message
Iain Lane (laney) wrote :

I came across this bug - I've cherry-picked the patch and uploaded it.

Let this bug know if it doesn't work (once it's been automatically closed).

Changed in gvfs (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gvfs - 1.28.2-1ubuntu2

---------------
gvfs (1.28.2-1ubuntu2) yakkety; urgency=medium

  * debian/patches/0001-monitor-Add-g_drive_is_removable-support.patch:
    Cherry-pick patch from upstream. Use udisk2's is-removable property to
    detect whether drives are removable or not. This fixes coldplugged USB
    devices not showing up in the Nautilus sidebar. (LP: #1618370)

 -- Iain Lane <email address hidden> Wed, 21 Sep 2016 12:20:48 +0100

Changed in gvfs (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Rocko (rockorequin) wrote :

Thanks, it's working fine here now. (I had to do a full reinstall of the gvfs packages after uninstalling my local version before the repository version would run would run again - I think systemd might be caching things somewhere.)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.