Cannot unmount volume: show which application(s) still use the drive

Bug #81239 reported by Conrad Knauer on 2007-01-24
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gnome-mount (Baltix)
gnome-mount (Ubuntu)

Bug Description

Binary package hint: gnome-volume-manager

Using Feisty from the repositories.

I have an external USB HD. When I turn it on it mounts automatically. 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.

A wishlist bug perhaps?

Conrad Knauer (atheoi) wrote :

Here's a screenshot.

Martin Pitt (pitti) on 2007-01-24
Changed in gnome-volume-manager:
importance: Undecided → Wishlist
status: Unconfirmed → Confirmed
Sergio Zanchetta (primes2h) wrote :

Same problem here.
when I attach usb cable, it mounts automatically all partitions I have in. (3)
Just after this, when I try to unmount one of them something prevents me from unmounting it with error message.

Go further, when I try to unmount, the icons disappear, I get the error message (Cannot unmount volume) and meantime icons reappear.

The only method to unmount them is from terminal with
sudo unmount /media/.... etc.

It's not a wishlist thing, it's a real bug.

Sergio Zanchetta (primes2h) wrote :

Just one thing.

Just mounting and unmounting give me only this simple error message "Cannot unmount volume".
Once I copied files from usb disk and internal hd (I don't remember I did anything else) and when I unmounted each partition of usb hd I got this error message "Cannot unmount volume
an application is preventing the volume from being unmounted." but no processes were using disks.

It's a real bug, I think of gnome-volume-manager, not just a wishlist thing.

Sergio Zanchetta (primes2h) wrote :

It can be related to this bug #107963

I forgot before to say sometimes I get the same message as the bug above.

marcelo (marcelo-espinoza) wrote :

I confirm the same problem in my asus 8jc. I have 2 external USB disks connected, I receive this not-very-helpful message when I try to unmount.
Even if I close all applications, same message appears.
Trying from the terminal gives me:

marcelo@rigel:~$ sudo umount /media/LaCie/
umount: /media/LaCie: device is busy

Tim Jones (tim-mr-dog) wrote :

Confirmed here too (Linux 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux)


milesc (craig-miles1) wrote :

Same exact problem for me too; so very incredibly annoying that I often try to avoid using my external usb hard drive. It often spins down when its not being used and when I try to use it again, I get IO errors, device busy, and so forth. The only way to fix the problem is to umount and mount again, but that is often more easily said than done due to this bug.

Linux 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux

JuanCarlos33 (jcsuarez-econ) wrote :

I have the same problem with mounting and umounting my Lacie drive.

This is not a bug fix but a compromise I found.

I tried messing with my /etc/fstab file and was unsuccessful. I found, however, that my /etc/mtab file recognized my drive as /dev/sdb1 which I was able to painfully unmount with

sudo umount /dev/sdb1

Since I dont want want to write that command all the time I added the line

alias unlacie='sudo umount /dev/sdb1/'

to my .bashrc file so that I may unmount it with unlacie and my password. Not the nicest solution but at least it seems to be a clean unmounting.

Bruin (chdebruin) wrote :

I have a similar problem. When trying to disconnect/unmount my usb hard drive (Samsung SpinPoint) by right-clicking the icon on the desktop, I get the 'cannot eject volume' error message and the drive reopens.

The only way to unmount the volume for me is using the console:
sudo umount /media/disk

I don't get the error message when unmounting cd's, dvd's, flashdrives and usbsticks by right-clicking the icons on the desktop.

Funny thing is that this problem first occurred since I did a fresh reinstall of Feisty. Until the day before yesterday I ran Feisty from an upgraded Edgy install and I didn't have this problem.

Kubismo (lee-hunter) wrote :

I have the same problem with both of my USB drives.

Oben Sonne (obensonne) wrote :

I have a similar problem when plugging in my mobile (Sony Ericsson k750i). It has a memory stick inside which gets handled as an USB device. Everything works perfectly except when running Rhyhtmbox: In that case I cannot unmount the device. So I guess, at least in my case, it is a Rhythmbox problem. I have no idea how to prevent Rhythmbox from blocking the unmount of the device ("Portable Devices/iPod"-Plugin is disabled).

Geoff123 (gsking1) wrote :

Confirming this on Feisty with one of my USB drives. I have another drive that does not have this problem.

nasos (nasos-i) wrote :

I have the same problem. But unfortunately couldn't umount my usb either with umount ....

In my case the problem is Beagle. That for some reason runs on the devices. Here is what works for me:

This will list all processes running on usbdisk:
sudo lsof | grep /media/usbdisk

The output in my case is:
beagled-h 6160 nasos 48r REG 8,17 192000 54791 /me......

Next I kill beagled - helper (proccess 6160 in here) :

sudo kill -9 6160

and then I just unmount.

 sudo umount /media/usbdisk

I don't know what effects to beagle this might have.

Marco Peter (flying-toaster) wrote :

By using nasos method, I identified ghostscript to be the process which is blocking my memory stick.
in the root directory of the stick were indeed some .ps files which could not be opened by ghostscript.
Tests with moving the files brought me to a theory:
After plugging in the memory stick, the file browser opens and the file previews are created by helper programs. In my case this is ghostscript.
If the helper program has problems opening a file it may get blocked. So the file in question is still accessed and the media can not be unmounted.

As a workaround, i deactivated the image previews in the file browser under Edit - Preferences - Previews - Other files with possibility to preview. This solved my problems unmounting the device.

Actually, I don't think the problem has a relation with the gnome-volume-manager, because it does exactly what it has to do: reject unmounting a device which is in use. It seems more to be a problem, where the file browser works with the helper applications.

What would be nice here is that gnome-volume-manager allows you to kill the application in case it does so, or at least to tell which app is involved. But the file manager hasn't to check what the helper applications do, since as a general rule they should not block things silently.

Changed in gnome-mount:
status: Unknown → Invalid
dmang (dustin-kosts) wrote :

just wanted to say that this happened to me just now. i shared the dvd drive so i could copy the contents to another comp over the network and it wouldnt let me eject the disk. doing "sudo umount /media/cdrom0" and "sudo umount -f /media/cdrom0" let to "device is busy" erros. tried "sudo lsof | grep /media/cdrom0" from above and it told me smbd was the problem app/daemon. did a kill -9 680 (for me) and then i could eject the dvd.

In Hardy, I do get this error while trying to eject the CD/DVD-ROM.
Even if I push the drive eject button it shows up.

So this may be another bug, linked to the switch to GVFS maybe. AFAIK in Gutsy this was working fine - nautilus should close itself before umounting. Could you report this (against nautilus I guess)?

Chris (bridgeriver) wrote :

This has been a problem with Linux machines for a long time, even before it was officially a bug. In fact, I've seen the same issue on a Mac as early as 1990 or so:

Mount a drive, launch something that uses one of the files on it, and try to unmount the drive again. This causes an error message saying the drive can't be unmounted because a file is in use by an application.

The problem is that there is no indication of what application has the file open, or what file it is. So if you've been working a while since last using the application, and you have a bunch of applications running, it can become a real hassle to hunt through everything to try and figure out what the holdup is. This usually seems to happen when you're in a hurry to go somewhere and the mounted drive is a USB stick on your keychain along with your car keys!

As nasos wrote, if you have root you can open a terminal and grep the output of lsof. This is the approach I generally use. But it's not much good for a newbie, or for a user who doesn't have root.

SUGGESTION: This step should happen automatically, and the error message in the dialog should say what file(s) are open on the partition, and what app(s) are responsible.

Viraf K (vkarai) wrote :

Yes, the lsof [list open file descriptors] does show what processes are accessing the device. One issue I ran into is ---- it is impossible to umount a USB device if you open a terminal session and traverse to the mount point or one of the subdirectories below it. This is definitely logical and the prudent thing to do is to shut down the terminal session. That did work for me and I was able to unmount.

My distribution is Ubuntu 8.04 [Hardy Heron].

Changed in gnome-mount:
status: Unknown → Confirmed

Somebody is working on that in GNOME, and a Google Summer of Code project is about that too, so this should be fixed soon. See upstream bug watch.

LoonyPhoenix (loonyphoenix) wrote :

It would be ideal if that not-very-helpful-message displayed the list of processes hanging onto the volume. Plus, there should be the option to do a lazy unmount of that drive (umount -l). In such cases that's what I'm doing anyway via terminal.

Martin Pitt (pitti) on 2008-06-03
Changed in gnome-mount:
assignee: nobody → pitti
status: Confirmed → Triaged
Martin Pitt (pitti) wrote :

This is fixed upstream for DeviceKit-disks and a future gnome-mount.

Changed in gnome-mount:
assignee: pitti → nobody

Last comment from upstream:
So this was done in gnome-disk-utility extension for nautilus I think. So, obsolete
Therefore I am closing this bug, since it should be fixed in Ubuntu 10.04.

Changed in gnome-mount (Ubuntu):
status: Triaged → Invalid
Changed in gnome-mount:
importance: Unknown → Medium
status: Confirmed → Expired
Changed in gnome-mount (Baltix):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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