# [SOLVED] dm-crypt/cryptsetup: udev cookie waiting for zero

## DespLock

I'm using gentoo for 2 months now with OpenRC, Xfce and full disk encryption (5.7.10-gentoo-x86_64)

On top of my encrypted root device i'm having 2 more encrypted partitions which are mounted on boot via dmcrypt.

On shutdown/reboot these partitions won't be unmounted because dmcrypt is waiting for a udev cookie to be zero which is not going to happen 99% of the time. 

If i'm changing content of /etc/conf.d/dmcrypt or shutdown right after boot (without login) sometimes the notebook will shutdown/reboot proper. 

On Alpine Linux 3.12 with similar setup this never happens for the same devices. 

All encrypted partitions are now in luks1 format with default settings.

No entries in 'sudo dmesg' for both mappings found. 

Here's the current content of /etc/conf.d/dmcrypt (it ends with a newline):

```

target='sda3c'

source='/dev/sda3'

#source=UUID='d0a5b77a-475b-4c01-85d3-9c648d687983'

key='<mykey>'

options='--allow-discards' 

target='nvme3c'

source='/dev/nvme0n1p3'

#source=UUID='3182b69c-6eb8-49e9-9588-434ca5424dde'

key='<my-2nd-key>'

options='--allow-discards'

```

What i tried so far:

1) change source from UUID to drive name

2) remove one and/or the other partiton from /etc/conf.d/dmcrypt

3) remove the "options" line (both entries)

4) change the order or the entries (hangs on first entry in both cases)

5) reformat my devices (sda3/nvme0n1p3) with luks1/luks2

6) re-emerge sys-fs/cryptsetup with different flags (luks1_default, static, -udev) and different versions (2.3.2 and 2.3.3)

7) checked /lib/udev/rules.d/ for dm rules:

```

     ls -al  /lib/udev/rules.d | grep dm

    -r--r--r-- 1 root root 7.1K Jul 24 14:58 10-dm.rules

    -r--r--r-- 1 root root 2.4K Jul 24 14:58 11-dm-lvm.rules

    -r--r--r-- 1 root root 1.8K Jul 24 14:58 13-dm-disk.rules

    -r--r--r-- 1 root root 6.3K Jul 24 14:58 69-dm-lvm-metad.rules

    -r--r--r-- 1 root root  479 Jul 24 14:58 95-dm-notify.rules

```

8) compared rules with alpine linux: they are the same

9) wasted some decent amount of time searching for solutions and found nothing useful. 

Changed /etc/init.d/dmcrypt for more output:

```

[...]

stop() {

   [...]

  ebegin "  ${target}"

  dmsetup info -c

  cryptsetup --verbose --debug close ${target}

  eend $?

[...]

}

```

Output (look at my famous photographs):

[img]https://i.ibb.co/CnWkXRf/crypt-1.png[/img]

[img]https://i.ibb.co/n8WQsyg/crypt-2.png[/img]

[img]https://i.ibb.co/s6n7GQv/crypt-3.png[/img]

Any help is appreciated.

=================================================================================

=================================================================================

EDIT 2020-08-01: issue was caused by the lvm service. Deactivating and removing it from auto start: 

```

rc-update del lvm <runlevel>

```

Notebook is now rebooting/shutting down every time. 

EDIT 2020-8-02: Still haven't found the reason for this behaviour, but removing lvm leads to an error while closing encrypted volumes ("still in use").

Modify stop-function of /etc/init.d/dmcrypt to manually deactivate a volumegroup:

```

lvchange <volume_group> -an

```

Now it's working as expected.

----------

## ElektroVirus

Hello DespLock, 

thank you so much for posting your problem and your solution. It helped me forward after hours of debugging and reading documentation on Gentoo wiki for LVM and dm-crypt. 

I have 3 disks on my PC, and like in your case, my PC couldn't shut down cleanly; first there is an error message 

```

Logical volume vg0/root contains a filesystem in use.

Can't deactivate volume group "vg0" with 1 open logical volume(s)

...

Failed to stop Logical Volume Manager (possibly some LVs till needed for /usr or root)  

```

after which it became stuck at the line Removing dm-crypt mappings. 

Like in your solution, on my PC the service 'lvm' needs to be on no runlevel. Sometimes it works when on runlevel 'boot' or 'default' but apparently it works most often when not on a runlevel at all. But definitely not always.

So yes, the problem that my PC won't turn off is solved, but now I get a new error message

Device crypt-data is still in use. as you also got (as you probably guessed, crypt-data is one of my other volume groups). 

And I did not manage to modify /etc/init.d/dmcrypt to manually deactivate it. I actually wrote a script for it

```

vgs |tail -n +2 | \

        while read line ; do

                volumegroup=$(echo $line |awk '{print $1;}')

                vgchange -an $volumegroup

        done

```

which apparently does nothing at shutdown (it works on a running machine). 

"Device crypt-data is still in use."

get's still printed out, and as a new flavour a bunch of  

"WARNING: Failed to connect to lvmetad. Falling back to device scanning."

lines get printed out as 'stopping lvmetad' section.

So, if you know, how to correctly deactivate the volume groups at shutdown, help is appreciated. 

ElektroVirus

----------

## DespLock

Hello ElektroVirus,

i found this issue(s). hard to debug. But some settings helped a lot. Here is my current /etc/init.d/dmcrypt which solved all issues. 

