"Cannot remove directory" on unmount due to stale .hal-mtab entries

Bug #95368 reported by Ilmari Vacklin
88
This bug affects 5 people
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Invalid
Low
Unassigned
sysvinit (Ubuntu)
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: nautilus

When using the unmount feature in the right click menu of my iAudio 5 portable audio player, I get an error dialog that says:

Cannot unmount volume
Cannot unmount the volume.

Details:
Cannot remove directory

This is a regression, since it worked fine in Edgy.

Related branches

Revision history for this message
Ilmari Vacklin (wolverian) wrote :

Argh, forgot to mention that the unmounting actually does work, despite the error dialog. So the bug is that the error dialog appears for no reason.

Also, the "writing data to device" notification bubble never disappears unless manually clicked on.

Revision history for this message
Sebastien Bacher (seb128) wrote : Re: (feisty) unmounting a device icon on desktop gives an error dialog

Thank you for your bug. To work on by somebody getting the issue, likely to send upstream

Changed in nautilus:
assignee: nobody → desktop-bugs
importance: Undecided → Low
Revision history for this message
Dagfinn Ilmari Mannsåker (ilmari) wrote :

This is caused by stale entries in /media/.hal-mtab confusing /usr/lib/hal/hal-storage-unmount. It calls umount(8) with the device name, but when it tries to remove the directory it uses the directory name in the first entry matching the device name, which fails. The directory is later removed by /usr/lib/hal/hal-storage-cleanup-mountpoint, which for some reason manages to find the right entry in /media/.hal-mtab.

Changed in nautilus:
status: Unconfirmed → Confirmed
Revision history for this message
Dagfinn Ilmari Mannsåker (ilmari) wrote :

Here's a patch that fixes it for this case, by making sure the mount point in /media/.hal-mtab matches the one in the LibHalVolume object.

This only works if libhal-storage can get the volume from the UDI, but that seems to be the case when using gnome-unmount.

Revision history for this message
Ilmari Vacklin (wolverian) wrote : Re: [Bug 95368] Re: (feisty) unmounting a device icon on desktop gives an error dialog

On Mon, Apr 09, 2007 at 05:46:53PM -0000, Dagfinn Ilmari Mannsåker wrote:
> Here's a patch that fixes it for this case, by making sure the mount
> point in /media/.hal-mtab matches the one in the LibHalVolume object.

Thanks! Would this be appropriate to send upstream?

--
Ilmari Vacklin
<email address hidden>

Revision history for this message
yemu (yemu) wrote : Re: (feisty) unmounting a device icon on desktop gives an error dialog

hi, i' using up to date feisty and the bug is still not fixed :-((

Revision history for this message
swork (steve-ubuntu-launchpad) wrote :

Looks to me like UTF-8 in a volume name trips things up. iPods get named things like "Steve's iPod" by default, where the apostrophe is somewhere up in Unicode space. I got a three-number \nnn\nnn\nnn sequence in .hal-mtab in place of the apostrophe, and saw this problem. When I wiped .hal-mtab, rebooted (maybe unnecessary, I'm new to Ubuntu and didn't know how to restart gnome-volume-manager) and renamed the iPod (using a Mac) to an all-ASCII name this problem went away for me.

Check the encoding and decoding of the mountpoint pathname in .hal-mtab.

Revision history for this message
mattaw (mas-ecs) wrote :

Confirm this as described by swork.

However it also fills the /media directory with directories like:

/media/Mat's iPod
/media/Mat's iPod_
/media/Mat's iPod__
/media/Mat's iPod___

Obviously there is an error with the encoding in .hal-mtab.

Changing my iPod to MatPod cured the problem.#

Matthew

Revision history for this message
mon (javiermon-deactivatedaccount) wrote :

Hi

I've removed the file /media/.hal-mtab and the problem is gone.

I have an iaudio u2 player.

thanks!

Revision history for this message
Lauri Kainulainen (luopio) wrote :

Removal of /media/.hal-mtab also works here (using Ericsson k750i phone).

Revision history for this message
Andrew Jorgensen (ajorg) wrote :

