Hello,
I’m restructuring the data portion on this system’s ssd and created a new swap partition.
All three partitions (data, swap, root) are LUKS encrypted.
I’m passing on the data & swap passphrases via keyfiles pointed at in /etc/crypttab for smooth booting.
The data partition opens fine, but for swap I’ve to enter the passphrase during the boot process.
I can handle the swap partition just fine in the command line, but not by opening using the keyfile:
$ sudo cryptsetup -v luksOpen /dev/nvme0n1p4 cryptswap --key-file=/etc/crypttab.keyfiles
No usable token is available.
No key available with this passphrase.
Command failed with code -2 (no permission or bad passphrase).
Opening by entering the passphrase on the command line works as expected.
The configuration looks exactly the same as the data partition.
I suspected a typo, non-ascii character etc, deleted the keyfile, typed in a new one, same error.
I edited /etc/crypttab to use the same working keyfile for both partitions, changed the passphrase for the swap partition accordingly, same problem.
Manual opening always works.
I did a luksDump of both partitions and did a side-by side comparison, no obvious deviations from a nominal output.
I triple-checked the UUIDs in /etc/crypttab.
I zeroed out the swap partition, again did a luksFormat etc. - same error message.
And I while I was at it anyway I tried all this while being booted from an ISO - so the ssd wasn’t ‘live’.
Any idea what I’m missing here?
Thanks a lot, Michael.
Sorry if this is obvious, but please just clarify:
You did actually additionaly add the key file as a password to a password slot (e. g. slot 2) next to the passphrase that seems to unlock the swap device?
I’ve read your post twice but don’t quite understand the problem. You do know a key file in this context is a actual file and not a “textfile” containing your passphrase?
This works for quite some time. Otherwise I couldn’t mount the data partition.
See cryptsetup manpage: A passphrase stored in a file is called a key file. The only difference between a passphrase and a key file is that a key file can contain binary data. Both are processed the same.