Re: [SLUG] Debian Lenny HAL Config

2010-04-23 Thread Chris Perry

Hello Rodolfo,
That works!

After reading some documentation, I have found that pluralisation of 
anything means that the search looks for matches further up the tree.  
The match does not have to be on the local node.  So ATTR matches this 
node and ATTRS matches up the tree.  Same for DEVICE and DEVICES.


Your description of the relationship between HAL and UDEV makes sense.

A small issue I have now is that when I remove and reinsert the TOSHIBA 
device, df reports the file system is mounted twice.  It's still usable 
though.


When the device is removed, it does cause /dev/toshiba1 and 
/mnt/toshiba1to be removed, thus leaving /mnt/thoshiba1 high and dry.


It seems there needs to be a remove event triggered to perform the umount.

Thanks and regards,
Chris.

Rodolfo Martínez wrote:

Hi Chris,

As with almost any other software, developers will ask you to test the
latest version. I think HAL reads the gconf configuration correctly
since 5.14. Anyway, don't spend too much time with HAL; it is
deprecated.


udev is a device manager. It creates the files (device nodes) in the
/dev/ directory and doesn't care what you do with the device. For
example, it creates the /dev/sdb* devices and that's it. With udev you
can setup the permission for the *device node*, but you cannot specify
how to mount the device.

hal is intermediate/extra layer between the physical devices (/dev/*)
and the applications that allows the applications to use the hardware
without knowing anything about the physical device.


This is how I would achieve what you want to do:
1. Create a udev rule to rename the block device.
2. Specify the mount options in the /etc/fstab using the new device name.


1. The udev rule:
Create the file /etc/udev/rules.d/99-usb.rules with the following lines:
KERNEL==sd?, BUS==usb, ATTRS{serial}==0220787042A168B4, NAME=toshiba
KERNEL==sd?1, BUS==usb, ATTRS{serial}==0220787042A168B4, NAME=toshiba1


2. The mount options:
Add the following line to the /etc/fstab file
/dev/toshiba1  /mnt/toshiba1  vfat
defaults,user,noauto,uid=1000,gid=1004,noatime  0 0

and create the directory /mnt/thoshiba1

From now on, it doesn't matter who mounts the device, it will be
mounted under /mnt/toshiba1 with the desired options.

  

BTW, what/why is there a difference between SUBSYSTEM and SUBSYSTEMS?




SUBSYSTEMS is plural :P

Not sure, I have never used SUBSYSTEMS.
[rmt...@amartir01 ~]$ grep SUBSYSTEMS /etc/udev/rules.d/*
[rmt...@amartir01 ~]$

Rodolfo Martínez
  


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Debian Lenny HAL Config

2010-04-23 Thread Rodolfo Martínez
Hi Chris,

I am glad I could help.

How do you remove the device? Do you unmount it and then physically
remove it? or just physically remove it?

If you only remove it, how would the OS know that you were going to
remove it? You have to unmount it first, specially if you wrote or
deleted files/dirs.


Regards
--
Rodolfo Martínez
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Debian Lenny HAL Config

2010-04-19 Thread Rodolfo Martínez
Hi Chris,

As with almost any other software, developers will ask you to test the
latest version. I think HAL reads the gconf configuration correctly
since 5.14. Anyway, don't spend too much time with HAL; it is
deprecated.


udev is a device manager. It creates the files (device nodes) in the
/dev/ directory and doesn't care what you do with the device. For
example, it creates the /dev/sdb* devices and that's it. With udev you
can setup the permission for the *device node*, but you cannot specify
how to mount the device.

hal is intermediate/extra layer between the physical devices (/dev/*)
and the applications that allows the applications to use the hardware
without knowing anything about the physical device.


This is how I would achieve what you want to do:
1. Create a udev rule to rename the block device.
2. Specify the mount options in the /etc/fstab using the new device name.


1. The udev rule:
Create the file /etc/udev/rules.d/99-usb.rules with the following lines:
KERNEL==sd?, BUS==usb, ATTRS{serial}==0220787042A168B4, NAME=toshiba
KERNEL==sd?1, BUS==usb, ATTRS{serial}==0220787042A168B4, NAME=toshiba1


2. The mount options:
Add the following line to the /etc/fstab file
/dev/toshiba1  /mnt/toshiba1  vfat
defaults,user,noauto,uid=1000,gid=1004,noatime  0 0

and create the directory /mnt/thoshiba1

From now on, it doesn't matter who mounts the device, it will be
mounted under /mnt/toshiba1 with the desired options.


 BTW, what/why is there a difference between SUBSYSTEM and SUBSYSTEMS?


SUBSYSTEMS is plural :P

Not sure, I have never used SUBSYSTEMS.
[rmt...@amartir01 ~]$ grep SUBSYSTEMS /etc/udev/rules.d/*
[rmt...@amartir01 ~]$

Rodolfo Martínez
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Debian Lenny HAL Config

2010-04-17 Thread Chris Perry

Rodolfo,
This did the trick.  You would not believe how close I was to working 
this out before.  I was just missing the =.  Oh well.


The hal version:
peterpan:/etc/hal/fdi/policy# hald --version
HAL package version: 0.5.11

I guess the problem I am experiencing is a bug on the package.  Are you 
a good person to take this information to the appropriate Team?


I have spent some time attempting to figure out the relationship between 
udev and hal.  It seems that udev gets things first and passes a result 
to hal.  Right?  I say this because the last udev rule says:

RUN+=socket:/org/freedesktop/hal/udev_event
It also seems to me that udev sets the group permissions for the mount 
command, but the config in gconf (as used by hal) was blanking it out.  
If this is right I must say I had lots of trouble working it out because 
I cannot figure how to insert and use debug statements to check things, 
or where low level logging might go.


If you could assist with a udev rule to permanently mount a usb card for 
my user, I would really appreciate it.  As I said I have made a few 
tentative additions to existing rules and observed no discernible change 
in system behavior.  I'm looking at:

http://reactivated.net/writing_udev_rules.html

Relevant output from udevinfo -a -p $(udevinfo -q path -n /dev/sdc1)
 looking at parent device '/devices/pci:00/:00:02.1/usb2/2-6':
   KERNELS==2-6   
   SUBSYSTEMS==usb

   DRIVERS==usb   ===
   ATTRS{configuration}==
   ATTRS{bNumInterfaces}== 1
   ATTRS{bConfigurationValue}==1
   ATTRS{bmAttributes}==80
   ATTRS{bMaxPower}==200mA
   ATTRS{urbnum}==370236
   ATTRS{idVendor}==0930  ==
   ATTRS{idProduct}==6545 ==
   ATTRS{bcdDevice}==0110
   ATTRS{bDeviceClass}==00
   ATTRS{bDeviceSubClass}==00
   ATTRS{bDeviceProtocol}==00
   ATTRS{bNumConfigurations}==1
   ATTRS{bMaxPacketSize0}==64
   ATTRS{speed}==480
   ATTRS{busnum}==2
   ATTRS{devnum}==28
   ATTRS{version}== 2.00
   ATTRS{maxchild}==0
   ATTRS{quirks}==0x0
   ATTRS{authorized}==1
   ATTRS{manufacturer}==TOSHIBA   ===
   ATTRS{product}==TransMemory===
   ATTRS{serial}==0220787042A168B4

BTW, what/why is there a difference between SUBSYSTEM and SUBSYSTEMS?

Regards,
Chris

Rodolfo Martínez wrote:

Hi Chris,

The line should be:

append key=volume.mount.valid_options type=strlistgid=/append

Note the '=' after 'gid'. The '=' means that HAL accept any value for that key.

And the gconf mount options should include  'gid=1004'.

  

On a related but different topic, how do I force hal to always mount the usb
card as me (chris).  I am not the only user on the console, I have to play
round robin and a game of chance for the card to be mounted under my uid.



The only solution for this is to specify the mount options (uid, gid,
etc.) in /etc/fstab. HAL will search for an entry that matches the
device that will be mounted, if none matches, it will mount the device
using the default values/options. The default is to mount the device
on behalf of the user that invoked the mount petition.

The problem is that the device block won't be always the same, it
could be /dev/sdc1, /dev/sdd1 and so on, but this can be easy
addressed with a udev rule, let me know if you need help with this.

BTW, what version of HAL are you using?


--
Rodolfo Martínez
  


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Debian Lenny HAL Config

2010-04-16 Thread Rodolfo Martínez
Hi Chris,

The line should be:

append key=volume.mount.valid_options type=strlistgid=/append

Note the '=' after 'gid'. The '=' means that HAL accept any value for that key.

And the gconf mount options should include  'gid=1004'.

 On a related but different topic, how do I force hal to always mount the usb
 card as me (chris).  I am not the only user on the console, I have to play
 round robin and a game of chance for the card to be mounted under my uid.

The only solution for this is to specify the mount options (uid, gid,
etc.) in /etc/fstab. HAL will search for an entry that matches the
device that will be mounted, if none matches, it will mount the device
using the default values/options. The default is to mount the device
on behalf of the user that invoked the mount petition.

The problem is that the device block won't be always the same, it
could be /dev/sdc1, /dev/sdd1 and so on, but this can be easy
addressed with a udev rule, let me know if you need help with this.

BTW, what version of HAL are you using?


--
Rodolfo Martínez
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Debian Lenny HAL Config

2010-04-14 Thread Chris Perry

Hello Rodolfo,
Replied earlier, but its gone somewhere.  I looked at the doco.  Thanks 
for the reference. Did you update it just for me? [Thanks.]
I used the doco to add a local rule for accepting guids in the mount 
command, as configured via gconf.  A mount controlled by goconf now 
accepts a guid where as it did not before (I had already tried to fiddle 
with gconf).  But, the group is still set to root after the mount.

gconf mount options for vfat now are:
[shortname=mixed,uid=,gid=]
In user-options.fdi I have:
   match key=volume.fsusage string=filesystem
 match key=volume.fstype string=vfat
   append key=volume.mount.valid_options 
type=strlistusefree/append

   append key=volume.mount.valid_options type=strlistgid/append
 /match
   /match

On a related but different topic, how do I force hal to always mount the 
usb card as me (chris).  I am not the only user on the console, I have 
to play round robin and a game of chance for the card to be mounted 
under my uid.


Thanks and regards,
Chris.

Rodolfo Martínez wrote:

Hi Chris,

The Changing default mount options section at
http://www.linuxfromscratch.org/blfs/view/cvs/general/hal.html may
help.


--
Rodolfo Martínez



On Mon, Apr 12, 2010 at 6:39 AM, Chris Perry chris42pe...@gmail.com wrote:
  

Hello,
I have used Debian for over a decade and can work most things out.  But I
have a problem.
I use a usb memory card to take a rsync backup of my most important files
every day.  This used to work perfectly.

I recently upgraded from etch to lenny.  After ironing out some wrinkles I
am left with one insoluble problem:

The usb memory card is always auto mounted with group ownership of root at
the mount point.  This stops me from refreshing the cards contents.

In etch ownership after auomount would be chris:perry  This is as expected
and worked fine.
In lenny ownership after automount is chris:root  This is the problem.

My primary group is still perry, btw.

I have googled and searched far and wide, I cannot find posts that describe
adequately how hal and then udev get themselves sorted and apply some action
to perform the mount.  I cannot work out where the action is defined in the
system config.  I cannot work anything out, I've not been so stumped in a
long time.

I have determined the following work-around to use after automount has
completed:
umount /media/TOSHIBA
mkdir /media/TOSHIBA
mount -t vfat -o
rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=1000,gid=1004 /dev/sdc1
/media/TOSHIBA

I am not able to determine the output of mount for the same device in etch.
 My backup etch partition has passed on.

If someone can point me at the right doco, or desribe how this works, I
would appreciate it.
Thanks and regards,
Chris.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html




--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Debian Lenny HAL Config

2010-04-12 Thread Rodolfo Martínez
Hi Chris,

The Changing default mount options section at
http://www.linuxfromscratch.org/blfs/view/cvs/general/hal.html may
help.


--
Rodolfo Martínez



On Mon, Apr 12, 2010 at 6:39 AM, Chris Perry chris42pe...@gmail.com wrote:
 Hello,
 I have used Debian for over a decade and can work most things out.  But I
 have a problem.
 I use a usb memory card to take a rsync backup of my most important files
 every day.  This used to work perfectly.

 I recently upgraded from etch to lenny.  After ironing out some wrinkles I
 am left with one insoluble problem:

 The usb memory card is always auto mounted with group ownership of root at
 the mount point.  This stops me from refreshing the cards contents.

 In etch ownership after auomount would be chris:perry  This is as expected
 and worked fine.
 In lenny ownership after automount is chris:root  This is the problem.

 My primary group is still perry, btw.

 I have googled and searched far and wide, I cannot find posts that describe
 adequately how hal and then udev get themselves sorted and apply some action
 to perform the mount.  I cannot work out where the action is defined in the
 system config.  I cannot work anything out, I've not been so stumped in a
 long time.

 I have determined the following work-around to use after automount has
 completed:
 umount /media/TOSHIBA
 mkdir /media/TOSHIBA
 mount -t vfat -o
 rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=1000,gid=1004 /dev/sdc1
 /media/TOSHIBA

 I am not able to determine the output of mount for the same device in etch.
  My backup etch partition has passed on.

 If someone can point me at the right doco, or desribe how this works, I
 would appreciate it.
 Thanks and regards,
 Chris.
 --
 SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
 Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html