# ivman problem

## pieterprovoost

I'm trying to use ivman to automount my usb stick. My /etc/ivman/IvmConfigMappings.xml reads

?xml version="1.0" encoding="UTF-8"?>

<ivm:MappingsConfig version="0.1" xmlns:ivm="http://www.eikke.com/ivm">

    <!-- This is a sample mapping. It maps /dev/hdc (the device ivman gets from

         HAL) to /dev/cdroms/cdrom0, which means when a cd is inserted into

         /dev/hdc, 'mount /dev/dev.cdroms.cdrom0' would be called.  If there is

         no mapping for /dev/hdc, 'mount /dev/hdc' would be called. -->

    <!--

    <ivm:Map device="/dev/hdc" maps="/dev/cdroms/cdrom0" />

    -->

<ivm:Map device="/dev/sda" maps="/mnt/usbstick" />

</ivm:MappingsConfig>

But, when I insert my USB stick and open /mnt/usbstick, it's empty. What am I doing wrong here? I followed the insructions on http://gentoo-wiki.com/HOWTO_ivman. Mounting manually works fine.

----------

## moocha

Also follow the instructions at http://gentoo-wiki.com/HOWTO_USB_Mass_Storage_Device (the part about creating the UDEV rules) and you'll be fine  :Smile: . Have fun!

----------

## pieterprovoost

I get this:

```

tux pieter # udevinfo -a -p `udevinfo -q path -n /dev/sda`

udevinfo starts with the device the node belongs to and then walks up the

device chain, to print for every device found, all possibly useful attributes

in the udev key format.

Only attributes within one device section may be used together in one rule,

to match the device for which the node will be created.

device '/sys/block/sda' has major:minor 8:0

  looking at class device '/sys/block/sda':

    SUBSYSTEM=="block"

    SYSFS{dev}=="8:0"

    SYSFS{range}=="16"

    SYSFS{removable}=="1"

    SYSFS{size}=="253949"

    SYSFS{stat}=="       1        7        8       10        0        0        0

        0        0       10       10"

follow the "device"-link to the physical device:

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.0/usb1/1-2/                                           1-2:1.0/host0/target0:0:0/0:0:0:0':

    BUS=="scsi"

    ID=="0:0:0:0"

    DRIVER=="sd"

    SYSFS{device_blocked}=="0"

    SYSFS{iocounterbits}=="32"

    SYSFS{iodone_cnt}=="0xa"

    SYSFS{ioerr_cnt}=="0x1"

    SYSFS{iorequest_cnt}=="0xa"

    SYSFS{max_sectors}=="240"

    SYSFS{model}=="Flash Drive     "

    SYSFS{queue_depth}=="1"

    SYSFS{queue_type}=="none"

    SYSFS{rev}=="2.02"

    SYSFS{scsi_level}=="3"

    SYSFS{state}=="running"

    SYSFS{timeout}=="30"

    SYSFS{type}=="0"

    SYSFS{vendor}=="USB     "

couldn't open device directory

```

So SYSFS{serial} (which should be there according to teh HOWTO) is missing. Any suggestions?

----------

## moocha

