Mounting Luks partition error

I’m dual booting two opensuse Leap on a machine. One installation is what I’m using now Leap 15.2 (calling it A for now). The other is Leap 15.1 (calling it B). A few days ago I might be drunk or sth I messed with B’s Luks partition password when I tried to setup another drive (unrelated to my current machine). I did quite some “luksChangeKeys” to B’s Luks partition as I mistook it to the drive I was trying to setup. The issue is not I forgot the password. It is that now B stops booting prior to asking me to unlock its Luks partition.

What I’m doing now is booting in A to fix B’s Luks partition. However, I can not mount the drive with the following commands:

suse:/home/jim # cryptsetup open /dev/nvme0n1p3 repe
Enter passphrase for /dev/nvme0n1p3: 


suse:/dev/mapper # mount ./repe /mnt/rescue/
mount: /mnt/rescue: wrong fs type, bad option, bad superblock on /dev/mapper/repe, missing codepage or helper program, or other error.

After I use the “cryptsetup open” command, if I do “ls /dev/mapper”, “repe” clearly showed in the list. But I just cannot mount it to proceed.
It seems a common error when mounting a luks partition after I did some research online, but I haven’t found an answer yet?!

I have not run into that problem.

If that happened here, my assumption would be that the “cryptsetup” command worked correctly, but something is broken in the file system that you are attempting to mount.

What’s the output from:

parted /dev/mapper/repe print

Hello, it’s

**#** parted /dev/mapper/repe print
Error: /dev/mapper/repe: unrecognised disk label
Model: Linux device-mapper (crypt) (dm)                                    
Disk /dev/mapper/repe: 254GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 


By way of comparison, here’s the output that I get:


# parted /dev/mapper/cr_shared print
Model: Linux device-mapper (crypt) (dm)
Disk /dev/mapper/cr_shared: 522GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0.00B  522GB  522GB  ext4

It looks to me as if your encrypted file system has been lost. Maybe it was wiped. Or maybe it was encrypted to a different key than is currently in the LUKS header, so that it is totally scrambled.

There was a time that I removed all luksKey slots. As soon as I realized it’s not the partition I should mess with. I add the original passphrase to the partition. Do you think it’s that part that has changed the header even with the same passphrase?

Any last hope to restore the drive?

You have probably lost everything on that drive.

The LUKS partition is not encrypted with the password that you use. Rather, it is encrypted with a 256 bit random key. In turn, that 256 bit random key is encrypted with the password that you use.

When you removed all luksKey slots, you lost access to that 256bit random key. And it is probably gone for good.

Thank you for the explanation. Time to move on then.