When nautilus cannot unmount a media, it must tell why.

Bug #19586 reported by Lionel Dricot
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Fix Released
One Hundred Papercuts
nautilus (Ubuntu)
Ubuntu Desktop Bugs

Bug Description

If any program is using a mounted media and you try to unmount it by right click
> eject, you will have a very scary error.

When possible, nautilus must tell you why it can't unmount, for exemple by
outputting lsof on the requested media. Not everybody know "lsof".

To reproduce this, mount a media (a cd-rom) and simply cd to it in your
terminal. (cd /cdrom). then try to eject with nautilus.

http://bugzilla.gnome.org/show_bug.cgi?id=147423: http://bugzilla.gnome.org/show_bug.cgi?id=147423

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

Thanks for your bug. That's a known upstream issue:

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

*** Bug 19663 has been marked as a duplicate of this bug. ***

lexual (lexhider)
Changed in nautilus:
status: Unconfirmed → Confirmed
Changed in nautilus:
status: Unconfirmed → Confirmed
Changed in nautilus:
status: Unconfirmed → Confirmed
Changed in nautilus:
assignee: seb128 → desktop-bugs
status: Confirmed → Triaged
Revision history for this message
perpetualrabbit (perpetualrabbit) wrote :

I totally agree with this issue in fact being a bug.

Nautilus provides a GUI in order to take things like save mounting/unmounting
to preserve filesystem integrity down from system administrator level to
everyday user level.
I am a system administrator for 70 linux desktop, amongst other things, but a
lot of people are defecting to Apple over issues like these. OS X _does_ give
helpful information about which process is blocking umount, even if the process
is running in a shell.

Outline how to solve:
Using information from `lsof´ you can figure out which process is blocking
the umount. Furthermore the PID can be used to identify the window or terminal
(even text console) that belongs to it. DBUS can then be used to signal the
window manager to bring the offending windows to the foreground.
Signals can then be sent the programs to initiate the `save files´ dialog.
In the case of text consoles or terminal windows the GUI can present a dialog
to close the programs running from those shells or close the shells themselves.

This is a solvable problem in most common cases, and actually I think quite
straightforward. It just needs some scripts parsing lsof, some interaction between
filemanager, windowmanager and dbus, and a bit of heuristics to cover the most
common cases.
This is a low hanging fruit in terms of improving the user experience.

Whose responsibility?
Enabling the average clueless user to unmount usb sticks is core functionality
in a desktop OS.
Since Canonical aims to offer an easy to use Linux distro, primarily based on
Gnome, I think that this _core functionality_ should be provided by Canonical.
Since Canonical is hiring people to work on kernel, X and Gnome/KDE, I
certainly feel that you cannot simply say this is an upstream issue.
Upstream has different priorities. Since this is probably a relatively easy
thing to solve, no major new subsystem needs to be invented, just using existing
subsystems and programs like `lsof´, I think Canonical should get involved with
upstream to fix this once and for all.

Revision history for this message
perpetualrabbit (perpetualrabbit) wrote :

I have another problem with the unmount/mount dialogs in Nautilus, related to the bug.

I have a USB stick with four partitions on it. Inserting it in a hardy desktop machine results in the machine mounting these four partitions nicely under /media/disk, /media/disk-1, /media/disk-2, /media/disk-3 respectivily.
So far so good.
But I only need some files from the first partition, so I unmount the other three using the right-click menu in Nautilus on them.

Problem 1:
   In the sidebar, the icons for these three unmounted disks do not change, so I cannot tell if they are unmounted

Problem 2:
   Worse, if I right-click on the disk again, `Unmount Volume´ is still an option, it is not greyed-out. Clicking it results in a popup which says "Cannot unmount volume. The volume is not mounted". Unmounting it should not have been an option in the first place.

Problem 3:
   I decide I need a file from partition 2 after all, so I need to mount it again, but there is no option in the right-click menu to do that.

Problem 4:
   So, OK, I cannot convince nautilus to remount my partitions, so I manually find out which shells and programs are currently using the remaining mounted partition and close them, and now unmount the first partition. Then I remove the USB stick, wait a couple of seconds and re-insert it.
In the current Nautilus window the four disks do not disappear when I pull the USB stick out. When I re-insert it, another four disks appear. Now there are eight! Four of them are non functional, and the other four are, but there is nothing to diffirentiate between them except by trial and error.
The `reload´ button in the Nautilus toolbar also does not solve the problem. However if I start a _new_ nautilus window it does show the correct information. And if I go to `computer´ it shows me the four (not eight) partitions as disks, and right clicking on each of them presents me with a menu that has a unmount option.
So re-inserting aparantly did result in remounting all partitions after all. At least in the Location:computer:///
part of Nautilus. So I right-click unmount them all again. Now the icons in the main pane _do_ change from a flat harddisk to a bulky rounded harddisk. In the sidebar the disks disappear. However, in other Nautilus windows they do not disappear. Also there is a problem in the Location:computer:/// interface, namely that disk I unmounted in it now have right-click menus that show both a mount and an unmount button!

Anyway, this is problably a highly confusing bug report for anyone to follow, so I recommend anyone who reads this to try it out yourself with a few USB sticks, or else with a partitioned one (easier).

I would characterize this bug as "inconsistencies between separate Nautilus windows, the sidebars and the Location:computer:/// interface concerning the mounting and unmounting of removable media".

Mat Tomaszewski (mat.t.)
Changed in hundredpapercuts:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

This bug requires some coding work but it should be a some hours task and doable for karmic

Changed in nautilus (Ubuntu):
milestone: none → ubuntu-9.10
Revision history for this message
Tobias Wolf (towolf) wrote :

Won’t this come complimentary with devicekit-disks and gnome-disk-utility?


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

The sceenshot is a gnome-disk-utility one and not a nautilus dialog, karmic uses gvfs and gdu now and there is no such dialog displayed in nautilus by default

Revision history for this message
Daniele Napolitano (dnax88) wrote :

This command could be useful for resolving this bug: fuser

Some examples:
fuser -c <device> Show PIDs of processes that using <device>.
fuser -c -i -k <device> Show PIDs of processes thet using <devce> and ask to killing it.

It would be a great improvement...

Changed in hundredpapercuts:
milestone: none → round-5
Revision history for this message
Tobias Wolf (towolf) wrote :

This is in now. Unless I’m mistaken?

nautilus (1:2.27.4-0ubuntu1)
    - Support new style unmount operations; this will provide a nice dialog when
      unmounting a busy drive mount

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

The issue is fixed in karmic

Changed in nautilus (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Michael Rooney (mrooney) wrote :

Marking the papercuts task as released since this is fixed in Karmic!

Changed in hundredpapercuts:
status: Confirmed → Fix Released
sam tygier (samtygier)
Changed in nautilus:
importance: Unknown → Undecided
status: Confirmed → New
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
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.