Use the SYSFS{model} key instead of the SYSFS{serial} key (of course, in the udev rule, you'll use SYSFS{model}, not SYSFS{serial}, too). Just make sure to include the string value of that key just like udevinfo reported it, with trailing spaces and all.

----------

## pieterprovoost

I added this to /etc/udev/rules.d/10-local.rules:

BUS="usb", SYSFS{model}="Flash Drive     ", KERNEL="sd?1", NAME="%k", SYMLINK="usbstick"

But /dev/usbstick doesn't exist and /mnt/usbstick is still empty (also after reboot)...

Edit: I get "error connecting so system bus" and "failed to initialize HAL", don't know of that has anything to do with my problem.Last edited by pieterprovoost on Wed Aug 17, 2005 4:18 pm; edited 1 time in total

----------

## moocha

Are the hal and ivman init scripts started on boot? I.e., are they in the default (and possibly also in the nonetwork) runlevel?

----------

## pieterprovoost

Ok, so HAL is the problem (have a look at the last edit I made). I'm really sorry, but I really don't know what to do now...

----------

## moocha

(New post instead of edit to make sure the thread gets flagged as new)

For reference, here are the relevant parts of my setup (which works just fine):

/etc/fstab

```
/dev/usbstick   /mnt/usbstick   vfat   users,noauto,noatime,umask=000,codepage=852,iocharset=iso8859-2   0 0
```

/etc/udev/rules.d/10-local.rules

```
BUS="usb", SYSFS{serial}="30591B094047D3E8", KERNEL="sd?1", NAME="%k", SYMLINK="usbstick"
```

/usr/share/hal/fdi/95userpolicy/usermount.fdi

```
<?xml version="1.0" encoding="ISO-8859-1"?>  

<deviceinfo version="0.2"> 

    <device> 

        <merge key="storage.policy.default.mount_option.users" type="bool">true</merge> 

    </device> 

</deviceinfo>
```

/etc/hal/hald.conf

```
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- --> 

<!-- This configuration file controls the Hardware Abstraction Layer

     daemon - it is meant that OS vendors customize this file to reflect

     their desired policy.

  -->

<haldconfig>

  <!-- If true, then the device list is saved to disk such that

       properties are kept between invocations of hald.

    -->

  <persistent_device_list>false</persistent_device_list>

  <!-- Default value for storage.media_check_enabled for devices of

       capability storage - this can be overridden by .fdi files.

       Setting this to false results a whitelist policy, e.g. media

       check is only enabled for storage devices with a .fdi file

       saying so.

       Conversely, setting it to true results in a blacklist policy

       where media check is enabled by default but may be overridden

       by a .fdi for devices causing trouble. 

  -->

  <storage_media_check_enabled>true</storage_media_check_enabled>

  <!-- Default value for storage.automount_enabled_hint for devices of

       capability storage - this can be overridden by .fdi files.

    

       Setting this to false results a whitelist policy, e.g. policy

       agents should only automount storage devices with a .fdi file

       saying so.

    

       Conversely, setting it to true results in a blacklist policy

       where policy agents should always automount unless this is

       explicitly overridden by .fdi for devices causing trouble.

  -->

  <storage_automount_enabled_hint>true</storage_automount_enabled_hint>

</haldconfig>
```

The owner of /mnt/usbstick is root:users, and the permissions (when not mounted of course) are 0755. The USB stick has a single partition formatted as FAT32.

Edit: Typo, "usbstick", not "dscstick".

----------

## moocha

(Crossed posts)

Odd. Which version of the hal, dbus, and ivman packages are you running? At this end they are:

dbus-0.23.4

hal-0.4.8

ivman-0.5_pre3

Edit: Note that I didn't touch /etc/ivman/IvmConfigMappings.xml. I left it in pristine state (i.e. with only comments in it).

----------

## pieterprovoost

I wish I could answer that question... Where can I find this?

----------

## pieterprovoost

Found it:

sys-apps/dbus-0.23.4-r1 (0)

sys-apps/hal-0.4.7-r2 (0)

sys-apps/ivman-0.5_pre2 (0)

----------

## pieterprovoost

I changed the files to match yours. One difference (I think): /mnt/usbstick ownership is set to user:root group:root. Should I change this?

----------

## pieterprovoost

The problem persists. The error when booting also says "var/run/dbus/system_bus_socket: no such file or directory".

----------

## moocha

Sounds like dbus is not started by the hal init script. Try

```
/etc/init.d/ivman stop

/etc/init.d/hal stop

/etc/init.d/dbus stop

rc-update del ivman

rc-update del dbus

rc-update del hal

rc-update add dbus default nonetwork

rc-update add hal default nonetwork

rc-update add ivman default nonetwork
```

and reboot. (Technically it'd be enough to just kill -9 the daemons, just in case, and restart the services, but to be on the very safe side a reboot should be better).

Perhaps it'll cooperate then.

It just occurred to me - did you run dispatch-conf (or etc-update) after emerging the dbus/hal/ivman packages? Perhaps this is caused by outdated init scripts, or whatnot.

----------

## pieterprovoost

I don't know about etc-update. I tried the commands, but for hal I get "not found" or "no such file" and dbus could not be stopped (because of dependencies). After reboot nothing changed. I will try re-emerging hal, dbus and ivman...  Do I have to delete anything first?

Thanks

----------

## moocha

Ugh, it should be hald instead of plain hal (I missed a d). Whoops, my bad.

----------

## pieterprovoost

I know but the error is still there, even after emerging the three packages. When I try to stop dbus I get

```

tux pieter # /etc/init.d/dbus stop

 * Stopping Hardware Abstraction Layer daemon ...                         [ !! ]

 * ERROR:  problems stopping dependent services.

 *         "dbus" is still up.

```

Where can I find the boot log? Maybe that can be of any help...

Edit: this confiirms that there's something wrong with dbus: http://www.mail-archive.com/kubuntu-bugs@lists.ubuntu.com/msg00018.html . What should I do now?

----------

## moocha

 *pieterprovoost wrote:*   

> I changed the files to match yours. One difference (I think): /mnt/usbstick ownership is set to user:root group:root. Should I change this?

 Whoops, I missed this post. Nah, no need to change it (shouldn't matter).

I'm stumped for now since I can't reproduce your problem. dbus is working just fine for me, on a P4, on an Athlon XP, and on an Opteron system...

----------

## jspeybro

 *pieterprovoost wrote:*   

> The problem persists. The error when booting also says "var/run/dbus/system_bus_socket: no such file or directory".

 

I had this too when trying to start ivman, it seems the socket ivman is looking for is at a different location: /var/lib/dbus/system_bus_socket

I wasn't sure how to change that, so I just made a simlink. this made it possible for me to start ivman, but I get errors that I don't understand. But I don't want to interupt your tread. Maybe it gets solved by following your problems.

Johan[/code]

----------

## meadlin

In /etc/ivman/IvmConfigMappings.xml shouldn't

<ivm:Map device="/dev/sda" maps="/mnt/usbstick" /> 

look like...

<ivm:Map device="/dev/sda" maps="<udev version of usbstick, like /dev/usbstick>" />

It is what mine looks like, and it works fine.,

Just have an entry in fstab for <udev version of usbstick, like /dev/usbstick>  /location/to/mount ......

----------

