# No pvscan results in working lvm on luks setup

## b52_

Hi folks,

I am happy to be back to gentoo after all this time  :Smile:  I setup a gentoo with "lvm on luks" full disk encryption.

The system is able to bootload, decrypt, mount and boot up into a fully running state, but pvscan is not able to see/find my PV after bootup. These are the layers:

```
sda2 -> /boot

sda3 -> luks -> lvm -> (/, swap)
```

I compiled all needed modules into the kernel 4.1.12 and created a initramfs to interact ( luks passphrase, lvmscan, mount root)

```
genkernel --no-ramdisk-modules --lvm --luks --install initramfs
```

And added these kernelparameters to grub.cfg

```
 linux   /vmlinuz-4.1.12-gentoo root=/dev/mapper/idefix-root ro crypt_root=/dev/sda3 dolvm rootfstype=ext4 real_root=/dev/mapper/idefix-root resume=swap:/dev/mapper/idefix-swap

 initrd  /initramfs-genkernel-x86_64-4.1.12-gentoo
```

The system boots fully up with all partitions mounted, but pvscan shows:

```
No matching physical volumes found
```

The PV is still there, it is just not recognised

```
# ls -al /dev/mapper/root 

brw------- 1 root root 253, 0 19. Nov 23:10 /dev/mapper/root

# file -s /dev/mapper/root 

/dev/mapper/root: LVM2 PV (Linux Logical Volume Manager), UUID: LAnlkb-TC6g-izXg-KS1g-nR4k-SaKw-5iUP9r, size: 499833135104
```

Thus after some research I started to play with filter and type in lvm.conf

```
    filter = [ "r|/dev/nbd.*|", "a|/dev/mapper/root|", "a/.*/" ]

    types = [ "device-mapper", 253 ]
```

```
 # grep device-mapper /proc/devices 

253 device-mapper
```

But no luck with this..

