[systemd-devel] Luks + lvm in initrd

Luca Bruno lethalman88 at gmail.com
Tue Oct 28 15:51:59 PDT 2014


Hi, I'm going on with my work to have systemd in initrd on NixOS (using
dracut is a little complicated at the moment).
Everything works fine, I've ported luks and lvm and both work separately.
However I'm hitting a problem when using luks and lvm on top of luks.

SETUP

Software: systemd 212, lvm 2.02.111, cryptsetup 1.6.3, kernel 3.14.22

The test is done with kvm.

I have a device /dev/vda formatted with luks which gets opened in
/dev/mapper/luksroot.
Then lvm with a vg named "vg" and an lv named "lv" so that it gets named
/dev/mapper/vg-lv.

I have a sysroot.mount What=/dev/mapper/vg-lv and requires/after the
cryptsetup service.
The cryptsetup service runs systemd-cryptsetup attach luksroot /dev/vda.

All fine, the luks gets opened correctly etc.

PROBLEM

Note I don't do any vgchange -a y, in any service, in any script.
The /dev/vda appears, and then cryptsetup service runs. Luks is unlocked,
/dev/mapper/luksroot and systemd tries to mount sysroot.mount.

This is the problem, systemd does not wait for /dev/mapper/vg-lv to appear
before mounting sysroot. In fact, it does not exist at all.
It's like luksOpen + some udev rule tell udev/systemd that the device is
there, but it's not.

Note: if I disable the cryptsetup service, sysroot.mount correctly waits
for /dev/mapper/vg-lv to appear.

So the setup is pretty simple, I've read the udev rules however they're a
little complex for my poor knowledge.
The udev rules installed are all of lvm, dm. From systemd/udev it's:
60-cdrom_id.rules
60-persistent-storage.rules
80-drivers.rules
99-systemd.rules

Any hints on where the culprit can be? Same happens with lvmetad.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141028/c541ca1f/attachment-0001.html>


More information about the systemd-devel mailing list