Bug 131540

Summary: unmount of usb sticks and cardreaders broken / eject of of mounted cds broken
Product: [Frameworks and Libraries] kio Reporter: Tobias Powalowski <t.powa>
Component: mediaAssignee: Kevin Ottens <ervin>
Status: RESOLVED WORKSFORME    
Severity: normal CC: coolo, flameeyes, mueller, rdieter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Tobias Powalowski 2006-07-30 08:56:17 UTC
Version:            (using KDE KDE 3.5.4)
Installed from:    Compiled From Sources
Compiler:          gcc 4.1.1 
OS:                Linux

> - hal version you use
0.5.7
> - which device you try to umount
well a simple usb stick, card reader also doesn't work at all to unmount
cd/dvd unmount works, only eject in mounted state fails.
> - does kdeeject work?
kdeeject doesn't work on mounted cd/dvd devices, if they are not mounted it works
> - how do you try to unmount?
well you can try it in media:/ kioslave or using the kicker applet both just don't do anything, no error reported but device stays mounted.
unmounting by hand using, pumount or umount works fine
> - what does lshal --monitor say when you try to unmount?
ejecting cd doesn't say anything, noting reported on eject.
same happens with safe remove on usbstick or card reader nothing is reported 
on lshal --monitor.

On packager ML gentoo seems to have the same problem and 
if you nee more information, just tell me,
greetings
Tobias Powalowski
Archlinux Package Maintainer
Comment 1 Tobias Powalowski 2006-07-30 12:38:53 UTC
thanks for the hint with kio_mounthelp program
trying as root everything works fine,

though it seems to be permission related, i could post some straces to the 
bugreport, don't know if it would help. our kio_mounthelp is stripped and 
compiled with debug disabled.

my user has rw permissions on usbstick and cd/dvd drives so this shouldn't be 
the problem.
any idea why root is neede to do those unmount tasks?
thanks
Comment 2 Tobias Powalowski 2006-07-30 13:25:25 UTC
hmm seems, coolo who did the patches, rund hal with --retain-privileges, which means it's run as root. so please fix the behaviour that also distros that don't run hal as root can use the hal stuff.
Comment 3 Tobias Powalowski 2006-07-30 13:39:43 UTC
we found a workaround:
--- kdeeject snip
    *)
      pumount $1 >/dev/null 2>&1
      eject $1 >/dev/null 2>&1
      ;;
-- kdeeject snap
add this in kdeeject and it works again on archlinux
perhaps you know a better way how to fix this.
Comment 4 Diego Elio Pettenò 2006-07-30 13:47:36 UTC
This explain why unieject worked the problem around: when correctly configured it uses pumount itself. Also Gentoo has HAL running as non-root user, so this is important for us too.

Comment 5 Kevin Ottens 2006-07-30 18:44:07 UTC
I'd need more input:
1) does "dbus-monitor --system" says something while you try to unmount?
2) could you verify that the hal-system-storage* scripts are correctly installed?
Comment 6 Stephan Kulow 2006-07-30 21:34:06 UTC
Hmm, I'm suprised. If I start hald without --retrain-permissions I don't see _any_ of my sda partions so media:/ is empty. So I'm afraid we need to disable HAL support in media for that case.

But then again I don't see a difference in HAL properties to find out about that situation. The only noticable difference is that all bios settings are missing if started as non-root - but I guess that can happen on bogus bioses as well.
Comment 7 Kevin Ottens 2006-07-30 21:44:59 UTC
I'll recheck against the latest SVN, but here I'm working without the --retain-privileges option... so I'm really surprised.
Comment 8 Tobias Powalowski 2006-07-31 17:07:54 UTC
the packages are correct installed, dbus-monitor --system doesn't show anything as lshal didn'T show anything.
our hal maintainer told me that your code calls kdeeject.
kdeeject only tries to execute 'eject yourdevice' this fails because fstab is not modified by our hal setup.
the workaround with adding pumount to kdeeject works, don't know if this is the final solution for the problem, it's your code and you should understand why it doesn't work on a simple plain/notpatched hal 0.5.7 installation.
as i stated before 3.5.3 doesn't show that behaviour and works just fine.

gnome-volume-manager and gnome-vfs work correctly too and show partitions without problems.
Our setup spawns a specific thing to scan for partitions as root AFAIK 
root      2270  0.0  0.0  1780  608 ?        S    08:05  0:00 /usr/libexec/hald-addon-storage
Comment 9 Kevin Ottens 2006-07-31 19:15:19 UTC
SVN commit 568272 by ervin:

Adding a comment in kdeeject for curious people...
It seems that it's a bug in 'eject' itself introduced between 2.0.13
and 2.1.x. Using 2.0.x or 2.1.5 it works as expected.

CCBUG:131540


 M  +3 -0      kdeeject  


--- branches/KDE/3.5/kdebase/kdeeject/kdeeject #568271:568272
@@ -22,6 +22,9 @@
       cdcontrol -f $dev eject >/dev/null 2>&1
       ;;
     *)
+      # Warning, it has to be either eject 2.0.x or >=2.1.5
+      # Otherwise it doesn't work as expected (it requires a
+      # fstab entry for no reason).
       eject $1 >/dev/null 2>&1
       ;;
   esac
Comment 10 Tobias Powalowski 2006-07-31 19:30:41 UTC
issue solved, upgrade to eject 2.1.5 or stay with 2.0.13