Re: cryptsetup - No key available with passphrase
Milan Broz <[email protected]> Thu, 2 Mar 2023 17:40:19 +0100
| Newsgroups | dev.linux.lists.cryptsetup |
|---|---|
| Message-ID | <[email protected]> |
On 3/2/23 17:23, Lars Francke wrote: > Milan, > > thank you for the quick reply. I did try that but unfortunately: > > root@archiso ~ # echo 'a' | cryptsetup luksFormat /dev/nvme0n1p5 > WARNING: Device /dev/nvme0n1p5 already contains a 'crypto_LUKS' > superblock signature. > root@archiso ~ # echo 'a' | cryptsetup luksOpen /dev/nvme0n1p5 cryptroot > No key available with this passphrase. > > > I also just used the `echo` method to make it easier to replicate. > The same happens when I just press "a" on my keyboard and hit enter. > > What makes it even weirder is that it did work _once_: Did you deactivate the device once it succeeded? Anyway, it should work as I described. Maybe you should wipe the signature before format with "wipefs -a /dev/nvme0n1p5" (but it should overwrite it anyway or print error). You can also use --test-passphrase to luksOpen to avoid activation. Milan > > # echo 'a' | cryptsetup luksFormat /dev/nvme0n1p5 > WARNING: Device /dev/nvme0n1p5 already contains a 'crypto_LUKS' > superblock signature. > # echo 'a' | cryptsetup luksOpen /dev/nvme0n1p5 cryptroot > > I'm at a loss but will now read the section in the man page that you > referred to. > > Thanks again, > Lars > On Thu, Mar 2, 2023 at 4:01 PM Milan Broz <[email protected]> wrote: >> >> 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