```

stop() {

   local line header

   

   ### closing volume groups

   lvchange avg -an 

   lvchange xvg -an

   

   # Break down all mappings

   header=true

   egrep "^(target|swap)=" ${conf_file} | \

   while read line ; do

      ${header} && einfo "Removing dm-crypt mappings"

      header=false

      target= swap=

      eval ${line}

      [ -n "${swap}" ] && target=${swap}

      if [ -z "${target}" ] ; then

         ewarn "invalid line in ${conf_file}: ${line}"

         continue

      fi

      ebegin "  ${target}"

      #dmsetup info -c

      #cryptsetup --verbose --debug close ${target}

      cryptsetup remove ${target}

      eend $?

   done

   # Break down loop devices

   header=true

   grep '^source=./dev/loop' ${conf_file} | \

   while read line ; do

      ${header} && einfo "Detaching dm-crypt loop devices"

      header=false

      source=

      eval ${line}

      ebegin "  ${source}"

      losetup -d "${source}"

      eend $?

   done

   return 0

}

```

Just make a diff (meld or similar) to see the differences. 

At the very start i'm closing all vg's which do not contain the root file system.

```

       ### closing volume groups

   lvchange avg -an 

   lvchange xvg -an

```

```

dmsetup info -c

```

gives some information about logical volumes and if they are opened. Add a sleep or sth to stop output afterward. 

If you still have issues with not closing volumes (and system is not shutting down):

```

cryptsetup --verbose --debug close ${target}

#cryptsetup remove ${target}

```

Output might be overwhelming ;).

 *Quote:*   

> 
> 
> "WARNING: Failed to connect to lvmetad. Falling back to device scanning." 
> 
> 

 

Simple: expected and can be ignored. Here's a link which helped me a lot with lvm usage:

https://unix.stackexchange.com/questions/166832/what-is-lvmetad-and-why-would-i-want-or-need-to-use-it

Gl and hf,

Desp

----------

## ElektroVirus

Thank you Desp, 

these lines worked out for me - after correcting my volume group names into it of course.

```

### closing volume groups

lvchange vg_data -an

lvchange vg_data_ssd -an 

```

I still get the warning "WARNING: Failed to connect to lvmetad. Falling back to device scanning", but it's ok. 

However, I don't quite like this solution although it works, now if I would be to add a new volume group to my system, I must remember to change this /etc/init.d/dmcrypt file. Hopefully some day this file will include a script which automatically unmounts all volume groups.

But it works for now, I don't have the resources to debug this further for now, I have more urgent problems. 

ElektroVirus

----------

## sdauth

Thank you very much DespLock for your thread. I was facing the exact same issue. With the same setup (LUKS, LVM..)

Manually adding lvchange  lv_name -an to /etc/init.d/dmcrypt solved the issue but it feels a bit hacky to proceed like that. I don't see any opened bug for that either.

I tried with the latest (currently keyworded) cryptsetup (2.4.1) but it still hang on shutdown.

It doesn't happen with Arch, Debian..

What is strange is that it seems to be "triggered" when I add a new LVM PV. If I only use two (both fully encrypted with LUKS/LVM), then shutdown works fine. But if I add a third drive (LUKS/LVM), then it hang on shutdown (stuck on "Removing dm-crypt mappings"...)

----------

## DespLock

 *sdauth wrote:*   

> Thank you very much DespLock for your thread. I was facing the exact same issue. With the same setup (LUKS, LVM..)
> 
> Manually adding lvchange  lv_name -an to /etc/init.d/dmcrypt solved the issue but it feels a bit hacky to proceed like that.

 

That's true, but a very simple one and it can easily maintained even if the dmcrypt-service is updated. 

On the other hand: i found another solution by removing udev use flag for lvm. SInce all my logical volumes are activated during boot now(initram) they are pretty much static, i have no need for udev/dmcrypt in this case and everything worked afterward. 

 *sdauth wrote:*   

> I don't see any opened bug for that either.

 

I can't figure out which component is responsible for this behaviour: udev or lvm. And i'm not really sure if it is a bug or something like expected behaviour with my setup.

 *sdauth wrote:*   

> It doesn't happen with Arch, Debian...

 

It might relate to config options in /etc/lvm/lvm.conf like:

```
udev_sync = 1/0
```

Further openrc init scripts /etc/init.d/lvm are different for Gentoo and Alpine Linux: 

```

Gentoo:

[...]

 ${lvm_path} vgchange${verbose_command} --config "${config}" --sysinit --activate n

[...]

Alpine:

[...]

 vgchange --ignorelockingfailure -a n >/dev/null 2>&1

[...]

```

Don't know systemd settings (Arch, Debian...) for those services, but you can check them to compare it. 

 *sdauth wrote:*   

> 
> 
> What is strange is that it seems to be "triggered" when I add a new LVM PV. If I only use two (both fully encrypted with LUKS/LVM), then shutdown works fine. But if I add a third drive (LUKS/LVM), then it hang on shutdown (stuck on "Removing dm-crypt mappings"...)

 

Maybe udev/lvm are "miscounting" (udev-)cookies if (some) lvm partitions were mounted before the services have been started.

----------

## sdauth

Thanks again for the really helpful information. I will try to investigate that later and open a bug for that later. I can't really afford to mess around with the current setup (it's a server and being forced to hard shutdown when it hangs is not great) so I will try to replicate the issue on an other computer first.

At least it works now, this was driving me nuts.  :Surprised: 

Cheers

----------

## sdauth

I reproduced the issue in a Gentoo VM with 4 drives attached (each fully encrypted with LVM and with two LV for each, each lv formatted as ext4), result on shutdown with the qemu serial output :

