-
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
dracut/zfs-load-key.sh: properly remove prefixes #9520
Conversation
Removes the 'ZFS=' prefix from $BOOTFS instead of $root. This makes sure that the 'zfs:' prefix remains stripped so that users with 'root=zfs:dataset' cmdline can have key loaded on boot again. Signed-off-by: Hiếu Lê <leorize+oss@disroot.org>
Codecov Report
@@ Coverage Diff @@
## master #9520 +/- ##
==========================================
- Coverage 79.11% 79.03% -0.09%
==========================================
Files 416 416
Lines 123652 123652
==========================================
- Hits 97831 97728 -103
- Misses 25821 25924 +103
Continue to review full report at Codecov.
|
@dacianstremtan @ghfields would you mind reviewing this proposed fix. |
I am unable to replicate the problem. EDIT. Finally I was able to duplicate the issue on CentOS 7.7 On my system the zfs-load-key.sh early terminated because zfs-import-cache.service was failing. The pool was imported by the zfs-mount.sh script afterwards. |
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.
The suggested line fixes the issue, but I would suggest a different approach:
BOOTFS="${root##ZFS=}" || BOOTFS="${root##zfs:}"
It will chose one of them based on the the root=zfs:rpool/dataset or root=ZFS=rpool/dataset, also easier to read the code.
@dacianstremtan and I worked side-by-side on this one. His suggested modification processes both instances using the same format and builds in a framework for any future checks to be cleanly added. |
I'm rather certain that parameter expansion doesn't work like this... |
Thanks everyone for the feedback. Let's go with the change as proposed. |
Removes the 'ZFS=' prefix from $BOOTFS instead of $root. This makes sure that the 'zfs:' prefix remains stripped so that users with 'root=zfs:dataset' cmdline can have key loaded on boot again. Reviewed-by: Garrett Fields <ghfields@gmail.com> Reviewed-by: Dacian Reece-Stremtan <dacianstremtan@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Hiếu Lê <leorize+oss@disroot.org> Closes openzfs#9520
Removes the 'ZFS=' prefix from $BOOTFS instead of $root. This makes sure that the 'zfs:' prefix remains stripped so that users with 'root=zfs:dataset' cmdline can have key loaded on boot again. Reviewed-by: Garrett Fields <ghfields@gmail.com> Reviewed-by: Dacian Reece-Stremtan <dacianstremtan@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Hiếu Lê <leorize+oss@disroot.org> Closes openzfs#9520
Removes the 'ZFS=' prefix from $BOOTFS instead of $root. This makes sure that the 'zfs:' prefix remains stripped so that users with 'root=zfs:dataset' cmdline can have key loaded on boot again. Reviewed-by: Garrett Fields <ghfields@gmail.com> Reviewed-by: Dacian Reece-Stremtan <dacianstremtan@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Hiếu Lê <leorize+oss@disroot.org> Closes openzfs#9520
Removes the 'ZFS=' prefix from $BOOTFS instead of $root. This makes sure that the 'zfs:' prefix remains stripped so that users with 'root=zfs:dataset' cmdline can have key loaded on boot again. Reviewed-by: Garrett Fields <ghfields@gmail.com> Reviewed-by: Dacian Reece-Stremtan <dacianstremtan@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Hiếu Lê <leorize+oss@disroot.org> Closes #9520
Motivation and Context
If the
root
is passed to the kernel like this:root=zfs:zroot/sys/def
, then on boot, you'll receive a message like this:Then the encryption key prompt will not show up, making the system unbootable (if you use encryption).
How Has This Been Tested?
Booted my machine with it.
Types of changes
Checklist:
Signed-off-by
.