Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 270418 - hal grants permissions to mount/use/unmount a device, but not to eject it
Summary: hal grants permissions to mount/use/unmount a device, but not to eject it
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Daniel Gryniewicz (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-19 12:03 UTC by Ernst Bachmann
Modified: 2009-11-24 22:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ernst Bachmann 2009-05-19 12:03:35 UTC
My Nokia N95 cellphone can act as a USB-Storage device for filetransfer, but, like the iPod, requires an "eject" to be happy about unplugging it.
Basically, it should be enough to tell hal about this, e.g. by adding an section to 10-usb-music-players.fdi (from app-misc/hal-info) and doing a "<merge key="storage.requires_eject" type="bool">true</merge>" for the right device.
That part works as expected, "lshal" shows that key correctly.
however, the automatic eject fails, because the /usr/bin/eject command doesn't have permissions on the device (the device nodes are root:disk, o+rw,g+r).
When using solid to unmount, eject shows an error message:

> solid-hardware unmount '/org/freedesktop/Hal/devices/volume_uuid_4D4D_D15B'
/usr/bin/eject: kann `/dev/sdi1' nicht öffnen 
(eject: cannot open /dev/sdi1)


Reproducible: Always

Steps to Reproduce:
1. Plugin the N95 (or an iPod, should be behaving similar)
2. Mount/use/Umount

Actual Results:  
The phone doesn't tell you thats its now OK to unplug the cable.
You have to open a root shell, find the right device node, and issue an eject on the device.

Expected Results:  
hal/pmount/solid automagically doing "the right thing", and issue an eject on the device.


Diff against the /usr/share/hal/fdi/information/10freedesktop/10-usb-music-players.fdi from app-misc/hal-info-20090414 to add "storage.requires_eject":
--------------------
86,91d85
<
<           <!-- Nokia N95 MSD -->
<           <match key="@storage.originating_device:usb.product_id" int="0x4ed">
<             <merge key="storage.requires_eject" type="bool">true</merge>
<           </match>
---------------------
Note that this patch is only good for testing, since the same should probably applied to all Nokia-Series60(3rd-edition?) Devices in Mass-Storage-Mode.


--- cut --- 
Versions of different packages involved here:
app-misc/hal-info-20090414
sys-apps/hal-0.5.11-r8
sys-apps/eject-2.1.5-r1
sys-apps/pmount-0.9.16
kde-base/solid-hardware-4.2.3


emerge --info:
Portage 2.2_rc28 (default/linux/amd64/2008.0/desktop, gcc-4.3.2, glibc-2.8_p20080602-r1, 2.6.28-gentoo-xbc x86_64)
=================================================================                                                 
System uname: Linux-2.6.28-gentoo-xbc-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4200+-with-glibc2.2.5       
Timestamp of tree: Tue, 19 May 2009 10:15:01 +0000                                                                
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]                              
ccache version 2.4 [disabled]                                                                                     
app-shells/bash:     3.2_p39                                                                                      
dev-java/java-config: 1.3.7-r1, 2.1.7                                                                             
dev-lang/python:     2.5.4-r2                                                                                     
dev-python/pycrypto: 2.0.1-r8                                                                                     
dev-util/ccache:     2.4-r7                                                                                       
dev-util/cmake:      2.6.4                                                                                        
sys-apps/baselayout: 1.12.11.1                                                                                    
sys-apps/sandbox:    1.6-r2                                                                                       
sys-devel/autoconf:  2.13, 2.63                                                                                   
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2                                            
sys-devel/binutils:  2.18-r3                                                                                      
sys-devel/gcc-config: 1.4.1                                                                                       
sys-devel/libtool:   1.5.26                                                                                       
virtual/os-headers:  2.6.27-r2                                                                                    
ACCEPT_KEYWORDS="amd64"                                                                                           
CBUILD="x86_64-pc-linux-gnu"                                                                                      
CFLAGS="-march=k8 -mtune=athlon64 -O2 -pipe"                                                                      
CHOST="x86_64-pc-linux-gnu"                                                                                       
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib64/fax /usr/share/config /var/lib/hsqldb /var/spool/fax/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"                                                                                                                    
CXXFLAGS="-march=k8 -mtune=athlon64 -O2 -pipe"                                                                                                                    
DISTDIR="/usr/portage/distfiles"                                                                                                                                  
EMERGE_DEFAULT_OPTS="--with-bdeps y"
FEATURES="collision-protect distlocks fixpackages parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://de-mirror.org/distro/gentoo/ ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo"
LDFLAGS="-Wl,-O1"
LINGUAS="de en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/local/layman/kde-testing /usr/local/portage/local/layman/voip /usr/local/portage/local/layman/vmware /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac aalib acl acpi akode alsa amarok amd64 ao audiofile automount bash-completion berkdb bluetooth branding bzip2 cairo cddb cdparanoia cdr clamav cli consolekit cracklib crypt css cups curl dbus dga divx dmx dri dts dv dvb dvd dvdr dvdread emboss emerald encode evo exif expat fam fbcon ffmpeg firefox flac flash fontconfig gcj gcl gd gdbm gif glib glitz glut gmedia gmp gpac gphoto2 gpm graphviz gs gstreamer gtk hal iconv idn ieee1394 imagemagick imlib inotify ipv6 isdnlog java javascript joystick jpeg jpeg2k kde kdeenablefinal kpathsea lame latex lcd lcms libcaca libnotify libsamplerate lirc lm_sensors logrotate lzma mad midi mikmod mmap mmx mmxext mng motif mp3 mp4 mpeg mplayer mudflap multilib musepack musicbrainz mysql ncurses network network-cron newspr nls nodrm nptl nptlonly nvidia odbc offensive ogg openal openexr opengl openmp pam pango pcre pdf perl plasma png postgres postscript ppds pppd python qt3 qt3support qt4 quicktime readline realmedia reflection ruby samba scanner sdl session slang slp smp sndfile speex spell spl sqlite sqlite3 sse sse2 ssl startup-notification svg svgz sysfs tcl tcltk tcpd tetex theora threads threadsafe tiff timidity tk truetype unicode usb v4l v4l2 vcd vdpau vorbis webkit wmf wmp xcb xcomposite xface xine xinerama xml xmp xorg xosd xpm xulrunner xv xvid xvmc zip zlib zvbi" ALSA_CARDS="ac97 intel8x0 ck807" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" DVB_CARDS="dibusb-usb1 dibusb-usb2 usb-a800 usb-dtt200u usb-wt220u" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse joystick" KERNEL="linux" LCD_DEVICES="usbhub X ncurses lcd2usb" LINGUAS="de en" LIRC_DEVICES="serial" USERLAND="GNU" VIDEO_CARDS="nvidia nv vesa"
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


emerge --info
Comment 1 Daniel Gryniewicz (RETIRED) gentoo-dev 2009-05-28 14:51:35 UTC
(sorry for the delay, I was on vacation)

I've tested this, and I can eject fine using gnome-mount, which should be the equivalent of solid-hardware, without being in the disk group.  The reason is that haldaemon is in the disk group, and it's what invokes /usr/bin/eject.

Is haldaemon in the disk group on your system?
Comment 2 Ernst Bachmann 2009-05-28 15:32:57 UTC
Lets see:

# id haldaemon
uid=102(haldaemon) gid=411(haldaemon) groups=411(haldaemon),6(disk),11(floppy),19(cdrom),80(cdrw),85(usb),409(plugdev)


So Haldaemon is in the disk group. But it looks like eject isn't called by hal on my system. For one, I see the eject message on the console I used to invoke "solid-hardware unmount", and not somewhere in the system log. And my "/usr/share/hal/fdi" files only contain references to "/usr/libexec/hal-storage-eject" being used to eject.
I'll try if I can get some usefull informations out of hald by setting HALD_VERBOSE="yes" in /etc/conf.d/hald.

Comment 3 Daniel Gryniewicz (RETIRED) gentoo-dev 2009-05-29 17:55:16 UTC
hal-storage-eject actually invokes eject, and prints it's stderr to stderr if it fails.  hal-storage-eject should, I believe, be invoked by hald, and the client should send dbus messages; if solid-hardware is directly calling hal-storage-eject, that's probably wrong.

gnome-mount, for example, calls org.freedesktop.Hal.Device.Volume.Eject via DBUS (assuming the volume is *not* in /etc/fstab; if it is, it executes eject directly).

I guess that's something to check: is the mount point in question listed in fstab?
Comment 4 Ernst Bachmann 2009-11-24 22:11:55 UTC
The bug was marked as fixed upstream:
https://bugs.kde.org/show_bug.cgi?id=169060#c7
I will check if it behaves better once a fixed version is released.