```
 * Unmounting loop devices

 * Unmounting filesystems

 *   Unmounting /mnt/test/testfullhdd4 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd4 ...

 [ ok ]

 *   Unmounting /mnt/test/testfullhdd3 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd3 ...

 [ ok ]

 *   Unmounting /mnt/test/testfullhdd2 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd2 ...

 [ ok ]

 *   Unmounting /mnt/test/testfullhdd1 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd1 ...

 [ ok ]

 * Deactivating swap devices ...

 [ ok ]

 * Stopping the Logical Volume Manager ...

  0 logical volume(s) in volume group "matrix-hdd1" now active

  0 logical volume(s) in volume group "matrix-hdd3" now active

  0 logical volume(s) in volume group "matrix-hdd4" now active

  0 logical volume(s) in volume group "matrix-hdd2" now active

 [ ok ]

 * Stopping lvmetad ...

 [ ok ]

 * Removing dm-crypt mappings

 *   hdd1 ...

Name             Maj Min Stat Open Targ Event  UUID                                             

hdd4             253   9 L--w    0    1      0 CRYPT-LUKS2-ff6002d770744a84a1a487248b786911-hdd4

hdd3             253   6 L--w    0    1      0 CRYPT-LUKS2-50aabb577f5143f2aabe413bf646b653-hdd3

hdd2             253   3 L--w    0    1      0 CRYPT-LUKS2-d7a205eb32ac45c2bb6befdb118e57c8-hdd2

hdd1             253   0 L--w    0    1      0 CRYPT-LUKS2-bd08e10902454fdaadaaef9bf35e1c2c-hdd1

# cryptsetup 2.3.6 processing "cryptsetup --verbose --debug close hdd1"

# Running command close.

# Locking memory.

# Installing SIGINT/SIGTERM handler.

# Unblocking interruption on signal.

# Allocating crypt device context by device hdd1.

# Initialising device-mapper backend library.

# dm version   [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Detected dm-ioctl version 4.43.0.

# Detected dm-crypt version 1.22.0.

# Device-mapper backend running with UDEV support enabled.

# dm status hdd1  [ opencount noflush ]   [16384] (*1)

# Releasing device-mapper backend.

# Trying to open and read device /dev/vdb1 with direct-io.

# Allocating context for crypt device /dev/vdb1.

# Trying to open and read device /dev/vdb1 with direct-io.

# Initialising device-mapper backend library.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdb1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd1  [ opencount flush ]   [16384] (*1)

# Crypto backend (OpenSSL 1.1.1l  24 Aug 2021) initialized in cryptsetup library version 2.3.6.

# Detected kernel Linux 5.10.74-gentoo-hardened x86_64.

# Reloading LUKS2 header (repair disabled).

# Acquiring read lock for device /dev/vdb1.

# Opening lock resource file /run/cryptsetup/L_254:17

# Verifying lock handle for /dev/vdb1.

# Device /dev/vdb1 READ lock taken.

# Trying to read primary LUKS2 header at offset 0x0.

# Opening locked device /dev/vdb1

# Veryfing locked device handle (bdev)

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:ff2e7382d4fbd7eee51de4bd7fa4aac75b2b8dbd502e9249039e66404102e752 (on-disk)

# Checksum:ff2e7382d4fbd7eee51de4bd7fa4aac75b2b8dbd502e9249039e66404102e752 (in-memory)

# Trying to read secondary LUKS2 header at offset 0x4000.

# Reusing open ro fd on device /dev/vdb1

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:417593666ee816ffc22207673118892b4a49ea6dbcf98fb942379a7b3c92996d (on-disk)

# Checksum:417593666ee816ffc22207673118892b4a49ea6dbcf98fb942379a7b3c92996d (in-memory)

# Device size 3220160000, offset 16777216.

# Device /dev/vdb1 READ lock released.

# PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4.

# Deactivating volume hdd1.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm status hdd1  [ opencount noflush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdb1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd1  [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Udev cookie 0xd4da979 (semid 12) created

# Udev cookie 0xd4da979 (semid 12) incremented to 1

# Udev cookie 0xd4da979 (semid 12) incremented to 2

# Udev cookie 0xd4da979 (semid 12) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK         (0x20)

# dm remove hdd1  [ opencount flush retryremove ]   [16384] (*1)

# Udev cookie 0xd4da979 (semid 12) decremented to 1

# Udev cookie 0xd4da979 (semid 12) waiting for zero

```

It's been 15min now and it is still stuck on the dumb udev cookie. I will try a few more thing later.

----------

## sdauth

Strangely, if I only enable "hdd1"

```
vda                             254:0    0   80G  0 disk  

├─vda1                          254:1    0   72G  0 part  /

└─vda2                          254:2    0    8G  0 part  [SWAP]

vdb                             254:16   0    3G  0 disk  

└─vdb1                          254:17   0    3G  0 part  

  └─hdd1                        253:0    0    3G  0 crypt 

    ├─matrix--hdd1-testhdd1     253:1    0    1G  0 lvm   /mnt/test/testhdd1

    └─matrix--hdd1-testfullhdd1 253:2    0    2G  0 lvm   /mnt/test/testfullhdd1

vdc                             254:32   0    3G  0 disk  

└─vdc1                          254:33   0    3G  0 part  

vdd                             254:48   0    3G  0 disk  

└─vdd1                          254:49   0    3G  0 part  

vde                             254:64   0    3G  0 disk  

└─vde1                          254:65   0    3G  0 part 
```

then shutdown works just fine !

EDIT : It also works with two drives. But anything above 2 triggers the udev cookie and shutdown is stuck.