Can someone who knows link the upstream bug here?

Perhaps we should also update the description. It looks to me like this is reproducible by plugging in USB sticks with different volume names.

Does it only happen when there are stale entries?

Revision history for this message
Nick B. (futurepilot) wrote :

I was getting this same error.
Cannot Unmount Volume
Cannot Remove Directory

Removing /media/.hal-mtab fixed the problem.
It does seem to only happen when there are stale entries in /media/.hal-mtab
I'm guessing it was from having multiple drives plugged in.

Revision history for this message
Mark Junker (mjscod) wrote :

I had the same problem with Gutsy Gibbon. Removing the /media/.hal-mtab fixed the problem. There was an old entry that contained german umlauts like "ö" and "ä".

Revision history for this message
Thomas Novin (thomasn80) wrote :

Also solved it on Gutsy Gibbon by removing /media/.hal-mtab. I didn't have any strange things in there though. I got the problem a few weeks ago when I was using Feisty.

Revision history for this message
Eric Amundson (sewmyheadon) wrote :

I also noticed this problem in Gutsy, so I backed up my .hal-mtab and .hal-mtab-lock files, removed the originals and everything's working fine. I think it was due to 'stale entries' and wonder if it could be related to the fact that I formatted this drive and renamed it so it's mounted under a different name.

Revision history for this message
jnewm (jessenewmark) wrote :

Worked for me in Gutsy also...

Revision history for this message
Arthur Penn (arthur-penn) wrote :

Another satisfied user of this fix (with Gutsy) here.

Changed in hal:
status: Confirmed → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

The patch needs some cleanup (should use a new variable for the libhal_volume_get_mount_point() result, otherwise it compares possibly wrong values in the next iteration), but I forwarded it to upstream for a general comment.

Changed in hal:
assignee: desktop-bugs → pitti
status: Triaged → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Affects quite a lot of people.

IMHO /media/.hal-mtab should move to /var/run/hal-mtab, and in addition we should apply a fixed version of this patch.

Changed in hal:
importance: Low → High
Revision history for this message
Pawel (dawajpoczte-gmail) wrote :

in my case i have two optical drive:
CD-ROM and DVD-RW

When i use CD-ROm i don't have any problems with unmount drives.
When i use DVD-RW - i can't normally unmount CD or DVD.

I noticed that in file /media/.hal-mtab there was a line containing label of one my discs. Label consists of characters specified to my language (polish) so label was a strange name. I just remove this line and everything is now OK.

Regards
Pawel

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

/etc/init.d/mtab.sh should remove the file on boot. No need to keep them forever.

Changed in sysvinit:
assignee: nobody → pitti
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sysvinit - 2.86.ds1-14.1ubuntu43

---------------
sysvinit (2.86.ds1-14.1ubuntu43) hardy; urgency=low

  * debian/initscripts/etc/init.d/mtab.sh: Remove /media/.hal-mtab on boot, to
    avoid building up cruft when device name change, etc. (LP: #95368)

 -- Martin Pitt <email address hidden> Thu, 03 Apr 2008 15:13:51 +0200

Changed in sysvinit:
status: In Progress → Fix Released
Revision history for this message
Thomas Pifer (zero456) wrote :

I am having a similar problem to comment 8 except dealing with a Lacie D2 Quadra drive on Hardy. Does sysvinit need to be installed for the fix, or will the fix for hal solve it when it comes around?

Revision history for this message
Patrice Vetsel (vetsel-patrice) wrote :

I re-open this bug.
The upgrade of sysvinit 2.86.ds1-14.1ubuntu43 create a bug for me.

Using an external usb DD (with NTFS) labeled "Lacie".

If i unmount it with nautilus->no problem. If i reboot system without unmounting it with nautilus, after reboot my external is mounted on /media/Lacie_ and i have an empty dir /media/Lacie. After 2 reboots i have /media/Lacie /media/Lacie_ and /media/Lacie__ (the external DD)

So I think the patch is not so good Pitti ;-)

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

Agreed. This patch definitely has the undesired side-effect Patrice mentions. It should be easy enough to add an rmdir (please not an rm -r, that could be disastrous) to the patch.

