[linux-lvm] [PATCH] Detect systemd at run-time in 69-dm-lvm-metad.rules

Zdenek Kabelac zkabelac at redhat.com
Wed Jul 31 09:21:10 UTC 2019

Dne 30. 07. 19 v 17:12 Julian Andres Klode napsal(a):
> On Tue, Jul 30, 2019 at 05:02:44PM +0200, Zdenek Kabelac wrote:
>> Dne 25. 07. 19 v 20:49 Julian Andres Klode napsal(a):
>>> systems might have systemd as their normal init systems, but
>>> might not be using it in their initramfs; or like Debian, support
>>> different init systems.
>>> Detect whether we are running on systemd by checking for /run/systemd/system
>>> and then change the behavior accordingly.
>> Wouldn't it be better to simply disable compiling/using lvmetad on such systems ?
> I don't see how this has anything to do with lvmetad. There is no lvmetad
> anymore.

The whole point of 'service' for 'pvscan' is to postone activation of DM 
devices outside of udev rule processing.

So whatever is replacing systemd service in your's systemd-less system must 
provide similar functionality.

There is currently no way to accept autoactivation capability within udev-rule 

>> HEAD of 2.03 already dropped lvmetad anyway.
>> Do you need any sort of autoactivation in ramdisk ?
> Of course we need the PV to be scanned automatically so we can then find
> the root partition. The root device finding is event-based, we have a tool
> that listens to udev and waits for 30s for the device to appear, and relies
> on the events being triggered correctly.

There is nothing for finding - if you pass root LV into your ramdisk the 
proper command to activate such LV  is   'lvchange -ay vgname/lvname'

Dracut uses pretty 'navive' algorithm to run such command with whenever any 
new device is found - it's added into lvm2 filters of visible device - once it 
succeeds - it can proceed....
For the 'initramdisk' functionality this is IMHO good enough.
(Although there are several very ugly hacks in this code we would like to drop...)

>> There is probably higher complexity.

Activating 'root' LV via autoactivation mechanism is very complex.
IMHO some of them are really very very hard to resolve.

>> pvscan was not moved into systemd service just for fun - there have been at
>> least 2 major mandatory points why  'pvscan' with autoactivation MUST NOT be
>> executed from udev rule directly (udev timeout)
>> So the proposed patch must be NAC-ked as it is - as it probably causing way
>> more troubles then it solves.
> The alternative would be to disable the systemd integration entirely in
> Debian and Ubuntu, as Debian requires support for non-systemd inits, and
> Ubuntu requires event-based root device finding in initramfs. Surely that's
> worse.

Can't really speak for any other distros.

I'm only commenting proposed patch for moving background pvscan into direct 
udev-rule is not acceptable workaround (as it simply can't work)

The system without systemd needs to provide some other mechanism how to fire 
background job.

Note - there is upcoming SID work that can supposedly resolve some of these 
issue - but the release date and it's integration into distributions like 
Debian is a topic for another debate...



More information about the linux-lvm mailing list