```
 * Unmounting loop devices

 * Unmounting filesystems

 *   Unmounting /mnt/test/testfullhdd1 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd1 ...

 [ ok ]

 * Deactivating swap devices ...

 [ ok ]

 * Stopping the Logical Volume Manager ...

  0 logical volume(s) in volume group "matrix-hdd1" now active

 [ ok ]

 * Stopping lvmetad ...

 [ ok ]

 * Removing dm-crypt mappings

 *   hdd1 ...

Name             Maj Min Stat Open Targ Event  UUID                                             

hdd1             253   0 L--w    0    1      0 CRYPT-LUKS2-bd08e10902454fdaadaaef9bf35e1c2c-hdd1

# cryptsetup 2.3.6 processing "cryptsetup --verbose --debug close hdd1"

# Running command close.

# Locking memory.

# Installing SIGINT/SIGTERM handler.

# Unblocking interruption on signal.

# Allocating crypt device context by device hdd1.

# Initialising device-mapper backend library.

# dm version   [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Detected dm-ioctl version 4.43.0.

# Detected dm-crypt version 1.22.0.

# Device-mapper backend running with UDEV support enabled.

# dm status hdd1  [ opencount noflush ]   [16384] (*1)

# Releasing device-mapper backend.

# Trying to open and read device /dev/vdb1 with direct-io.

# Allocating context for crypt device /dev/vdb1.

# Trying to open and read device /dev/vdb1 with direct-io.

# Initialising device-mapper backend library.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdb1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd1  [ opencount flush ]   [16384] (*1)

# Crypto backend (OpenSSL 1.1.1l  24 Aug 2021) initialized in cryptsetup library version 2.3.6.

# Detected kernel Linux 5.10.74-gentoo-hardened x86_64.

# Reloading LUKS2 header (repair disabled).

# Acquiring read lock for device /dev/vdb1.

# Opening lock resource file /run/cryptsetup/L_254:17

# Verifying lock handle for /dev/vdb1.

# Device /dev/vdb1 READ lock taken.

# Trying to read primary LUKS2 header at offset 0x0.

# Opening locked device /dev/vdb1

# Veryfing locked device handle (bdev)

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:ff2e7382d4fbd7eee51de4bd7fa4aac75b2b8dbd502e9249039e66404102e752 (on-disk)

# Checksum:ff2e7382d4fbd7eee51de4bd7fa4aac75b2b8dbd502e9249039e66404102e752 (in-memory)

# Trying to read secondary LUKS2 header at offset 0x4000.

# Reusing open ro fd on device /dev/vdb1

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:417593666ee816ffc22207673118892b4a49ea6dbcf98fb942379a7b3c92996d (on-disk)

# Checksum:417593666ee816ffc22207673118892b4a49ea6dbcf98fb942379a7b3c92996d (in-memory)

# Device size 3220160000, offset 16777216.

# Device /dev/vdb1 READ lock released.

# PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4.

# Deactivating volume hdd1.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm status hdd1  [ opencount noflush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdb1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd1  [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Udev cookie 0xd4d1cf6 (semid 3) created

# Udev cookie 0xd4d1cf6 (semid 3) incremented to 1

# Udev cookie 0xd4d1cf6 (semid 3) incremented to 2

# Udev cookie 0xd4d1cf6 (semid 3) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK         (0x20)

# dm remove hdd1  [ opencount flush retryremove ]   [16384] (*1)

# Udev cookie 0xd4d1cf6 (semid 3) decremented to 1

# Udev cookie 0xd4d1cf6 (semid 3) waiting for zero

# Udev cookie 0xd4d1cf6 (semid 3) destroyed

# Requesting keyring logon key for revoke and unlink.

# Releasing crypt device /dev/vdb1 context.

# Releasing device-mapper backend.

# Closing read only fd for /dev/vdb1.

# Unlocking memory.

Opération réussie.

 [ ok ]

 * Setting hardware clock using the system clock [UTC] ...

 [ ok ]

 * Stopping udev ...

 [ ok ]

 * Terminating remaining processes ...

 [ ok ]

 * Killing remaining processes ...

 [ ok ]

 * Saving dependency cache ...

 [ ok ]

 [ ok ]

 * Remounting remaining filesystems read-only ...

 *   Remounting / read only ...

 [ ok ]

 [ ok ]

[   91.849092] reboot: Power down
```

----

Maybe of interest : https://bugs.gentoo.org/820773

Also, I added CONFIG_DM_UEVENT=y to my kernel config in the VM. I was missing it, not sure if related but it doesn't hurt to try. I will report later.

EDIT : Recompiled the kernel with DM_UEVENT enabled, no change.

----------

## sdauth

@DespLock :

Do you have lvmetad enabled in /etc/lvm/lvm.conf ? It is (by default) when lvm2 package is installed.

I found out that if I disable it then all troubles are gone.. Blazing fast shutdown, no error. Verbose output so one can see the cookie is correctly destroyed. 

EDIT : Even easier than that... You just need to put lvmetad to runlevel shutdown and it works great... (At least for me), no need to disable lvmetad from /etc/lvm/lvm.conf

```
rc-update add lvmetad shutdown
```

```
* Unmounting loop devices

 * Unmounting filesystems

 *   Unmounting /mnt/test/testfullhdd4 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd4 ...

 [ ok ]

 *   Unmounting /mnt/test/testfullhdd3 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd3 ...

 [ ok ]

 *   Unmounting /mnt/test/testfullhdd2 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd2 ...

 [ ok ]

 *   Unmounting /mnt/test/testfullhdd1 ...

 [ ok ]

 *   Unmounting /mnt/test/testhdd1 ...

 [ ok ]

 * Deactivating swap devices ...

 [ ok ]

 * Stopping the Logical Volume Manager ...

  0 logical volume(s) in volume group "matrix-hdd4" now active

  0 logical volume(s) in volume group "matrix-hdd3" now active

  0 logical volume(s) in volume group "matrix-hdd2" now active

  0 logical volume(s) in volume group "matrix-hdd1" now active

 [ ok ]

 * Removing dm-crypt mappings

 *   hdd1 ...

Name             Maj Min Stat Open Targ Event  UUID                                             

hdd4             253   3 L--w    0    1      0 CRYPT-LUKS2-ff6002d770744a84a1a487248b786911-hdd4

hdd3             253   2 L--w    0    1      0 CRYPT-LUKS2-50aabb577f5143f2aabe413bf646b653-hdd3

hdd2             253   1 L--w    0    1      0 CRYPT-LUKS2-d7a205eb32ac45c2bb6befdb118e57c8-hdd2

hdd1             253   0 L--w    0    1      0 CRYPT-LUKS2-bd08e10902454fdaadaaef9bf35e1c2c-hdd1

# cryptsetup 2.3.6 processing "cryptsetup --verbose --debug close hdd1"

# Running command close.

# Locking memory.

# Installing SIGINT/SIGTERM handler.

# Unblocking interruption on signal.

# Allocating crypt device context by device hdd1.

# Initialising device-mapper backend library.

# dm version   [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Detected dm-ioctl version 4.43.0.

# Detected dm-crypt version 1.22.0.

# Device-mapper backend running with UDEV support enabled.

# dm status hdd1  [ opencount noflush ]   [16384] (*1)

# Releasing device-mapper backend.

# Trying to open and read device /dev/vdb1 with direct-io.

# Allocating context for crypt device /dev/vdb1.

# Trying to open and read device /dev/vdb1 with direct-io.

# Initialising device-mapper backend library.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdb1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd1  [ opencount flush ]   [16384] (*1)

# Crypto backend (OpenSSL 1.1.1l  24 Aug 2021) initialized in cryptsetup library version 2.3.6.

# Detected kernel Linux 5.10.76-gentoo-r1-hardened x86_64.

# Reloading LUKS2 header (repair disabled).

# Acquiring read lock for device /dev/vdb1.

# Opening lock resource file /run/cryptsetup/L_254:17

# Verifying lock handle for /dev/vdb1.

# Device /dev/vdb1 READ lock taken.

# Trying to read primary LUKS2 header at offset 0x0.

# Opening locked device /dev/vdb1

# Veryfing locked device handle (bdev)

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:ff2e7382d4fbd7eee51de4bd7fa4aac75b2b8dbd502e9249039e66404102e752 (on-disk)

# Checksum:ff2e7382d4fbd7eee51de4bd7fa4aac75b2b8dbd502e9249039e66404102e752 (in-memory)

# Trying to read secondary LUKS2 header at offset 0x4000.

# Reusing open ro fd on device /dev/vdb1

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:417593666ee816ffc22207673118892b4a49ea6dbcf98fb942379a7b3c92996d (on-disk)

# Checksum:417593666ee816ffc22207673118892b4a49ea6dbcf98fb942379a7b3c92996d (in-memory)

# Device size 3220160000, offset 16777216.

# Device /dev/vdb1 READ lock released.

# PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4.

# Deactivating volume hdd1.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm status hdd1  [ opencount noflush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdb1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd1  [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd1  [ opencount flush securedata ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Udev cookie 0xd4d70b5 (semid 20) created

# Udev cookie 0xd4d70b5 (semid 20) incremented to 1

# Udev cookie 0xd4d70b5 (semid 20) incremented to 2

# Udev cookie 0xd4d70b5 (semid 20) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK         (0x20)

# dm remove hdd1  [ opencount flush retryremove ]   [16384] (*1)

# Udev cookie 0xd4d70b5 (semid 20) decremented to 0

# Udev cookie 0xd4d70b5 (semid 20) waiting for zero

# Udev cookie 0xd4d70b5 (semid 20) destroyed

# Requesting keyring logon key for revoke and unlink.

# Releasing crypt device /dev/vdb1 context.

# Releasing device-mapper backend.

# Closing read only fd for /dev/vdb1.

# Unlocking memory.

Opération réussie.

 [ ok ]

 *   hdd2 ...

Name             Maj Min Stat Open Targ Event  UUID                                             

hdd4             253   3 L--w    0    1      0 CRYPT-LUKS2-ff6002d770744a84a1a487248b786911-hdd4

hdd3             253   2 L--w    0    1      0 CRYPT-LUKS2-50aabb577f5143f2aabe413bf646b653-hdd3

hdd2             253   1 L--w    0    1      0 CRYPT-LUKS2-d7a205eb32ac45c2bb6befdb118e57c8-hdd2

# cryptsetup 2.3.6 processing "cryptsetup --verbose --debug close hdd2"

# Running command close.

# Locking memory.

# Installing SIGINT/SIGTERM handler.

# Unblocking interruption on signal.

# Allocating crypt device context by device hdd2.

# Initialising device-mapper backend library.

# dm version   [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Detected dm-ioctl version 4.43.0.

# Detected dm-crypt version 1.22.0.

# Device-mapper backend running with UDEV support enabled.

# dm status hdd2  [ opencount noflush ]   [16384] (*1)

# Releasing device-mapper backend.

# Trying to open and read device /dev/vdc1 with direct-io.

# Allocating context for crypt device /dev/vdc1.

# Trying to open and read device /dev/vdc1 with direct-io.

# Initialising device-mapper backend library.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd2  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdc1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd2  [ opencount flush ]   [16384] (*1)

# Crypto backend (OpenSSL 1.1.1l  24 Aug 2021) initialized in cryptsetup library version 2.3.6.

# Detected kernel Linux 5.10.76-gentoo-r1-hardened x86_64.

# Reloading LUKS2 header (repair disabled).

# Acquiring read lock for device /dev/vdc1.

# Opening lock resource file /run/cryptsetup/L_254:33

# Verifying lock handle for /dev/vdc1.

# Device /dev/vdc1 READ lock taken.

# Trying to read primary LUKS2 header at offset 0x0.

# Opening locked device /dev/vdc1

# Veryfing locked device handle (bdev)

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:5e255b3c80d176670d59f57dba4444de24eba4fb3040f2af9d49b458a4797a73 (on-disk)

# Checksum:5e255b3c80d176670d59f57dba4444de24eba4fb3040f2af9d49b458a4797a73 (in-memory)

# Trying to read secondary LUKS2 header at offset 0x4000.

# Reusing open ro fd on device /dev/vdc1

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:db8cf6c31b269dd3ed609847ad5433433b4bf54ec101b8a1e0f7eb1e15e61be9 (on-disk)

# Checksum:db8cf6c31b269dd3ed609847ad5433433b4bf54ec101b8a1e0f7eb1e15e61be9 (in-memory)

# Device size 3220160000, offset 16777216.

# Device /dev/vdc1 READ lock released.

# PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4.

# Deactivating volume hdd2.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm status hdd2  [ opencount noflush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd2  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdc1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd2  [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd2  [ opencount flush securedata ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Udev cookie 0xd4d6e7e (semid 21) created

# Udev cookie 0xd4d6e7e (semid 21) incremented to 1

# Udev cookie 0xd4d6e7e (semid 21) incremented to 2

# Udev cookie 0xd4d6e7e (semid 21) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK         (0x20)

# dm remove hdd2  [ opencount flush retryremove ]   [16384] (*1)

# Udev cookie 0xd4d6e7e (semid 21) decremented to 0

# Udev cookie 0xd4d6e7e (semid 21) waiting for zero

# Udev cookie 0xd4d6e7e (semid 21) destroyed

# Requesting keyring logon key for revoke and unlink.

# Releasing crypt device /dev/vdc1 context.

# Releasing device-mapper backend.

# Closing read only fd for /dev/vdc1.

# Unlocking memory.

Opération réussie.

 [ ok ]

 *   hdd3 ...

Name             Maj Min Stat Open Targ Event  UUID                                             

hdd4             253   3 L--w    0    1      0 CRYPT-LUKS2-ff6002d770744a84a1a487248b786911-hdd4

hdd3             253   2 L--w    0    1      0 CRYPT-LUKS2-50aabb577f5143f2aabe413bf646b653-hdd3

# cryptsetup 2.3.6 processing "cryptsetup --verbose --debug close hdd3"

# Running command close.

# Locking memory.

# Installing SIGINT/SIGTERM handler.

# Unblocking interruption on signal.

# Allocating crypt device context by device hdd3.

# Initialising device-mapper backend library.

# dm version   [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Detected dm-ioctl version 4.43.0.

# Detected dm-crypt version 1.22.0.

# Device-mapper backend running with UDEV support enabled.

# dm status hdd3  [ opencount noflush ]   [16384] (*1)

# Releasing device-mapper backend.

# Trying to open and read device /dev/vdd1 with direct-io.

# Allocating context for crypt device /dev/vdd1.

# Trying to open and read device /dev/vdd1 with direct-io.

# Initialising device-mapper backend library.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd3  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdd1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd3  [ opencount flush ]   [16384] (*1)

# Crypto backend (OpenSSL 1.1.1l  24 Aug 2021) initialized in cryptsetup library version 2.3.6.

# Detected kernel Linux 5.10.76-gentoo-r1-hardened x86_64.

# Reloading LUKS2 header (repair disabled).

# Acquiring read lock for device /dev/vdd1.

# Opening lock resource file /run/cryptsetup/L_254:49

# Verifying lock handle for /dev/vdd1.

# Device /dev/vdd1 READ lock taken.

# Trying to read primary LUKS2 header at offset 0x0.

# Opening locked device /dev/vdd1

# Veryfing locked device handle (bdev)

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:8eecc7d667f3d53feb1f0f2c81f3a53d1369424f1d74d7fd93c4962dc9ac6267 (on-disk)

# Checksum:8eecc7d667f3d53feb1f0f2c81f3a53d1369424f1d74d7fd93c4962dc9ac6267 (in-memory)

# Trying to read secondary LUKS2 header at offset 0x4000.

# Reusing open ro fd on device /dev/vdd1

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:fa20a28fdb25e2995ef8da24c694e07e8804acfa121394cc637cfa03c6cceb81 (on-disk)

# Checksum:fa20a28fdb25e2995ef8da24c694e07e8804acfa121394cc637cfa03c6cceb81 (in-memory)

# Device size 3220160000, offset 16777216.

# Device /dev/vdd1 READ lock released.

# PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4.

# Deactivating volume hdd3.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm status hdd3  [ opencount noflush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd3  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vdd1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd3  [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd3  [ opencount flush securedata ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Udev cookie 0xd4d7229 (semid 22) created

# Udev cookie 0xd4d7229 (semid 22) incremented to 1

# Udev cookie 0xd4d7229 (semid 22) incremented to 2

# Udev cookie 0xd4d7229 (semid 22) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK         (0x20)

# dm remove hdd3  [ opencount flush retryremove ]   [16384] (*1)

# Udev cookie 0xd4d7229 (semid 22) decremented to 0

# Udev cookie 0xd4d7229 (semid 22) waiting for zero

# Udev cookie 0xd4d7229 (semid 22) destroyed

# Requesting keyring logon key for revoke and unlink.

# Releasing crypt device /dev/vdd1 context.

# Releasing device-mapper backend.

# Closing read only fd for /dev/vdd1.

# Unlocking memory.

Opération réussie.

 [ ok ]

 *   hdd4 ...

Name             Maj Min Stat Open Targ Event  UUID                                             

hdd4             253   3 L--w    0    1      0 CRYPT-LUKS2-ff6002d770744a84a1a487248b786911-hdd4

# cryptsetup 2.3.6 processing "cryptsetup --verbose --debug close hdd4"

# Running command close.

# Locking memory.

# Installing SIGINT/SIGTERM handler.

# Unblocking interruption on signal.

# Allocating crypt device context by device hdd4.

# Initialising device-mapper backend library.

# dm version   [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Detected dm-ioctl version 4.43.0.

# Detected dm-crypt version 1.22.0.

# Device-mapper backend running with UDEV support enabled.

# dm status hdd4  [ opencount noflush ]   [16384] (*1)

# Releasing device-mapper backend.

# Trying to open and read device /dev/vde1 with direct-io.

# Allocating context for crypt device /dev/vde1.

# Trying to open and read device /dev/vde1 with direct-io.

# Initialising device-mapper backend library.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd4  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vde1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd4  [ opencount flush ]   [16384] (*1)

# Crypto backend (OpenSSL 1.1.1l  24 Aug 2021) initialized in cryptsetup library version 2.3.6.

# Detected kernel Linux 5.10.76-gentoo-r1-hardened x86_64.

# Reloading LUKS2 header (repair disabled).

# Acquiring read lock for device /dev/vde1.

# Opening lock resource file /run/cryptsetup/L_254:65

# Verifying lock handle for /dev/vde1.

# Device /dev/vde1 READ lock taken.

# Trying to read primary LUKS2 header at offset 0x0.

# Opening locked device /dev/vde1

# Veryfing locked device handle (bdev)

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:770a8791fa104869e145aca70a184129915f722fcc81aec0122f790c7f7a2524 (on-disk)

# Checksum:770a8791fa104869e145aca70a184129915f722fcc81aec0122f790c7f7a2524 (in-memory)

# Trying to read secondary LUKS2 header at offset 0x4000.

# Reusing open ro fd on device /dev/vde1

# LUKS2 header version 2 of size 16384 bytes, checksum sha256.

# Checksum:c34bed7d0148b9cca5c5082f711d472b1f8c3da6f7ba1f9d59893c2e168de459 (on-disk)

# Checksum:c34bed7d0148b9cca5c5082f711d472b1f8c3da6f7ba1f9d59893c2e168de459 (in-memory)

# Device size 3220160000, offset 16777216.

# Device /dev/vde1 READ lock released.

# PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4.

# Deactivating volume hdd4.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm status hdd4  [ opencount noflush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd4  [ opencount flush securedata ]   [16384] (*1)

# Trying to open and read device /dev/vde1 with direct-io.

# dm versions   [ opencount flush ]   [16384] (*1)

# dm deps hdd4  [ opencount flush ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# dm table hdd4  [ opencount flush securedata ]   [16384] (*1)

# dm versions   [ opencount flush ]   [16384] (*1)

# Udev cookie 0xd4d1b47 (semid 23) created

# Udev cookie 0xd4d1b47 (semid 23) incremented to 1

# Udev cookie 0xd4d1b47 (semid 23) incremented to 2

# Udev cookie 0xd4d1b47 (semid 23) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK         (0x20)

# dm remove hdd4  [ opencount flush retryremove ]   [16384] (*1)

# Udev cookie 0xd4d1b47 (semid 23) decremented to 1

# Udev cookie 0xd4d1b47 (semid 23) waiting for zero

# Udev cookie 0xd4d1b47 (semid 23) destroyed

# Requesting keyring logon key for revoke and unlink.

# Releasing crypt device /dev/vde1 context.

# Releasing device-mapper backend.

# Closing read only fd for /dev/vde1.

# Unlocking memory.

Opération réussie.

 [ ok ]

 * Setting hardware clock using the system clock [UTC] ...

 [ ok ]

 * Stopping udev ...

 [ ok ]

 * Terminating remaining processes ...

 [ ok ]

 * Killing remaining processes ...

 [ ok ]

 * Saving dependency cache ...

 [ ok ]

 [ ok ]

 * Remounting remaining filesystems read-only ...

 *   Remounting / read only ...

 [ ok ]

 [ ok ]

[   97.931233] reboot: Power down

```

