diff options
author | Richard Allen <[email protected]> | 2019-08-27 21:44:02 +0100 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2019-09-25 11:27:50 -0700 |
commit | ea34735203a259f331dc549c25c7ed92b34cd470 (patch) | |
tree | c39f6503fa470d58cefe06ff0d40d6a7e52dcd08 /contrib | |
parent | 95319fc569cf1ab322926f037b92dd4fd15b5630 (diff) |
Fix Plymouth passphrase prompt in initramfs script
Entering the ZFS encryption passphrase under Plymouth wasn't working
because in the ZFS initrd script, Plymouth was calling zfs via
"--command", which wasn't passing through the filesystem argument to
zfs load-key properly (it was passing through the single quotes around
the filesystem name intended to handle spaces literally,
which zfs load-key couldn't understand).
Reviewed-by: Richard Laager <[email protected]>
Reviewed-by: Garrett Fields <[email protected]>
Signed-off-by: Richard Allen <[email protected]>
Issue #9193
Closes #9202
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/initramfs/scripts/zfs.in | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/initramfs/scripts/zfs.in b/contrib/initramfs/scripts/zfs.in index ad604a82c..05410ea2b 100644 --- a/contrib/initramfs/scripts/zfs.in +++ b/contrib/initramfs/scripts/zfs.in @@ -411,29 +411,29 @@ decrypt_fs() # Determine dataset that holds key for root dataset ENCRYPTIONROOT=$(${ZFS} get -H -o value encryptionroot "${fs}") - DECRYPT_CMD="${ZFS} load-key '${ENCRYPTIONROOT}'" # If root dataset is encrypted... if ! [ "${ENCRYPTIONROOT}" = "-" ]; then - + TRY_COUNT=3 # Prompt with plymouth, if active if [ -e /bin/plymouth ] && /bin/plymouth --ping 2>/dev/null; then - plymouth ask-for-password --prompt "Encrypted ZFS password for ${ENCRYPTIONROOT}" \ - --number-of-tries="3" \ - --command="${DECRYPT_CMD}" + while [ $TRY_COUNT -gt 0 ]; do + plymouth ask-for-password --prompt "Encrypted ZFS password for ${ENCRYPTIONROOT}" | \ + $ZFS load-key "${ENCRYPTIONROOT}" && break + TRY_COUNT=$((TRY_COUNT - 1)) + done # Prompt with systemd, if active elif [ -e /run/systemd/system ]; then - TRY_COUNT=3 while [ $TRY_COUNT -gt 0 ]; do systemd-ask-password "Encrypted ZFS password for ${ENCRYPTIONROOT}" --no-tty | \ - ${DECRYPT_CMD} && break + $ZFS load-key "${ENCRYPTIONROOT}" && break TRY_COUNT=$((TRY_COUNT - 1)) done # Prompt with ZFS tty, otherwise else - eval "${DECRYPT_CMD}" + $ZFS load-key "${ENCRYPTIONROOT}" fi fi fi |