-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Plymouth passphrase prompt in initramfs script #9202
Conversation
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). I have changed the script to have Plymouth pipe the key to zfs instead. Signed-off-by: Richard Allen <belperite@gmail.com>
This looks generally correct. Why is the loadkey_stdin function required, as opposed to just piping to |
Codecov Report
@@ Coverage Diff @@
## master #9202 +/- ##
==========================================
+ Coverage 79.22% 79.27% +0.05%
==========================================
Files 400 400
Lines 122001 122001
==========================================
+ Hits 96656 96718 +62
+ Misses 25345 25283 -62
Continue to review full report at Codecov.
|
I agree with @rlaager . It would be preferred if we can get by without another function. Additionally, the single quote was added during code review. It was also added to dracut in #8114 . Is it functioning properly over there? Stepping back, could this have to do with which shell used? Not an argument for not fixing, but an explanation why only some people are experiencing it (see #8306 (comment)). I also have a coworker reporting that he believes this broke on his system after updates. He just removed the single quotes since he didn't have to worry about spaces. |
@rlaager The function was just to try and keep in with the idea of the original DECRYPT_CMD - having the command defined in one place whilst being used in multiple places. Am happy to change to direct piping though if that's what is preferred? @ghfields The shell I use is the default one in Buster at installation time. I didn't have time to test Dracut sadly - I just needed my desktop up and running ASAP for work. However, see below: contrib/dracut/90zfs/mount-zfs.sh.in:
Unfortunately, it looks like ask_for_password in Dracut (dracut/modules.d/90crypt/crypt-lib.sh) is a wrapper that calls Plymouth like so:
If broken, fixing this for Dracut may have wider implications? |
As per community suggestion, have changed zfs load-key to direct piping. Signed-off-by: Richard Allen <belperite@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Like the more uniform look.
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 <rlaager@wiktel.com> Reviewed-by: Garrett Fields <ghfields@gmail.com> Signed-off-by: Richard Allen <belperite@gmail.com> Issue openzfs#9193 Closes openzfs#9202
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 <rlaager@wiktel.com> Reviewed-by: Garrett Fields <ghfields@gmail.com> Signed-off-by: Richard Allen <belperite@gmail.com> Issue openzfs#9193 Closes openzfs#9202
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 <rlaager@wiktel.com> Reviewed-by: Garrett Fields <ghfields@gmail.com> Signed-off-by: Richard Allen <belperite@gmail.com> Issue openzfs#9193 Closes openzfs#9202
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 <rlaager@wiktel.com> Reviewed-by: Garrett Fields <ghfields@gmail.com> Signed-off-by: Richard Allen <belperite@gmail.com> Issue openzfs#9193 Closes openzfs#9202
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 <rlaager@wiktel.com> Reviewed-by: Garrett Fields <ghfields@gmail.com> Signed-off-by: Richard Allen <belperite@gmail.com> Issue openzfs#9193 Closes openzfs#9202
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 <rlaager@wiktel.com> Reviewed-by: Garrett Fields <ghfields@gmail.com> Signed-off-by: Richard Allen <belperite@gmail.com> Issue openzfs#9193 Closes openzfs#9202
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 <rlaager@wiktel.com> Reviewed-by: Garrett Fields <ghfields@gmail.com> Signed-off-by: Richard Allen <belperite@gmail.com> Issue #9193 Closes #9202
plymouth --command splits the command on spaces which means that zfs-load-key was getting the filesystem name enclosed in single quotes (since 13c59bb) and failing. This commit fixes it by piping the password directly to the command similar to how it's done in other scripts (initramfs, dracut without plymouth). Signed-off-by: Michal Vasilek <michal@vasilek.cz> Related-to: openzfs#9193 Related-to: openzfs#9202
plymouth --command splits the command on spaces which means that zfs-load-key was getting the filesystem name enclosed in single quotes (since 13c59bb) and failing. This commit fixes it by piping the password directly to the command similar to how it's done in other scripts (initramfs, dracut without plymouth). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Michal Vasilek <michal@vasilek.cz> Related-to: #9193 Related-to: #9202 Closes #12147
plymouth --command splits the command on spaces which means that zfs-load-key was getting the filesystem name enclosed in single quotes (since 13c59bb) and failing. This commit fixes it by piping the password directly to the command similar to how it's done in other scripts (initramfs, dracut without plymouth). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Michal Vasilek <michal@vasilek.cz> Related-to: openzfs#9193 Related-to: openzfs#9202 Closes openzfs#12147
Motivation and Context
In issue #9193 I found that 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 tozfs 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).Description
I have updated the script to have Plymouth and systemd pipe the key to
zfs load-key
instead, which removes the obstacle of Plymouth passing through arguments which contain spaces via--command
.How Has This Been Tested?
I have tested this on my own desktop machine, updating the initramfs and rebooting upon each change to ensure the script continues working in a real environment.
Types of changes
Checklist:
Signed-off-by
.