----------

## DespLock

 *sdauth wrote:*   

> @DespLock :
> 
> Do you have lvmetad enabled in /etc/lvm/lvm.conf ? It is (by default) when lvm2 package is installed.
> 
> I found out that if I disable it then all troubles are gone.. Blazing fast shutdown, no error. Verbose output so one can see the cookie is correctly destroyed. 
> ...

 

Well, great findings. this looks like lvmetad cache doesn't get updated during boot. 

Checked rc.log: lvmetad is started before lvm

Checked /etc/init.d/lvm around line 98 shows command to update lvmetad cache:

```
${lvm_path} pvscan${verbose_command} -d --config "${config}" --cache
```

Since the result of this command is checked it should be ok, but running the command from console gives me;

```

# /sbin/lvm pvscan -v --config "/etc/lvm/lvm.conf" --cache

  Parse error at byte 18 (line 1): unexpected token

  Failed to set overridden configuration entries.

  Run `pvscan --help' for more information.

```

Without the config part:

```

# /sbin/lvm pvscan -v --cache

    Scanning all devices.

    Scanning all devices to initialize lvmetad.

```

Could you do a test in the vm?

1) enable use_lvmetad in /etc/lvm/lvm.conf

2) disable lvmetad in shutdown

3) replace line 98 in /etc/init.d/lvm with

```

