do not show volumeless non-removable drives

Bug #33451 reported by robepisc
40
Affects Status Importance Assigned to Milestone
nautilus (Ubuntu)
Fix Released
Medium
Ubuntu Desktop Bugs

Bug Description

When you pumount a partition (let's say sda1) previously mounted by pmount, /dev/sda1 disappears, even if the device is still plugged in.

To reproduce:
1. Plug in a usb-key
2. wait until it's automatically mounted by g-v-m
3. verify that /dev/sda and /dev/sda1 appeared
4. pumount /dev/sda1 (or do the same from Nautilus)
5. /dev/sda is still there (good), /dev/sda1 is no more (bad!!)

There's no way to remount that partition (since it doesn't have an entry in /dev/ anymore), unless I unplug the usb-disk and plug it in again.

Note that, because of this bug, you can't use any command which acts on unmounted partitions (for example fsck) on removable disks, since they get mounted automatically and, once unmounted, disappear.

I found this on pmount 0.9.7-2ubuntu2 (from Dapper Flight 4).

Revision history for this message
Martin Pitt (pitti) wrote :

Are you sure that this happens if you directly call

  pumount /dev/sda1

? If you use the Places menu/icons/anything graphical, the device gets 'ejected' instead (properly powered off) which makes the partitions disappear.

Changed in pmount:
status: Unconfirmed → Needs Info
assignee: nobody → pitti
Revision history for this message
robepisc (robepisc) wrote :

Argh... you're right, sorry: the problem doesn't show up if I call pumount from the CLI.
I probably was confused by the fact that, in Nautilus, I clicked on "Unmount volume" and I expected it to do a pumount, not an eject!
(By the way, that label should be changed)

However I still think there's a bug, even if against eject, not pmount, since:
1. after an eject (from Nautilus or the CLI), /dev/sda is still there. If /dev/sda1 goes away, also /dev/sda should; or they both should stay. Moreover /dev/sda doesn't work anymore after an eject: if i run "sudo cfdisk /dev/sda" it gives me "FATAL ERROR: Cannot open disk drive". Obviously it can't access the device, since it's powered off!

2. after an eject, Nautilus still shows me an icon for the usb-key. If I right click on it and choose "Mount volume" it fails (of course, it's powered off!).

The easiest solution would be to remove /dev/sda too, after an eject, and hide the icon in Nautilus. If the user needs to use it again, he has to phisically unplug and replug the usb-device.

An alternative solution would be that both /dev/sda and /dev/sda1 stay there after an eject and, if one of them is accessed again later (by an open() call, for example), the device is powered on again.
Under a user's point of view, this is the better option, since he would see the icon of an unmounted, but still plugged in, device in Nautilus, and could access it again by simply clicking on it.
The icon would disappear iff he physically unplugs the device, as expected.

Since this bug doesn't seem related to pmount, should I refile it against eject?

Revision history for this message
Martin Pitt (pitti) wrote :

We already talked about this behaviour a while ago, unfortunately I cannot find the related bug report any more. On some systems /dev/sda1 stay and you can even remount them, on some systems it doesn't work. However, it would be wrong to manually remove the device nodes in pmount if the kernel still knows about them.

Ben, any idea how this could be improved?

Changed in pmount:
assignee: pitti → ben-collins
status: Needs Info → Confirmed
Revision history for this message
Ben Collins (ben-collins) wrote : Re: ejecting a device deletes partition entries under /dev

I don't see why pumount should make the partition disappear. This isn't the same as ejecting, is it?

I recall the issue before had to do with ejecting USB devices, where you then needed to do a "Close Tray" to bring it back. That doesn't sound like the same issue. Think if a USB stick had two partitions, unmounting one should not eject both, and if it's not ejected, then the partition device should not disappear.

Does not sound like a kernel bug to me.

Revision history for this message
Martin Pitt (pitti) wrote :

@Ben: pumount doesn't, but eject does; the Gnome UI always ejects USB devices, since many need it.

Revision history for this message
Ben Collins (ben-collins) wrote :

Martin:

There's not much I can do in this case then. If you tell the kernel to eject it, it's going to be ejected. And the only way to get it back is to push a Close-Tray ioctl, or re-insert the device.

If a replug doesn't work, then that's surely a bug in the device's firmware. The kernel doesn't "retain" this ejected state in anyway.

Revision history for this message
Ben Collins (ben-collins) wrote :

One thing I can think of is that a program like the disk manager should be more intelligent. If a removable device is present, but returns ENODEV on access, then it should do something smart like issue a Close-Tray ioctl. This is about the only thing that makes sense to me.

Revision history for this message
Martin Pitt (pitti) wrote :

As discussed quickly with Seb, we should instead paper over this fact in gnome-vfs or nautilus: drives which are not removable should not be shown if they don't have volumes attached.

Changed in linux-source-2.6.15:
assignee: ben-collins → nobody
Changed in nautilus:
assignee: nobody → desktop-bugs
Revision history for this message
Sebastien Bacher (seb128) wrote :

This upload should fix the issue:

 gnome-vfs2 (2.14.1-0ubuntu3) dapper; urgency=low
 .
   * debian/patches/96_from_cvs_only_non_automounted_listed.patch:
     - patch from CVS, list only drives which don't do automount,
       use storage.media_check_enabled hal property for that
       (Ubuntu: #33451, #41740)

Feel free to reopen if you still have some issue with that version

Changed in nautilus:
status: Confirmed → Fix Released
Revision history for this message
Andrew Jorgensen (ajorg) wrote :

The patch does appear to work as advertised but it seems like Ben Collins proposed solution would give a result that is closer to what the user would expect would happen.

Revision history for this message
Ben Collins (ben-collins) wrote :

@Andrew: Likely something that will get fixed more appropriately post-dapper. We're too close to release to implement enough code to make this Do The Right Thing.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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