Re: can't mount LUKS partition with cryptsetup

Thorsten Giese <[email protected]> Wed, 20 Nov 2024 08:23:21 +0100
Newsgroups dev.linux.lists.cryptsetup
Message-ID <[email protected]>
Hello there,

thanks for your support.

On 19.11.24 19:15, Michael Kjörling wrote:
> On 19 Nov 2024 18:06 +0100, from [email protected] (Thorsten Giese):
>> [...] and read everywhere, that a dm-crypt
>> Partition ist mountable with "cryptsetup open" (to get my data).
> 
> Terminology: you _open_ a container, then _mount_ a possible file
> system within it. The two operations are distinct and not all
> containers will contain a file system; a canonical example of that is
> an encrypted swap partition.

You are right, my bad. I meant to open the container and mount it after 
that.

>> When presented with
>>
>> Enter passphrase for /dev/nvme0n1p3:
>> No key available with this passphrase.
> 
> As long as the header isn't corrupted (and what you posted _looks_
> sane at a glance), such issues are often caused by keymap differences.
> Try switching the keyboard layout to US English without dead keys and
> type the passphrase as normal; see if that helps.

Let me assure you, it is not the passphrase. I tried to type it plain 
and know about different keyboard layouts.

>> Before entering the passphrase it says something about /scripts/init-premount,
>> maybe there is a hint on how to mount it, but I can't find it anywhere.
> 
> That file is almost certainly within the initrd, which is why you're
> not seeing it at that path after boot.

I found it. It is a directory in /etc/ from which the initrd is build, 
but it is empty.

I managed to open the container. I added it to the /etc/crypttab of the 
working NVME and was presented with a second passphrase prompt. So the 
container was/is not corrupted. I ended up with two volume groups with 
the same name, but managed to get my data back.

But the inital question stands: Why can't I open the container with 
cryptsetup when it can be opened with the boot-mechanism?

regards
Thorsten