${lvm_path} pvscan${verbose_command} -d --cache

```

4) shutdown vm

5) add disks

6) start vm

----------

## sdauth

Hi,

I tried what you suggested. Unfortunately, it didn't work. The cache folder stays empty, very strange.

I tried to manually pvscan command as well, with or without the config. (I even tried with a brand new lvm conf by moving /etc/lvm to /etc/lvm_bak before emerging lvm2, no luck!)

I read online that a ".cache" file in /etc/lvm/cache/ could cause issue and indeed there was one (from an old setup) so I removed it but it still fails.

```
/sbin/lvm pvscan -d --cache
```

or

```
/sbin/lvm pvscan -v --config "/etc/lvm/lvm.conf" --cache
```

```
  Parse error at byte 18 (line 1): unexpected token

  Failed to set overridden configuration entries.

  Run `pvscan --help' for more information.
```

I tried to run that with strace but no helpful information which could explains why it fails. The lvm conf is good.

So for now the only thing that works is to set lvmetad to runlevel shutdown (which solve the udev cookie issue, I tried it on my server, no more issues!) but the cache is still not updated so the hunt goes on..Last edited by sdauth on Tue Feb 15, 2022 1:48 pm; edited 3 times in total

----------

## sdauth

By the way.. Just read that. Although Gentoo still provides lvmetad binary and it is present in the conf file.. Even the current masked lvm2 ebuild still provides lvmetad (edit: oops, no it is gone, no more use enable for lvmetad.. in ebuild)

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.6_release_notes/chap-red_hat_enterprise_linux-7.6_release_notes-other_deprecated_functionality

 *Quote:*   

