Re: [systemd-devel] Luks + lvm in initrd

2014-12-04 Thread Lennart Poettering
On Tue, 28.10.14 23:51, Luca Bruno (lethalma...@gmail.com) wrote:

 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.

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

The systemd develeopers generally don't really know LVM. LVM does
weird things with udev rules, and we cannot really help with that I
fear. Please ask the LVM folks for help.

In general much of the problems with LVM stem from the fact that they
their udev support is optional, and you need to enable it both in the
initrd and the host to work correctly.

But anyway, I am sorry, but I doubt many people on systemd-devel will
be able to help you.

Sorry,

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Luks + lvm in initrd, tracking the issue

2014-10-31 Thread Luca Bruno
I've tracked down the issue a little.

sysroot.mount requires/after dev-vg-lv.device.

System start, dev-vg-lv is inactive.
vgchange -a y - dev-vg-lv active.
vgchange -a n - dev-vg-lv inactive.
At this point, unit-job of dev-vg-lv is NULL (sometimes also happens when
I don't run vgchange, but I still haven't been able to reproduce it).

When sysroot.mount is started, job_is_runnable[1] checks for AFTER
dependencies that have a non-NULL -job currently running. But dev-vg-lv is
inactive, thus sysroot.mount fails to start.

That also means the REQUIRES dependency of sysroot.mount to dev-vg-lv did
not trigger the start the dev-vg-lv.device.

Resuming: dev-vg-lv.device is inactive and has no job running, it's
required/after yet it's not started when sysroot.mount is started.

I have no deep knowledge of systemd internals to propose anything so I'd
appreciate some feedback :)

Best regards,

[1] http://lxr.devzen.net/source/xref/systemd/src/core/job.c#429
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Luks + lvm in initrd, complete scenario

2014-10-31 Thread Luca Bruno
Sorry for the spam. Further tracking down the issue. I think I've come to a
conclusion of the scenario:

S1.service requires/after D.device and S2.service
S1 is activating, thus starts D and S2
S2 starts, which activates D and deactivates D
A can now start because D has no job running [1], but D is not there
anymore.

Will try to create a couple of services to reproduce the problem.

Best regards,

[1] http://lxr.devzen.net/source/xref/systemd/src/core/job.c#429
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Luks + lvm in initrd

2014-10-28 Thread Luca Bruno
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,
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel