[systemd-devel] udev device mapper rules for early boot?

Nikolaus Rath Nikolaus at rath.org
Thu Dec 13 15:35:11 PST 2012


On 12/13/2012 08:35 AM, Andrey Borzenkov wrote:
> В Mon, 10 Dec 2012 11:03:54 -0800
> Nikolaus Rath <Nikolaus at rath.org> пишет:
>
>> Hello,
>>
>> I have created a udev rule to set the owner of a specific block device:
>>
>> SUBSYSTEM=="block",
>> ENV{DM_UUID}=="LVM-yYuoI8k05GWxZnz9BeEIwPUGGeojzF3dZZmXTYRqC051Tllj76OHdDlzYhKZUu7u",
>> OWNER="1000"
>>
>> If I disable and re-enable this logical volume with lvchange, it gets
>> created with the correct owner.
>>
>> However, when I boot the computer, the device is always owned by
>> root:disk instead.
>>
>> I checked my initrd, and the rule is present in lib/udev/rules.d as
>> 99-udev-custom.rules.
>>
>> Does anyone have a suggestion of how I could debug this further? Why is
>> my rule ignored when the volume comes up the first time?
>>
> The simplest reason would be that DM_UUID is not defined at all. It is
> set by another udev rule and may be this rule is missing, or
> prerequisites for this rule are missing ... if your initramfs supports
> launching shell, you could udev database.
Yes, I think that's the problem. Thanks! If I understand the rule files
correctly, the DM_UUID is initialized by one of the /lib/udev/*-export
programs, which are not present in my initrd.

Now, I could add the missing rule and program to the initrd, but I feel
this is really opening a can of worms, since I don't really *need* to
change the device ownership that early.

Is there some way to have udev re-run this rule once it has been started
properly by the real init? I guess turning the lv off and on again in
some init script would do the trick, but that doesn't seem much cleaner
either...


Thanks,
Nikolaus




More information about the systemd-devel mailing list