Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kde's "safely remove" needs full rw on device to succeed
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
iamben
Apprentice
Apprentice


Joined: 10 May 2004
Posts: 278

PostPosted: Sun Aug 12, 2007 2:53 am    Post subject: kde's "safely remove" needs full rw on device to s Reply with quote

im using kde/hal to handle mounts/unmounts of my usb storage devices, so i put my user in the plugdev group. the device shows up in system:/media just great, and when i click to browse to it, it automounts perfectly and i can read/write/delete anything i like.

however, when i right click the device and choose "safely remove", it pops up an error dialog stating "device was unmounted but could not be ejected". just to be clear, it DOES successfully unmount, so i can safely unplug it just fine, but it complains about the "eject" portion not working. its still functional but the error box EVERY time is annoying.

i looked around and finally figured out that you must have full read/write on the device node for the device (ie /dev/sde1 for my usb drive) for the 'eject' to succeed (and hence NOT give an error). i could put my users in the disk group and it works, but thats WAY more than i want to give normal users.

is this something that should be remedied? i'll probably fix mine by coming up with some udev rules to make sure my usb storage devices get root:plugdev ownership rather than root:disk, but what does everyone else think? should this be fixed in kde, hal, or udev? or am i crazy, and this shouldnt be fixed at all?
Back to top
View user's profile Send private message
ttuegel
Apprentice
Apprentice


Joined: 18 Jan 2005
Posts: 176
Location: Illinois, USA

PostPosted: Thu Aug 16, 2007 9:12 pm    Post subject: Reply with quote

When I first encountered this problem, I encountered two solutions, one on the Debian bugzilla and one on Ubuntu's (I think...). Long story short, I can't find them now, but your two options are to make a udev rule that creates usb drive devices in group "plugdev" or editing the konqueror context menu to make the eject command fail silently.

My $0.02: It should be fixed in udev, not just in Konqueror, as other programs in other environments may need to use 'eject'. Also, CDs are removable devices, and that's how they are handled.

I'm relieved to know I'm not the only one with this issue, but at the same time, an error this... glaring?... probably shouldn't have crept in in the first place...
Back to top
View user's profile Send private message
anz
Apprentice
Apprentice


Joined: 05 Feb 2003
Posts: 279
Location: Vienna

PostPosted: Fri Aug 17, 2007 11:57 pm    Post subject: Reply with quote

Dear ttuegel & iamben,
after upgrading to kde-3.5.7 I have the same "problem": choosing "safely remove" unmounts the usb device but enters an error warning "The device was successfully unmounted, but could not be ejected" (Error - kio_media_mounthelper).
dmesg shows no error.
_________________
Greetings from Vienna
Back to top
View user's profile Send private message
ttuegel
Apprentice
Apprentice


Joined: 18 Jan 2005
Posts: 176
Location: Illinois, USA

PostPosted: Sun Aug 19, 2007 3:42 pm    Post subject: Reply with quote

Alright, finally got around to writing a correct udev rule for this. Basically, this assigns any removable disk to group "plugdev" instead of "disk". Here is my /etc/udev/rules.d/50-udev.rules file before and after:

/etc/udev/rules.d/50-udev.rules Before wrote:
# disk devices
KERNEL=="sd*", NAME="%k", GROUP="disk"
KERNEL=="dasd*", NAME="%k", GROUP="disk"
KERNEL=="ataraid*", NAME="%k", GROUP="disk"


/etc/udev/rules.d/50-udev.rules After wrote:
# disk devices
KERNEL=="sd*", NAME="%k", GROUP="disk"
KERNEL=="dasd*", NAME="%k", GROUP="disk"
KERNEL=="ataraid*", NAME="%k", GROUP="disk"

# removable disks
SUBSYSTEM=="block", KERNEL=="sd*", ATTRS{removable}=="1", GROUP="plugdev"


Now everything in KDE works as expected.
Back to top
View user's profile Send private message
blubbi
Guru
Guru


Joined: 27 Apr 2003
Posts: 564
Location: Halle (Saale), Germany

PostPosted: Wed Aug 22, 2007 4:03 pm    Post subject: Reply with quote

Had the same problem here.

But I would recommend to create your own rules file, so you dont have to hasle around with updates later.

Code:
echo -e '# removable disks\nACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z][0-9]", ATTRS{removable}=="1", GROUP="plugdev"\n' >> /etc/udev/rules.d/51-local.rules


Notice, this will only work with USB Devices, or more specific, with devices which come with the "removable" attribute. ATTRS{removable}=="1"
This rule does not work with eSATA drives (at least it didn't in my case)

You could substitute ATTRS{removable}=="1" with ATTRS{model}=="YOUR MODELINFO FROM UDEVINFO" but than you need to SUBSYSTEM=="block" to SUBSYSTEM=="scsi". To be mor specifi you could add more identifyer from the section where SUBSYSTEMS=="scsi" occures

To geht the information use:
Code:
udevinfo -a -p $(udevinfo -q path -n /dev/sdX)



regards
blubbi
Back to top
View user's profile Send private message
ElSenorPantelone
n00b
n00b


Joined: 24 Jan 2006
Posts: 72

PostPosted: Wed Aug 29, 2007 5:16 pm    Post subject: Reply with quote

Thanks blubbi, good solution.
Back to top
View user's profile Send private message
wyv3rn
Apprentice
Apprentice


Joined: 18 Aug 2005
Posts: 154
Location: USA

PostPosted: Thu Aug 30, 2007 5:09 am    Post subject: Reply with quote

There is a bug report for this: https://bugs.gentoo.org/show_bug.cgi?id=186028
Back to top
View user's profile Send private message
dopey
Apprentice
Apprentice


Joined: 10 Feb 2003
Posts: 235

PostPosted: Fri Aug 31, 2007 4:51 pm    Post subject: Reply with quote

apparently my firewire disks don't appear as removable. So the udev solution doesn't work with firewire either.
Back to top
View user's profile Send private message
uncleringo
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jul 2004
Posts: 146

PostPosted: Mon Sep 03, 2007 12:12 pm    Post subject: Reply with quote

I can't unmount my kde-mounted usb keys without su'ing to root. I used to be able to, but it started to not work a few months ago. This is the first time I've properly checked the forums for this problem since it's not too much hassle to su to root and type umount. My regular user is in the plugdev group, and I've modified my udev config to make my usb key mount as root:plugdev, but i'm still unable to umount as a regular user.

Any ideas?

My usb device looks like:

Code:
brw-rw---- 1 root plugdev 8, 33 Sep  3 13:06 /dev/sdc1


I'm not sure what the 'b' is in the permissions but does group need this too?
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 518
Location: Wales, UK

PostPosted: Sat Oct 13, 2007 7:02 am    Post subject: Reply with quote

blubbi wrote:
Had the same problem here.

But I would recommend to create your own rules file, so you dont have to hasle around with updates later.

Code:
echo -e '# removable disks\nACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z][0-9]", ATTRS{removable}=="1", GROUP="plugdev"\n' >> /etc/udev/rules.d/51-local.rules




Thanks Blubbi - that fixed it for me! :D

One small question - I assume the rules are read when udev is started. What is the simplest way to get the new rules included? Would it be to:
Code:

/etc/init.d/udev-postmount restart
or
Code:

/etc/init.d/hald restart


or is it best to restart the computer (which is actually what I did)?

Thanks again!
Back to top
View user's profile Send private message
blubbi
Guru
Guru


Joined: 27 Apr 2003
Posts: 564
Location: Halle (Saale), Germany

PostPosted: Sat Oct 13, 2007 2:10 pm    Post subject: Reply with quote

udev should be notified via inotify that there were files changed and reread the new rules.

But you could run
Code:
udevcontrol reload_rules
to read the rules
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 518
Location: Wales, UK

PostPosted: Sat Oct 13, 2007 7:38 pm    Post subject: Reply with quote

blubbi wrote:

udev should be notified via inotify that there were files changed and reread the new rules.


I never thought to check! I guessed the mechanism relied on restarting the service.

blubbi wrote:

But you could run
Code:
udevcontrol reload_rules
to read the rules


I'll remember this for next time.

Thanks!
Back to top
View user's profile Send private message
Nikoli
n00b
n00b


Joined: 13 Nov 2007
Posts: 35

PostPosted: Sat Jan 26, 2008 12:25 pm    Post subject: Reply with quote

http://linuxforum.ru/index.php?showtopic=59318&view=findpost&p=581102

Changed in /usr/kde/3.5/share/apps/konqueror/servicemenus/media_safelyremove.desktop
from
Code:
Exec=kio_media_mounthelper -s %u

to
Code:
Exec=kio_media_mounthelper -u %u


Now there is no message :)
Back to top
View user's profile Send private message
blubbi
Guru
Guru


Joined: 27 Apr 2003
Posts: 564
Location: Halle (Saale), Germany

PostPosted: Sat Jan 26, 2008 1:01 pm    Post subject: Reply with quote

Options:
-u Unmount given URL
-m Mount given URL (default)
-e Eject given URL via kdeeject
-s Unmount and Eject given URL (necessary for some USB devices)


mmmh, what happens with CD/DVDs? Did out test it, are the ejected?

Ejecting a USB drive is not that wrong IMHO. If I remember, ejecting a micro disk spins it down.

regards
blubbi
_________________
-->Please add [solved] to the initial post's subject line if you feel your problem is resolved.
-->Help answer the unanswered

http://olausson.de
Back to top
View user's profile Send private message
Nikoli
n00b
n00b


Joined: 13 Nov 2007
Posts: 35

PostPosted: Sat Jan 26, 2008 1:24 pm    Post subject: Reply with quote

For ejecting CD/DVD there is another file /usr/kde/3.5/share/apps/konqueror/servicemenus/media_eject.desktop

I have no problems with CD/DVD and with usb flash.

Ejecting USB is really formal, I think it is for prevention errors with some incorrect devices.
Back to top
View user's profile Send private message
leosgb
Apprentice
Apprentice


Joined: 07 Mar 2006
Posts: 272
Location: Rio de Janeiro, Brazil

PostPosted: Tue Feb 05, 2008 4:56 am    Post subject: Reply with quote

Thanks for the tip guys! But I think that one wants to receive any error message... to disable it means to not know there is something wrong!
Back to top
View user's profile Send private message
RoundsToZero
Guru
Guru


Joined: 17 Nov 2003
Posts: 478
Location: New York, NY

PostPosted: Tue Feb 05, 2008 5:02 am    Post subject: Reply with quote

What I did was make my /usr/bin/eject setuid root but group plugdev and not executable by other (non-plugdev) users.
Code:
-rwsr-x--- 1 root plugdev 21044 2007-02-07 02:26 /usr/bin/eject
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Wed Feb 06, 2008 6:26 pm    Post subject: Reply with quote

do any of you guys have pmount installed?

Code:

Lisa ~ $ which pmount
/usr/bin/pmount


I have no problems using kde to unmount my devices, I am also in the usb and plugdev groups.

If you guys want any of my configs, just ask and I'll be glad to share.
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
jstead1
Guru
Guru


Joined: 01 Aug 2003
Posts: 427
Location: Oswego, NY where the snow is deep

PostPosted: Wed Apr 23, 2008 8:20 pm    Post subject: Reply with quote

This stopped working recently, because the group permissions for removable devices changed to read only. I added a MODE="660" to change the group permissions to read write again, so the lines in 51-local rules would be something like

Code:
# removable disks
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z][0-9]", ATTRS{removable}=="1", GROUP="plugdev", MODE="660"

_________________
jim
Back to top
View user's profile Send private message
carpman
Advocate
Advocate


Joined: 20 Jun 2002
Posts: 2202
Location: London - UK

PostPosted: Thu May 15, 2008 9:09 am    Post subject: Reply with quote

useful thread will try some suggestions
_________________
Work Station - 64bit
Gigabyte GA X48-DQ6 Core2duo E8400
8GB GSkill DDR2-1066
SATA Areca 1210 Raid
BFG OC2 8800 GTS 640mb
--------------------------------
Notebook
Samsung Q45 7100 4gb
Back to top
View user's profile Send private message
SeaTiger
l33t
l33t


Joined: 22 Nov 2007
Posts: 603
Location: Toronto, Ontario, Canada

PostPosted: Fri May 16, 2008 4:34 am    Post subject: Reply with quote

I am using gnome and don't seems to have this problem, I also have my normal account (non-root) in the following group:
Code:
cdrom
cdrw
usb
plugdev
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum