Unmount fails every time

Bug #85424 reported by Mikael Nilsson on 2007-02-15
10
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Undecided
Unassigned
sysvinit (Ubuntu)
Medium
Martin Pitt

Bug Description

Binary package hint: gnome-mount

Everytime I unmount an external drive (using the drivemount applet or nautilus -> right click) I get a popup saying "Failed to unmount drive". The detailed message is "Cannot remove directory". Then an additional, and *completely* empty error popup is shown. I have to click ok on both.

The unmount actually succeeds (according to mount). And the directory under /media *is* removed.

It's very annoying, but I don't know who to blame.

Mikael Nilsson (mini) wrote :
aamukahvi (aamukahvi) wrote :

The same happens here, too.

John Dong (jdong) wrote :

Confirmed to be the case on a Video IPod and a 2G Nano.... Nautilus complains about the cannot remove directory error, but after closing the error box the unmount indeed succeeds.

Changed in gnome-mount:
status: Unconfirmed → Confirmed
John Dong (jdong) wrote :

Try cleaning the HAL mtabs from /media. It fixed my problems:

sudo rm /media/.hal*

aamukahvi (aamukahvi) wrote :

Fix worked for me.

John Dong (jdong) wrote :

Somehow .hal-mtab was filled with a bunch of /dev/sdb2 /media/IPOD ........ lines -- mine had like 8 of those lines in it. I am willing to bet that these were what caused the error.

Should HAL clean up its mtabs on boot?

On sön, 2007-02-18 at 05:59 +0000, John Dong wrote:
> Try cleaning the HAL mtabs from /media. It fixed my problems:
>
> sudo rm /media/.hal*
>

Fixed it for me too, thanks.

Martin Pitt (pitti) wrote :

Hi,

John Dong [2007-02-18 15:43 -0000]:
> Should HAL clean up its mtabs on boot?

This indeed sounds like a very good idea.

 assignee pitti
 status inprogress

Changed in gnome-mount:
assignee: nobody → pitti
status: Confirmed → In Progress
assignee: pitti → nobody
status: In Progress → Confirmed
Martin Pitt (pitti) on 2007-02-19
Changed in hal:
assignee: nobody → pitti
importance: Undecided → Medium
status: Confirmed → In Progress
Martin Pitt (pitti) wrote :

This actually needs to be added to /etc/init.d/mountall-bootclean.sh, not hal's dbus init script. Otherwise a hal restart would wipe all information about currently mounted file systems.

Martin Pitt (pitti) wrote :

 sysvinit (2.86.ds1-14.1ubuntu17) feisty; urgency=low
 .
   * debian/initscripts/etc/init.d/mountall-bootclean.sh: Remove
     /media/.hal-mtab{,-lock} on boot to clean up stale hal mount information
     after crashes, etc. (LP: #85424)
   * debian/control: Set Ubuntu maintainer.

Changed in sysvinit:
status: In Progress → Fix Released

Using an up-to-date Feisty:

###############################################
# Step to reproduce the bug
###############################################

1) I plug in my camera.
2) a "Photo import" dialog pops up, I click "Ignore".
3) I browse my pics under "/media/NO NAME/" with nautilus.
4) I close nautilus.
5) I right-click on the "NO NAME" icon on the desktop and choose "Unmount volume".
6) an error dialog pops up, with title "Cannot unmount volume", message "Cannot unmount the volume 'NO NAME'", and details "Cannot remove directory".
7) At this point "ls /media" shows that there is already no such directory left, though.
8) I click ok, and I can continue as usual, no bad consequences.

###############################################
# Content of /media
###############################################

nico@aikawa:~$ ls -ltra /media/
total 48
drwx------ 3 nico root 16384 1970-01-01 01:00 NO NAME
drwxr-xr-x 7 root root 4096 2007-02-25 22:15 disk
drwxr-xr-x 2 root root 4096 2007-02-25 23:10 cdrom0
lrwxrwxrwx 1 root root 6 2007-02-25 23:10 cdrom -> cdrom0
--wxr-s--T 1 root root 0 2007-02-25 23:35 .hal-mtab-lock
drwx------ 2 root root 4096 2007-03-08 21:47 新增磁碟區
drwx------ 2 root root 4096 2007-03-09 01:07 新增磁碟區_
drwx------ 2 root root 4096 2007-03-09 01:42 新增磁碟區__
drwxr-xr-x 22 root root 4096 2007-03-16 18:21 ..
-rw-r--r-- 1 root root 534 2007-03-17 13:56 .hal-mtab
drwxr-xr-x 8 root root 4096 2007-03-17 13:56 .