> The lvmetad daemon has been deprecated
> 
> The lvmetad daemon for caching metadata has been deprecated. In a future major release of Red Hat Enterprise Linux, LVM will always read metadata from disk.
> 
> Previously, autoactivation of logical volumes was indirectly tied to the use_lvmetad setting in the lvm.conf configuration file. The correct way to disable autoactivation continues to be setting auto_activation_volume_list=[] (an empty list) in the lvm.conf file. 

 

It is gone (lvmetad) in Debian 11 and Arch Linux as well.

Arch (See : https://github.com/archlinux/svntogit-packages/commit/f0af8995dd85950b7400fffbfcb928fd57e0d75c#diff-37538beb61ff63edebbf735dfcf39e5d732f49183d6beb097169d971875ca422)

```
 ./configure \

    CONFIG_SHELL=/bin/bash \

    --prefix=/usr \

    --sbindir=/usr/bin \

    --sysconfdir=/etc \

    --localstatedir=/var \

    --enable-cmdlib \

    --enable-dmeventd \

    --enable-lvmpolld \

    --enable-pkgconfig \

    --enable-readline \

    --enable-udev_rules \

    --enable-udev_sync \

    --with-cache=internal \

    --with-default-dm-run-dir=/run \

    --with-default-locking-dir=/run/lock/lvm \

    --with-default-pid-dir=/run \

    --with-default-run-dir=/run/lvm \

    --with-systemdsystemunitdir=/usr/lib/systemd/system \

    --with-thin=internal \

--with-udev-prefix=/usr
```

Gentoo (lvmetad is enabled) (2.02.188-r2)

```
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --docdir=/usr/share/doc/lvm2-2.02.188-r2 --htmldir=/usr/share/doc/lvm2-2.02.188-r2/html --enable-dmfilemapd --enable-dmeventd --enable-cmdlib --enable-applib --enable-fsadm --enable-lvmetad --enable-lvmpolld --with-mirrors=internal --with-snapshots=internal --with-thin=internal --with-cache=internal --with-thin-check=/sbin/thin_check --with-cache-check=/sbin/cache_check --with-thin-dump=/sbin/thin_dump --with-cache-dump=/sbin/cache_dump --with-thin-repair=/sbin/thin_repair --with-cache-repair=/sbin/cache_repair --with-thin-restore=/sbin/thin_restore --with-cache-restore=/sbin/cache_restore --with-clvmd=none --with-cluster=none --enable-readline --disable-selinux --enable-pkgconfig --with-confdir=/etc --exec-prefix= --sbindir=/sbin --with-staticdir=/sbin --libdir=/lib64 --with-usrlibdir=/usr/lib64 --with-default-dm-run-dir=/run --with-default-run-dir=/run/lvm --with-default-locking-dir=/run/lock/lvm --with-default-pid-dir=/run --enable-udev_rules --enable-udev_sync --with-udevdir=/lib/udev/rules.d --disable-lvmlockd-sanlock --disable-udev-systemd-background-jobs --disable-notify-dbus --with-systemdsystemunitdir=/lib/systemd/system CLDFLAGS=-Wl,-O1 -Wl,--as-needed
```

----

EDIT :

Ok, I tried the currently masked lvm2 in my Gentoo VM, and applied the new config provided (lvmetad is gone indeed and no more lvmetad binary) and it works great. No need to set lvmetad to runlevel shutdown, you can't anyway since there is no more init file for it   :Laughing: 

----------

## DespLock

 *sdauth wrote:*   

> 
> 
> EDIT :
> 
> Ok, I tried the currently masked lvm2 in my Gentoo VM, and applied the new config provided (lvmetad is gone indeed and no more lvmetad binary) and it works great. No need to set lvmetad to runlevel shutdown, you can't anyway since there is no more init file for it  :lol:[
> ...

 

Good job on solving it and pointing to the final solution!

----------