Something more specific to the actual problem would be more appropriate, of course.

Revision history for this message
Patrice Vetsel (vetsel-patrice) wrote :

Confirmed also with another external USB DD with Ext3 and VFAT partitions

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

This created a regression, see bug 101845, so milestoning.

Changed in sysvinit:
importance: Medium → High
milestone: none → ubuntu-8.04
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

I reverted the sysvinit change which caused this bug. To clean this up locally on your system, please remove empty unused mount points in /media manually (no way to do it automatically in a safe fashion, sorry).

Package uploaded, awaiting RM approval.

Changed in sysvinit:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sysvinit - 2.86.ds1-14.1ubuntu44

---------------
sysvinit (2.86.ds1-14.1ubuntu44) hardy; urgency=low

  * debian/initscripts/etc/init.d/mtab.sh: Revert previous change of cleaning
    /media/.hal-mtab, since hal does not (and cannot easily) remove mount
    point directories on shutdown, but also considers already existing mount
    points as not usable for dynamic mounts (since they potentially conflict
    with fstab). Patching hal properly is too intrusive at this point.
    (LP: #101845, LP: #95368)

 -- Martin Pitt <email address hidden> Mon, 14 Apr 2008 11:53:21 +0200

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

I'm seeing this in Intrepid, with:

kernel 2.6.27-4-generic amd64,
sysvinit-utils 2.86.ds1-59ubuntu8,
hal 0.5.11-3~ubuntu8.

Is this a regression?

Incidentally, if you leave the message box up that says 'Cannot unmount the volume...', eventually you get another message saying:

"DBus error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."

Revision history for this message
Karl Palsson (ubuntu-tweak) wrote :

Ok, I can remove the .hal-mtab, but then what? unplugging and replugging my disks isn't mounting them at all anymore. /etc/init.d/hald restart doesn't seem to help either. :(

Revision history for this message
Dylan McCall (dylanmccall) wrote :

Experiencing still in Intrepid beta, which was just upgraded from Hardy. (Hardy was also upgraded from Gutsy).

Thanks for the work so far, Martin. If this does involve config files, we'll need this to be automatically cleaned up during the upgrade process.

No unused mount points on my system in /media except cdrom and cdrom0 (which if I recall correctly behave a tad differently).
This happens for me with any disk that mounts to /media/disk.

Revision history for this message
Wesley Schwengle (wesleys) wrote :

Encountered this bug on 8.04.1:

$ umount /media/32_00_00
/sbin/umount.hal: Unmounting /media/32_00_00 failed: org.freedesktop.Hal.Device.Volume.UnknownFailure: Cannot remove directory

Removed the /media/.hal-mtab and it now works without problems.

Revision history for this message
begemot (oival) wrote :

Hardy 8.04.1 is infected for me too.

And removing the /media/.hal-mtab solves the problem just the same.

Martin Pitt (pitti)
Changed in hal:
status: In Progress → Triaged
Revision history for this message
Felipe Figueiredo (philsf) wrote :

I found this report by googling, having this problem with an up to date Hardy box. I have this issue for quite a long time, don't really remember since when.

My .hal-mtab file is attached, and moving it to .bak makes the warning disappear. The new .hal-mtab created is equal to the old one, except for the line corresponding to the other drive, and has same file and ownership permissions (755 root.root).

I see the hal section of the bug is still open, can I help test or debug anything? I didn't see any errors or warnings in dmesg, kern.log, messages, syslog, or daemon.log in /var/log.

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

GNOME in Karmic does not use hal for mounting any more, and the sysvinit workaround solved this bug sufficiently.

Changed in hal (Ubuntu):
assignee: Martin Pitt (pitti) → nobody
importance: High → Low
Revision history for this message
Max (maxmax) wrote :

Bug confirmed on a fully patched (even some backports) 10.04.4 with dolphin.

Workaround (without need for commandline):
Options "safely remove" and "eject drive" do work normally from nautilus.

Revision history for this message
dino99 (9d9) wrote :
Changed in hal (Ubuntu):
status: Triaged → Invalid
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.