```
idefix ~ # pvscan -vvvv

#lvmcmdline.c:1411         DEGRADED MODE. Incomplete RAID LVs will be processed.

#libdm-config.c:997       Setting activation/monitoring to 1

#lvmcmdline.c:1417         Processing: pvscan -vvvv

#lvmcmdline.c:1420         O_DIRECT will be used

#libdm-config.c:933       Setting global/locking_type to 1

#libdm-config.c:997       Setting global/wait_for_locks to 1

#locking/locking.c:128       File-based locking selected.

#libdm-config.c:997       Setting global/prioritise_write_locks to 1

#libdm-config.c:902       Setting global/locking_dir to /run/lock/lvm

#misc/lvm-flock.c:200       Locking /run/lock/lvm/P_global WB

#misc/lvm-flock.c:101         _do_flock /run/lock/lvm/P_global:aux WB

#misc/lvm-flock.c:101         _do_flock /run/lock/lvm/P_global WB

#misc/lvm-flock.c:48         _undo_flock /run/lock/lvm/P_global:aux

#filters/filter-persistent.c:51     Wiping cache of LVM-capable devices

#device/dev-cache.c:338         /dev/sda: Added to device cache

#device/dev-cache.c:335         /dev/disk/by-id/ata-ST500LM000-SSHD-8GB_W7653B8W: Aliased to /dev/sda in device cache

#device/dev-cache.c:335         /dev/disk/by-id/wwn-0x5000c5008a5bbdfc: Aliased to /dev/sda in device cache

#device/dev-cache.c:338         /dev/sda1: Added to device cache

#device/dev-cache.c:335         /dev/disk/by-id/ata-ST500LM000-SSHD-8GB_W7653B8W-part1: Aliased to /dev/sda1 in device cache

#device/dev-cache.c:335         /dev/disk/by-id/wwn-0x5000c5008a5bbdfc-part1: Aliased to /dev/sda1 in device cache

#device/dev-cache.c:335         /dev/disk/by-partlabel/grub: Aliased to /dev/sda1 in device cache

#device/dev-cache.c:335         /dev/disk/by-partuuid/b6cb856e-baff-4d84-bd21-e395a15f01a1: Aliased to /dev/sda1 in device cache

#device/dev-cache.c:338         /dev/sda2: Added to device cache

#device/dev-cache.c:335         /dev/disk/by-id/ata-ST500LM000-SSHD-8GB_W7653B8W-part2: Aliased to /dev/sda2 in device cache

#device/dev-cache.c:335         /dev/disk/by-id/wwn-0x5000c5008a5bbdfc-part2: Aliased to /dev/sda2 in device cache

#device/dev-cache.c:335         /dev/disk/by-partlabel/boot: Aliased to /dev/sda2 in device cache

#device/dev-cache.c:335         /dev/disk/by-partuuid/24ef536d-a0df-425c-a8fb-20a3305429ac: Aliased to /dev/sda2 in device cache

#device/dev-cache.c:335         /dev/disk/by-uuid/422ce14c-057b-48e8-8855-a7fb04ef3fc2: Aliased to /dev/sda2 in device cache

#device/dev-cache.c:338         /dev/sda3: Added to device cache

#device/dev-cache.c:335         /dev/disk/by-id/ata-ST500LM000-SSHD-8GB_W7653B8W-part3: Aliased to /dev/sda3 in device cache

#device/dev-cache.c:335         /dev/disk/by-id/wwn-0x5000c5008a5bbdfc-part3: Aliased to /dev/sda3 in device cache

#device/dev-cache.c:335         /dev/disk/by-partlabel/crypted: Aliased to /dev/sda3 in device cache

#device/dev-cache.c:335         /dev/disk/by-partuuid/9d9df5bd-8dc1-40f7-be8e-cfdd6429973b: Aliased to /dev/sda3 in device cache

#device/dev-cache.c:335         /dev/disk/by-uuid/79554a33-35e8-41ca-bfe9-379858065155: Aliased to /dev/sda3 in device cache

#device/dev-cache.c:338         /dev/loop0: Added to device cache

#device/dev-cache.c:338         /dev/loop1: Added to device cache

#device/dev-cache.c:338         /dev/loop2: Added to device cache

#device/dev-cache.c:338         /dev/loop3: Added to device cache

#device/dev-cache.c:338         /dev/loop4: Added to device cache

#device/dev-cache.c:338         /dev/loop5: Added to device cache

#device/dev-cache.c:338         /dev/loop6: Added to device cache

#device/dev-cache.c:338         /dev/loop7: Added to device cache

#device/dev-cache.c:338         /dev/ram0: Added to device cache

#device/dev-cache.c:338         /dev/ram1: Added to device cache

#device/dev-cache.c:338         /dev/ram10: Added to device cache

#device/dev-cache.c:338         /dev/ram11: Added to device cache

#device/dev-cache.c:338         /dev/ram12: Added to device cache

#device/dev-cache.c:338         /dev/ram13: Added to device cache

#device/dev-cache.c:338         /dev/ram14: Added to device cache

#device/dev-cache.c:338         /dev/ram15: Added to device cache

#device/dev-cache.c:338         /dev/ram2: Added to device cache

#device/dev-cache.c:338         /dev/ram3: Added to device cache

#device/dev-cache.c:338         /dev/ram4: Added to device cache

#device/dev-cache.c:338         /dev/ram5: Added to device cache

#device/dev-cache.c:338         /dev/ram6: Added to device cache

#device/dev-cache.c:338         /dev/ram7: Added to device cache

#device/dev-cache.c:338         /dev/ram8: Added to device cache

#device/dev-cache.c:338         /dev/ram9: Added to device cache

#device/dev-cache.c:606       /dev/dm-0: stat failed: No such file or directory

#device/dev-cache.c:338         /dev/dm-1: Added to device cache

#device/dev-cache.c:335         /dev/root: Aliased to /dev/dm-1 in device cache (preferred name)

#device/dev-cache.c:338         /dev/dm-2: Added to device cache

#device/dev-cache.c:338         /dev/dm-3: Added to device cache

#device/dev-cache.c:338         /dev/dm-4: Added to device cache

#device/dev-cache.c:338         /dev/dm-5: Added to device cache

#device/dev-cache.c:338         /dev/dm-6: Added to device cache

#device/dev-cache.c:574         /dev: Failed to insert devices from udev-managed directory to device cache fully

#cache/lvmcache.c:1661     Wiping internal VG cache

#cache/lvmcache.c:450         Metadata cache has no info for vgname: "#orphans_pool"

#cache/lvmcache.c:450         Metadata cache has no info for vgname: "#orphans_pool"

#cache/lvmcache.c:1366         lvmcache: initialised VG #orphans_pool

#cache/lvmcache.c:450         Metadata cache has no info for vgname: "#orphans_lvm2"

#cache/lvmcache.c:450         Metadata cache has no info for vgname: "#orphans_lvm2"

#cache/lvmcache.c:1366         lvmcache: initialised VG #orphans_lvm2

#cache/lvmetad.c:653         Asking lvmetad for complete list of known VGs

#libdm-config.c:902       Setting response to OK

#libdm-config.c:902       Setting response to OK

#pvscan.c:380     Walking through all physical volumes

#cache/lvmetad.c:626         Asking lvmetad for complete list of known PVs

#libdm-config.c:902       Setting response to OK

#libdm-config.c:902       Setting response to OK

#pvscan.c:438   No matching physical volumes found

#misc/lvm-flock.c:71       Unlocking /run/lock/lvm/P_global

#misc/lvm-flock.c:48         _undo_flock /run/lock/lvm/P_global

#lvmcmdline.c:1478         Completed: pvscan -vvvv
```

Any Ideas how to get pvscan to recognise /dev/mapper/root? I guess this device is created by initramfs. Maybe it has something todo with the dm-0 stat error above..

Thank you,

b52

----------

## b52_

Interesting, after I compiled "AHCI SATA" as a module and created a new initramfs with genkernel my lvm volume is recognised again   :Shocked:  All other kernel options I need to boot this luks+lvm system are still compiled into the kernel.. pvdisplay and vgdisplay work again.

BTW: I use genkernel only for the initramfs, the kernel is build manually.

In order to prove I reverted it. I compiled AHCI into the kernel, build the initramfs without modules and pvdisplay didn't show up anything?! Looks like bug.

Any idea how to debug this?

Thanks,

b52

----------

