URL: <https://savannah.gnu.org/bugs/?68692>
Summary: LUKS2: Argon2 allocation failure is reported as
"Invalid passphrase
Group: GNU GRUB
Submitter: pandawood
Submitted: Thu 10 Sep 2026 12:26:56 AM UTC
Category: Disk & Partition
Severity: Major
Priority: 5 - Normal
Item Group: Software Error
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Unlocked
Release: Git master
Release:
Reproducibility: Every Time
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Thu 10 Sep 2026 12:26:56 AM UTC By: PandaWood <pandawood>
I had Fable help me with this, as it's a bit over my head, but I spent a while
making sure this report is as reasonable as possible.
This issue, combined with others, caused me a lot of headache so I hope to
avoid it happening again or to anyone else ;-)
-----
When GRUB cannot allocate the Argon2 work buffer for a LUKS2 keyslot, it
prints "Invalid passphrase." and prompts again. The passphrase is
correct and retyping it cannot help. The real cause is only visible with
"set debug=luks2".
Seen on GRUB 2.14 x86_64-efi, iMac Pro 2017 (Apple T2 firmware), 32 GB
RAM, largest contiguous block below 4 GiB about 1.18 GiB. Keyslots were
cryptsetup 2.8.7 defaults: argon2id, memory cost 1048576 KiB.
Steps:
1. LUKS2 volume with a default argon2id keyslot, /boot inside it.
2. Boot GRUB 2.14 on firmware with no contiguous 1 GiB block below 4 GiB.
3. Enter the correct passphrase at the cryptomount prompt.
Expected: an error such as "Argon2 key derivation failed: out of memory",
and no re-prompt.
Actual: "Invalid passphrase." instantly, then a new prompt. The same
volume opens from Linux userspace with the same passphrase.
Where the cause is lost (2.14 tag):
- grub-core/lib/libgcrypt/cipher/kdf.c:510 argon2_init: xtrymalloc of
the memory blocks fails, returns an errno-derived gcrypt code.
- grub-core/lib/crypto.c:610 grub_crypto_gcry_error maps every
non-zero gcrypt code to GRUB_ACCESS_DENIED.
- grub-core/disk/luks2.c:775 the per-slot failure is logged with
grub_dprintf only, then the loop continues.
- grub-core/disk/luks2.c:800 with no slot opened, returns
GRUB_ERR_ACCESS_DENIED "Invalid passphrase" regardless of cause.
- grub-core/disk/cryptodisk.c:1277 ACCESS_DENIED is the one code that
prints "Invalid passphrase." and re-prompts; any other code would be
shown to the user.
Suggested fix, either or both:
- grub_crypto_gcry_error: map GPG_ERR_ENOMEM to GRUB_ERR_OUT_OF_MEMORY.
cryptodisk.c would then print the real error and stop re-prompting.
- luks2_recover_key: remember when a slot fails for a reason other than
a key mismatch, and if no slot opens, report that instead of
"Invalid passphrase".
The allocation limit itself is bug #64471; this report is only about
the message. The same misdiagnosis appears in threads on the Arch,
Manjaro and CachyOS forums, all resolved by adding a pbkdf2 keyslot
after long investigation.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68692>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
