Skip to content

Conversation

imlk0
Copy link
Collaborator

@imlk0 imlk0 commented Oct 9, 2025

No description provided.

…e issues in LUKS operations

Previously, the script used `-` to pass passphrase via stdin to `cryptsetup`,
which implicitly stops reading at newline. However, this behavior differs from
`--key-file=-`, which reads all input including newlines (as documented in
cryptsetup's man page).

This inconsistency could lead to decryption failures if the passphrase contains
or is followed by unexpected newlines, especially when the same input method is
expected on both `luksFormat` and `open` calls.

Changed all uses of:
  echo -n "pass" | cryptsetup ... -
to:
  echo -n "pass" | cryptsetup ... --key-file=-

This ensures consistent and predictable handling of passphrases read from stdin,
avoiding potential mismatches due to line-ending interpretation.

Also updated the Rust LUKS2 module to use `--key-file=-` for symmetry and safety.

Fixes potential issue where rootfs unlock fails despite correct passphrase.

Signed-off-by: Kun Lai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant