Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 124728

Summary: gtkpod can't eject as user.
Product: Gentoo Linux Reporter: Olliver Schinagl <oliver>
Component: Current packagesAssignee: Olivier Crete (RETIRED) <tester>
Status: VERIFIED WORKSFORME    
Severity: enhancement CC: davec-gentoo, pda
Priority: High    
Version: 2006.0   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: sudo enabled ebuild
patch to let us call sudo eject
helpfull documentation
script that let's us eject via sudo

Description Olliver Schinagl 2006-03-02 18:24:57 UTC
gtkpod always calls eject as user when exiting the application (and it is in charge of mounting/unmounting the device).

Ideally we would like to add a group ipod and mount an iPod with ipod as group. However I haven't been successful in pulling this off (with udev). If I insert a rule to 'change' the group to ipod (e.g. after 50-*) I get the group as ipod, it isn't a disk device anymore.

The solution, use sudo. However you can't change that in the config. it always calls plain 'eject'.

A patch that changes this so sudo can be used to eject the ipod would be helpfull.
Comment 1 Olliver Schinagl 2006-03-02 18:28:45 UTC
Created attachment 81168 [details]
sudo enabled ebuild
Comment 2 Olliver Schinagl 2006-03-02 18:29:17 UTC
Created attachment 81169 [details, diff]
patch to let us call sudo eject
Comment 3 Olliver Schinagl 2006-03-02 18:29:59 UTC
Created attachment 81170 [details]
helpfull documentation
Comment 4 Olliver Schinagl 2006-03-02 18:30:27 UTC
Created attachment 81171 [details]
script that let's us eject via sudo
Comment 5 Olivier Crete (RETIRED) gentoo-dev 2006-03-03 06:25:14 UTC
you can use ~/.gtkpod/gtkpod.out to issue your own commands to unmount..

Or even better, use the latest gtkpod/libgpod and compile libgpod with the hal use flag and it should all be done automagically using pmount.
Comment 6 Olliver Schinagl 2006-03-03 15:32:33 UTC
I actually did use HAL with libgpod and it segfaulted, so I figured i'd stay with the old for a bit.

Anyway, the application always calls internally eject, assuming it has permissions to the iPod. Since you can't change the group of the ipod device (if you don't have it as group disk, strange things seem to happen?).

Anyway, as I mentioned, this should only be a temporary workaround until a better solution comes along. Currently, without HAL, you either have to make your ipod world writeable (.. no thanks) or put the eject in the gtkpod.out (which makes it that you have to update your ipod location on several positions, inside gtkpod, and in the script since you can't pass it an parameter.
Comment 7 Olivier Crete (RETIRED) gentoo-dev 2006-03-05 10:24:29 UTC
Do you use the gnome desktop? My new setup is to let gnome-volume-manager handle the mounting/umounting. In the properties, check the multimedia/ipod section and have gtkpod has the command. It then start gtkpod when I plug in my ipod and umounts it when stop gtkpod.
Comment 8 Olliver Schinagl 2006-03-05 12:05:36 UTC
I don't use GNOME no.

That, and mounting/umounting works like a charm, don't need gnome for that : )

You do however need to 'eject' /dev/sdX to let the ipod know it is done being in diskmode.

The only 2 ways I can think of doing this as a user is a) sudo eject /dev/sdX
b) chgrp ipod /dev/sdX*; eject /dev/sdX

now the chgrp is the cleanest idea if you ask me, however I can't get that to work with udev. If I tell it to change grp in a 10-ipod.rules script, the 50-udev.rules overwrite the group with 'disk'. If i do it as a 60-ipod.rules script the group is ipod, however the disk isn't a block device. It is now a character device with very different major minors. Obviously you can't do  anything with it (fdisk/mount etc).
Comment 9 Olliver Schinagl 2006-03-05 12:07:01 UTC
Hm, I was just trying a chgrp (after udev created it, as disk obviosuly) to ipod and tried to eject it as a user, doesn't even work. I suppose the only way then to do it is as root (via sudo or other).
Comment 10 David A. Corby 2006-06-01 22:15:40 UTC
I think the cleanest solution to this would be to fix eject. I've submitted a bug with a patch to eject that allows you to eject any device you have read-write permission to, the bug is #135229.
Comment 11 Sebastian 2008-06-01 16:06:44 UTC
Hi,

all works fine here after I put the following line into /etc/udev/rules.d/51-local.rules:

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

Obviously the user has to be in the plugev group (which he should be anyway on any HAL-enabled box).

My gtkpod.eject file:

#!/bin/bash
umount "${1}" && eject "${1}"

Kind regards
Sebastian
Comment 12 Olivier Crete (RETIRED) gentoo-dev 2009-04-26 16:13:43 UTC
official way is to use HAL
Comment 13 Olliver Schinagl 2009-04-26 21:40:46 UTC
We should close this bug either way; it's from 2006. Any information here would be only relevant for archival purposes anyway.