halevt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Halevt-dev] Using halevt to replace ivman


From: Patrice Dumas
Subject: Re: [Halevt-dev] Using halevt to replace ivman
Date: Fri, 3 Jul 2009 17:02:13 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Fri, Jul 03, 2009 at 09:58:52AM -0400, Adrian Mariano wrote:
> 
> I'm on Debian testing, and have installed the debian package version
> of halevt.  I had to add an entry to /etc/PolicyKit/PolicyKit.conf to
> enable mounting to work.  After doing this, I found that when I insert
> a memory stick, it appears as /media/disk owned by root and with read only
> permission (well, 775). 

Do you start halevt as a system-wide service, or as user?

> Subsequently typing "halevt-umount /media/disk" has no effect.  (No
> error message, no effect.)  

If run as a system-wide service, it is normal that as a user, it has 
no effect, and that there is no error message, since halevt-mount 
didn't register the device as being handled as a user.

> Running that command as root unmounts the
> device.  Am I now requird to run "halevt-mount -s"?  

I don't think so. In general, when it is not run, it isn't really
problematic, there can be stale entries in the .halevt-mount/......
file but they won't be used anyway.

> A look in the halevt.xml config file reveals this 
> 
> <halevt:Device match="hal.block.device &amp; hal.block.is_volume = true &amp; 
> (hal.volume.policy.should_mount = true | ((! hal.volume.policy.should_mount = 
> false) &amp; (hal.block.storage_device.hal.storage.policy.should_mount = true 
> | ((! hal.block.storage_device.hal.storage.policy.should_mount = false)  
> &amp; (hal.block.storage_device.hal.storage.hotpluggable = true | 
> hal.block.storage_device.hal.storage.removable = true)))))">
>    <halevt:Insertion exec="halevt-mount -u $hal.udi$ -o sync -m 002"/>
> </halevt:Device>
> 
> 
> It would appear that the mode is not chosen appropriately in this
> default configuration.  "-m 000" would seem to be the correct choice.  

There is no choice that is correct for 100% of the cases. When I mount
an ext2 filesystem from a removable device I expect the permissions to
be preserved. It could be possible to make a special case for FAT/ext2,
but then, I think that it becomes a bit too complicated for the default 
case, and I also think that it is up to the distribution/user to make 
the changes depending on the targeted use case.

It is certainly something that I took from ivman, since the comment
still refered to pmount.

In CVS, an entity is used for mountable devices, it can help a 
lot writing readable match.

> I also notice that the sync option is given.  From the mount man page:
> 
>        sync   All I/O to the file system should be done synchronously. In case
>               of  media  with  limited number of write cycles (e.g. some flash
>               drives) "sync" may cause life-cycle shortening.
> 
> I'd rather not have life cycle shortening of my flash devices.  Is
> this really a good default?  

That's not an easy issue. I choosed to have the sync option as a default, 
because mounting is done automatically and there is no UI to do the 
unmount. So there is a severe risk of data corruption in case the mount is
async and the removable device is removed. However the life-cycle 
shortening, and also the performance would tend to mount async.

I have no definitive answer for that. I added a comment on that in the
default conf file.

> A second observation is that if a device has an entry in the fstab
> file then it appears to prevent that device from being mounted.  
> 
> With ivman, I had the following entry in my fstab file:
> 
> /dev/disk/by-id/usb-Sony_Card_R_W_-CF_50000007C7FA-0:0-part1  
> /media/flashcard   msdos   rw,user,noauto,dmask=0000,fmask=0111 0 0
> 
> and ivman (well, pmount, I guess) would use this entry when it mounted
> the device.  With halevt, the device does not get mounted at all,
> anywhere (that I can find) when I insert it.  If I comment out this
> entry, *then* the device gets mounted as /media/disk.  Why do I get
> this behavior?

First of all you can use pmount instead of halevt-mount when mounting 
devices. Maybe it is better than halevt-mount when doing system-wide 
mounts.

As to why you get this behaviour, I have no idea. To debug that, you 
could try to use directly halevt-mount on the command line, maybe 
it will be more verbose, when invoked by halevt some information may be
lost.

Also, maybe it is because halevt is not run as root, but as another user
(maybe the halevt user) and there is a permission issue?

> How can I add control for particular devices with halevt?  I suppose I
> can somehow detect this in the halevt.xml file.  Any examples of how
> to do it?  What would I do to replace the above entry?  

I think that you could plug the device, do a lshal and search for the 
usb-Sony_Card_R_W_-CF_50000007C7FA-0:0-part1 string, and add it in the 
match part of the entry, like 

... &amp hal.some.string = usb-Sony_Card_R_W_-CF_50000007C7FA-0:0-part1"

--
Pat




reply via email to

[Prev in Thread] Current Thread [Next in Thread]