# Udev rules on boot?

## Matje

Hi,

For my KVM machines I have some LVM volumes where the OS is on. To be able to start them as a normal user I wrote a udev file to change the permissions of those volumes so that any user in the KVM group can start those machines, which works.

```
ENV{DM_LV_NAME}=="KVM-*", GROUP="kvm", MODE="0660"
```

This is placed in /etc/udev/rules.d/99-kvm-lvm.rules

When I execute udevadm trigger the permissions are correctly updated on the LVM volumes that have a name starting with KVM-

The problem is when I reboot, the permissions are not there by default, I still have to execute the trigger before they are put correctly. I have temporarily put the trigger in my local start, but that is not a nice solution. What am I missing here? What's the difference between a trigger and normal boot?

----------

## Matje

Well, apparently the trigger alone wasn't enough. While newly created LV's apparently get a symlink from /dev/<VG>/<LV> to the corresponding /dev/dm-* device (which get the correct permissions by the trigger), the ones that already exist at boot are symlinked to /dev/mapper/<VG>-<LV> which are created independent from udev by the initramfs and I can't seem to influence their permissions.

I solved it for now with this local start script but if anyone wants to chime in, feel free  :Smile: 

```
#!/bin/sh

chown root:kvm /dev/data/KVM-*

chmod 660 /dev/data/KVM-*
```

----------

## opotonil

Here is working with (/etc/udev/rules.d/99-custom.rules):

```

ENV{DM_NAME}=="vg-name", ACTION=="change", GROUP="kvm"

```

http://www.localnet.org.es/2013/05/virtualizacion-con-quick-emulator-qemu.html (spanish)

----------

