The upstream template seems to be flawed in two ways.

The file name (12-dm-permissions.rules) puts it in the udev rules too early to use environment variables (e.g.. ENV{DM_VG_NAME}).

Apparently in RHEL6 these values are set up in files named at 10 and 11 priority, but in debian they are set up in /lib/udev/rules.d/56-lvm.rules and or /lib/udev/rules.d/60-persistent-storage-lvm.rules, so to be safe I used 62-dm-permissions.rules.

Secondly the template file has the following lines:

# "add" event is processed on coldplug only!
ACTION!="add|change", GOTO="dm_end"
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end"


at the start, and

LABEL="dm_end"

at the end.

There is already a good template installed at /usr/share/doc/dmsetup/examples/udev-dm-permissions.rules including LVM examples, but there is no guidance on how to use it. I found this file after having done a lot of work

When I copied it to /etc/udev/rules.d and filled it in with appropriate values, it worked for me.

The other problem I initially thought I was encountering was when lvm is bought up in the initramfs, (e.g. root file system on lvm,) any user entered rules file in /etc/udev/rules.d/ is not copied into the initrd. However, for file systems not needed at initramfs time, this does not matter, it seems lvm sets them up correctly later in boot.

I suggest a note in /usr/share/doc/lvm2/README.Debian

"To change the permissions or ownership of a LVM device and have it persist across reboot, for example for a daemon that works directly with disk partitions, you need an appropriate udev rule. Copy /usr/share/doc/dmsetup/examples/udev-dm-permissions.rules to /etc/udev.d and modify it to mention the required ownership and permissions."

Cheers,
Alex




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to