Written by Vivien the 28 Feb 08 at 16:35.
Category: System.
Related project:
Nothing/Others.
Status: In development
Rationale
When someone wants to unmount a volume and the mount point is used, he gets a message telling him that the volume can't be unmounted because an application uses it. The user has no idea which application is actually using it and can't remove the device.
I propose that the popup tells him which application(s) is(are) using the device and propose to terminate them (that list should be kept up to date when the app. dies).
Tags:
(none)
Developer comments
Upstream bug (GNOME #528559) has a patch in discussion. Volunteering to work on it.
Though it would be nifty to see a list of programs using the device I am trying to unmount... I see this as a useless feature. I mean, what is it going to be for am average user, a file open in word, Etc.
If it's not obvious to them from their running programs then whats the point. And if its something like /usr/bin/smdb, then what is telling them going to accomplish.
Furthermore this works the same way now as removing devices in use in Windows and OS X. I just don't see the point to change it to give the user information that wont be useful.
---
Sometimes however for reasons unknown to me, something prevents me from unmounting it (right-clicking the icon for the disk on the desktop and selecting "Unmount Volume"). I don't know what and am not sure how to find out what because the error message is not very helpful:
Cannot unmount volume
an application is preventing the volume from being unmounted.
What would be nice is if it would identify the app(s) and ask if I want them closed and the drive unmounted.
---
Just a note to say that I think not fixing this because Windows is also broken would be really stupid :)
This is the kind of usability enhancement than I think would fit in really well with what I think of as the best in ubuntu. And it really is aggravating when you can't figure out what is causing the problem.
I support this idea. It is very timely in my case as I just experienced this problem. I have had a USB flash drive connected to my computer for the past two days as Nautilus gives the error mentioned above.
I know enough in Linux to have used the lsof command against /media/disk to see which application is preventing the volume from being unmounted. I have determined there is a single file descriptor and that the file has been opened in read mode. I have determined that the application preventing the volume from being unmounted is Nautilus itself. And none of this helps me.
The file is a simple text file. I don't have the file open, I have not accessed the file in Nautilus and I can see no reason why the file has been opened by Nautilus. I just want it unmounted.
Sure I understand that the file was opened in read mode and I can just go ahead and remove the drive. Or I can logout of my session and log back in again, therefore starting a new instance of Nautilus. I could probably even kill Nautilus and have the Gnome Session Manager start a new instance, redrawing my desktop in the process.
However, none of this is user friendly. I should simply be able to select the Unmount option from the menu, be presented with the name of the application(s) accessing the file and be given an option to force the unmount process. Done.
Thanks again for the suggestion and thanks for taking the time to read my post. I hope this idea is given consideration by the Ubuntu development team.
There is also the lack of an "unmount" option if one right-clicks on the volume in the file manager in the file view. why is that? why does it make a difference on which icon i click if it has the same name?
also, it would be great if the same right-click-unmount behaviour could be applied to the "places" tab. i always end up looking for the "right" icon to unmount.
I agree with pynej this would more than likely be confusing for the end user maybe simply add a close all programs bubble, and have a button that says if this doesn't work click here that simply -fl's the unmount.
I'm all for simplicity, but consider this: what if the user has unsaved changed in OOo for files on the drive? Silently killing *some unknown application[s]* sounds dangerous to me.
By the way, "Unmounting a Volume" has confused two non-Linux users I know. They ended up just disconnecting an external drive first rather than risking doing something that they didn't understand. Perhaps "Eject" or "Unplug" would be a better description.
Relatedly, I'd like to see GNU/Linux distributions hold on to the cache for a device after a device is improperly unmounted (someone simply yanked out a USB drive, for instance) so that the OS can prompt the user allowing them the chance to put the device back on the computer and let the OS flush the cache (possibly rewriting blocks that didn't get written properly because the device was improperly unmounted) and then properly unmount the device.
People just yank out the usb drive in any case without taking a look at the screen at all. The popup is always too late. What JB above suggests is a novel and more pervasive approach to the same problem.
What JB suggests is perfect... I love that idea. Same with mthaddon. I noticed that Dapper had the option to 'Eject' a volume but Gutsy just 'unmounts' it, which I think would be slightly confusing. But I think this is something that should definitely be added.
I think that the cases where the error occurs should be reduced. For example, applications should chdir('/') so that they don't lock the directory they were started from. Or when this is not desirable, the revokeat/frevoke system calls could be used.
Not force-quit, but definitely list the programs that are still using the disk, and offer for one to select to quit. It's easy enough for an experienced user to find out already, but I think this would be a valuable usability addition to Gnome upstream.
The mount and unmount commands where designed at a time when you had to turn off the power to add or remove disks.
Now with all the hotpluggable and removable media such as dvd:s and usb disks it's just not acceptable that you can't get your cd out or can't remove your USB stick without fiddling with commands like lsof or fuser as root.
I have even experienced situations when neither fuser nor lsof (which usually is more reliable) could find any open files on the disk i wanted to remove, so i had to reboot the system to free the (mysterious) disk references.
I think the kernel should have a new signal (SIGEJECT) to send to all the processes that have open files, then wait a few seconds for them to save their data before terminating the processes that still has open files and then unmounting and perhaps ejecting the media.
Lots of applications had to become SIGEJECT aware but the ones that weren't would simply terminate without saving.
Also i think programs like konqueror and nautilus should be coded so they always release the files they open as soon the user closes a wiev of a file or folder. Now you often have to restart them to close all the used files.
I think it will be nice if the user have the option to see the process using the file system or just force the umount
i.e choose between fuser -m /filesystem or fuser -mk /filesystem
For example, Nautilus, Rhythmbox and OpenOffice can all tell DeviceKit that they are using files on a USB drive, then when the user requests to unmount it Nautilus can change directory away (to Home or Computer or something), OpenOffice can ask the user whether they wish to save their document and Rhythmbox can silently remove the no-longer-accessible files from the playlist.
The big problem with this idea is that it relies on applications adopting the standard, but whilst many niche programs may never get this support, the most-used, default, actively maintained and popular programs will, eg. standard GNOME, KDE, OpenOffice, AbiWord, Inkscape, GIMP, Gnumeric, Amarok, Exaile, etc. and these are the programs most likely to cause problems when removing a drive (ie. the number of programs which don't have such support AND which are widely used AND are in the hands of users who don't know about closing files before removing drives AND are used with files on removable drives AND cannot attract the interest of a developer to add the feature would be quite small)
Same as pandaking: the Unlocker tool has done a lot to salvage what little sanity Microsoft left me. You can see it here: http://ccollomb.free.fr/unlocker
Not being able to force an eject is a big problem.
This situation has happened to me several times: The power goes out. I my external hard drive on an emergency battery backup which will last maybe 4-8 minutes. This drive WILL be shut off, regardless of how hard the OS protests that "an application" would like for it to stay mounted.
It's just a terrible "I'm sorry, I can't do that, Dave" situation when I request an unmount and ubuntu says No. I'm about to reboot my machine just so I can unplug my drive... this is ridiculous.
I just discovered that killall nautilus will do it. I then restart it by launching 'Home Folder' keyboard shortcut.
I'm thinking about just having a script that will kill nautilus, wait 3 seconds, and then open my home folder.
I'm finding Nautilus rather more buggy under jaunty than it was previously.
It's very quiet - Sicart wrote on the 27 Oct 08 at 05:42 Report as spam / offensive
Same as pandaking: the Unlocker tool has done a lot to salvage what little sanity Microsoft left me. You can see it here: http://ccollomb.free.fr/unlocker
It would be nice if mount/umount would display to the command line what is preventing a proper mount/umount.
If mount/umount said what was preventing a proper mount/umount, it would be alot easier to figure out what's going on during shutdown.
This could be added on as a mount/umount argument, or mount/umount could just default to work this way.
From the point of usability this feature is VERY important. If a new user try Ubuntu and when he was to unmount his usb key receives a not legible message, I think he won't talk very good of ubuntu.
The Ubuntu team could help gnome developers implementing this feature and sending them for approval.