Re: cryptsetup - No key available with passphrase

Milan Broz <[email protected]>
Newsgroups dev.linux.lists.cryptsetup
Message-ID <[email protected]>
On 3/2/23 15:03, Lars Francke wrote:
> Hello,
> 
> I am trying to setup LUKS (and I've done it like this in the past,
> like...two weeks ago and it just stopped working) and am running into
> the following issue:
> 
> root@archiso ~ # echo 'a' | cryptsetup  luksFormat --batch-mode /dev/nvme0n1p5 -
> root@archiso ~ # echo 'a' | cryptsetup luksOpen /dev/nvme0n1p5 cryptroot -
> No key available with this passphrase.

This is just a little bit confusing handling of end-of-line if used with "-"
(see section "Passphrase processing for LUKS" in man cryptsetup).

The first command will create passphrase "a\n" (including \n !) while the second
command will process only "a" (you can to use --key-file=- there for luksOpen,
it has different syntax.)

But just do not use "-" here, cryptsetup will do what needed automatically.
Also batch mode is implicit if it detects pipe input, so just use:

# echo 'a' | cryptsetup luksFormat /dev/nvme0n1p5
# echo 'a' | cryptsetup luksOpen /dev/nvme0n1p5 cryptroot

and it should work as expected (password will be "a").

Milan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.