nico@aikawa:~$ cat /media/.hal-mtab
/dev/sda1 1001 0 ntfs noexec,nosuid,nodev,umask=222,utf8 /media/\346\226\260\345\242\236\347\243\201\347\242\237\345\215\200
/dev/sda1 1001 0 ntfs noexec,nosuid,nodev,umask=222,utf8 /media/\346\226\260\345\242\236\347\243\201\347\242\237\345\215\200_
/dev/sda1 1001 0 ntfs noexec,nosuid,nodev,umask=222,utf8 /media/\346\226\260\345\242\236\347\243\201\347\242\237\345\215\200__
/dev/sda1 1001 0 ext3 noexec,nosuid,nodev /media/disk
/dev/sdc1 1001 0 vfat noexec,nosuid,nodev,shortname=mixed,uid=1001,utf8,umask=077,exec /media/NO NAME

###############################################
# Affected hardware
###############################################

Bug shows up with:
- digital camera Kyocera Finecam SL400R
- external hard drive Lacie Porsche 160 GB
Bug does not show up with:
- USB key unbranded 256 MB
- USB key SanDisk cruzer crossfire 4 GB

###############################################
# How I just worked around the bug
###############################################

1) sudo rm /media/.hal*
2) reboot
3) now it works well ! :-)

Cheers,
Nicolas.

hardyn (arlenn) wrote :

Same problem with sony digital camera, all of my other USB devices unmount correctly.

Dana Olson (adolson) wrote :

The "fix" does not solve the issue for me. This is still occuring. I didn't even see this bug until after I tried deleting the hal files in my rc.local file at every bootup.

There is a tiny patch that might be worth looking at to fix this problem:

http://launchpadlibrarian.net/7223911/68-fix-umount-stale-hal-mtab.patch

It was posted in bug #95368.

Id2ndR (id2ndr) wrote :

Removing /media/.hal* files worked for me.

Timmie (timmie) wrote :

Hello,
is this fix already released?

It still occours in my system: Ubuntu Gutsy.

Timmie (timmie) wrote :

Well, as described above removing the file /media/.hal-mtab does fix it.

But why is it there in first place and doesn't get deleted in Gutsy?

Justin J Stark (justinjstark) wrote :

@Tim:
I'm not the right person to answer this but I'm sure .hal-mtab is important because it lets HAL know what devices are currently mounted. It sounds like the file itself is not the problem but, rather, something is propagating .hal-mtab with repetitive lines. When the device then gets unmounted, only one of these lines gets removed from .hal-mtab. The device successfully unmounts but HAL sees the device as still mounted in .hal-mtab and hence throws an error. That's just my guess.

I could be wrong but the file should be there in Gutsy and as far as I can tell, the problem is fixed in Gutsy. Is it possible you upgraded from Feisty and the .hal-mtab that was causing problems was created by Feisty? Do you ever experience this bug again after fixing(removing) .hal-mtab?

Rocko (rockorequin) wrote :

I still get this problem in Gutsy after a suspend/resume cycle.

It appears that if the drives mount as a different device after resume (which can happen if you have more than one USB drive attached), /media/.hal-mtab contains two entries for the same drive after the resume. Eg if a drive used to be /dev/sdf1 and after resume it is /dev/sdg1, both entries then appear are in .hal-mtab, and if you try to to unmount the drive, it complains it can't remove the directory, and neither entry in .hal-mtab is deleted.

If there were already two entries in the file when you resume and the drive mounts as a different device again, you get three entries, etc.

This 'cannot unmount drive' behaviour persists indefinitely until you manually delete .hal-mtab. If you then suspend/resume it can reappear.

Rocko (rockorequin) wrote :

I just reproduced this bug in Hardy WITHOUT a suspend/resume cycle, using hal version 0.5.10-5ubuntu7.

The contents of .hal-mtab were:

/dev/sdf1 1000 0 vfat nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,exec,usefree /media/ATHENA
/dev/sdg1 1000 0 vfat nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,exec,usefree /media/ATHENA

The second entry is the correct one for ATHENA. I had just unmounted another drive (not ATHENA) mounted on /dev/sdf1 and it complained that it could not remove the directory. I guess it tried to remove the (invalid) /dev/sdf1 entry for ATHENA and failed.

apprentilinux (apprentilinux) wrote :

hello

rm /media/.hal* works for me

Wbr

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

Other bug subscribers