[SOLVED] Encrypted LVM problem on new Rocky install

Hi there.

I’ve been trying to get my encrypted LVM volumes to work with Rocky, but it appears I’m unable to make it work. It’s 2 external drives, one nvme and one HDD that I used to mount at /mnt.

I’m going to exemplify how I originally created my volumes in Debian:

  • cryptsetup -c aes-xts-plain64 -y -s 512 --iter-time 1000 luksFormat /dev/nvme1n1p1
  • cryptsetup luksOpen /dev/nvme1n1p1 2TB
  • pvcreate /dev/mapper/2TB
  • vgcreate 2TBvg /dev/mapper/2TB
  • lvcreate -l 100%FREE 2TBvg -n 2TBlv
  • mkfs.ext4 /dev/mapper/2TBvg-2TBlv
  • mkdir /mnt/2TB
  • mount /dev/mapper/2TBvg-2TBlv /mnt/2TB

This works still for Debian-based OS’s, but not for Rocky. I was following this thread but the solution there didn’t work for me.

Here’s my result:

[root@toquita ~]# lvmdevices --adddev /dev/nvme1n1
  WARNING: adding device /dev/nvme1n1 that is excluded: device is partitioned.
  WARNING: adding device /dev/nvme1n1 with idname eui.00000000000000000026b7784f964ca5 which is already used for /dev/nvme1n1p1.

pvscan:

root@toquita ~]# pvscan
Devices file /dev/nvme1n1 is excluded: device is partitioned.
PV /dev/mapper/luks-9461cc4a-d7d7-40e9-a025-567cc4b10783 VG rl_localhost-live lvm2 [<464.16 GiB / 0 free]
Total: 1 [<464.16 GiB] / in use: 1 [<464.16 GiB] / in no VG: 0 [0 ]

I used to mount these drives automatically at boot using /etc/crypttab and /etc/fstab, using this command to grab all the necessary info:

lsblk -o name,uuid,mountpoint

This would give me a result similar to this:

nvme1n1
nvme1n1p1 UUID=blablabla /mnt/2TB

But this is what I get with this command now:

nvme1n1                                                                              
└─nvme1n1p1                                   a5a357c0-3eaa-45b0-a4dc-c056e8b79dac   
  └─2TB                                       Pzg6w0-SPMH-g6xW-nJx5-dM6X-ddVJ-RW2r0d

As you can see, there’s no volume groups nor logical volumes there.

#############################################

So I tried something different:

  • I backed up the data in the nvme and put it in the HDD (mass storage) using Debian;
  • went back to Rocky and removed all partitions in the nvme and recreated the encrypted LVM scheme mentioned in the beginning of this thread;
  • it worked;
  • I went back to Debian to see if I could open this LVM there;
  • It was possible, so I copied some files to the nvme to see if opening the LVM in Debian would somehow make it not work again in Rocky;
  • It worked fine;
  • So I had a final test: re-install rocky to see if my LVM setup (created on another Rocky 9.3 install) would work;
  • It didn’t!!

So it seems I’m only able to open my encrypted lvm on the exact same system it was created in.

Does this provide any clues as to what’s going on?

Please can someone help, I love Rocky and it’s the only system I can use right now.


Edit: Solved by a reddit comment! All I had to do was luksOpen my partitions and then:

/usr/sbin/vgimportdevices --all 

I’ve never experienced this on any other distro. Must be peculiar to RedHat :slight_smile: