17.01.2007 11:35

gnome-mount (hal) automount usb owned root

Last days I had a hard fight with those new Fedora Linux stuff around udev, hal, gnome-mount etc. All my usb storage devices I connected to computer were mounted fine, but with incorrect owner and/or privileges. Owner was set always to root and privs to rw-r--r--, so users can not write to usb sticks, cameras etc. Counting sunday it took me about 4 days to get throught this xml configuration mist.

First I thought this is udev fault, getting through it, its not the case. Udev handles just the creation of /dev/ device and then hands over to HAL to do the magic further. Using all those

lshal --monitor

I found nothing of interest. Althought there could be different solutions throught fstab and udev I was really interested what's wrong that this is working on all my Fedora 6 installs except one. Comparing one working and one non working one I found that hal manages only allowed policies (options) in

/usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi

This is used only to limit the options to certain ones for different kinds of devices.

More important is what does HAL when it discovers andy new device. It uses gnome-mount to attach it and g-m writes it's options into

/media/.hal-mtab

bit missleading...

Finaly there is good man for gnome-mount so I found there that gnome-mount has an option -o to set owner of created device. And that worked

gnome-mount -o uid=500 -t -d /dev/sdb1

The device was mounted for user with uid 500. So I started to smell somethings bad with the options for gnome-mount. But where the hell those options are. They are not provided by HAL, definitely. Comparing the .hal-mtab for working and non working machine I found that for users owned devices there is really option uid= and one more - shortname=. Those were missing on non-working.

rw,noexec,nosuid,nodev,shortname=winnt,uid=500

This led me to changelog of HAL where I found those options were added by default, but one year ago it was removed and gnome-mount should set additional options. I was now sure this is somewhere in gnome-mount. How I found the source for gnome-mount (and most of gnome apps) is gconf. So closing... the directory

/etc/gconf/schemas

holds so called schemas. Those are configuration data for gconfd.

/etc/gconf/schemas/gnome-mount.schemas

was present, but when I open gconf-editor on working machine, I had there key "storage". Exacly

/schemas/system/storage/default_options/vfat/mount_options

but on the non working machine, this key was missing. Nearly there. Even though file with schema is present its not in gconf. How's that possible?

So now just guessing: each schema has to be registered in gconf, otherwise it's not used. I reinstalled the gnome-mount rpm that provides the gnome-mount.schemas and the key is now present in gconf.

rpm --replacepkgs -Uvh gnome-mount-0.5-2.fc6.x86_64.rpm

Looking into POSTIN script in the rpm

export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`                               
SCHEMAS="gnome-mount.schemas"                                                               
for S in $SCHEMAS; do                                                                       
  gconftool-2 --makefile-install-rule /etc/gconf/schemas/$S > /dev/null                     
done

it was probably enought to invoke gconftool-2 to registrer the schema.

Simple one...


Email comment