-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
initramfs: fix import of additional zpools on boot #13543
base: master
Are you sure you want to change the base?
initramfs: fix import of additional zpools on boot #13543
Conversation
it would be best if there were an option to reuse the same key for all pools that we try to import. |
if the key for the 2nd pool is set as a file on the first pool, does keylocation need to be prefixed via |
Just tested it, if your key is Unlocking then works with only the passphrase provided for
|
so there's two initramfs subsystems and one is the initramfs-tools which you've pushed this for and the other is dracut. it would be most excellent to keep them at feature-parity and include the fix in both environments, where applicable. i would still prefer if we use |
Thank you for the explanation, didn't know that! It would be more user friendly if the user could ignore the prefix at all when setting the keylocation and the scripts add the prefix according to the environment. I would try to implement this as well. |
If this PR is ready for review would you mind rebasing it on current master branch, squashing the commits, and force updating the PR. |
Currently all zpools defined in ZFS_INITRD_ADDITIONAL_DATASETS aren't imported correctly if they are on an other zpool than the root-pool. The mount fails hence the zpool is not known. Initramfs asks know for the second decryption-key on boot for second zpool. Signed-off-by: theQuestionmark <[email protected]>
Adding function for honoring the ZFS_INITRD_ADDITIONAL_DATASETS variable. Signed-off-by: theQuestionmark <[email protected]>
Change /etc/ to sysconfdir-variable and add default-config to dracut initrd-image Signed-off-by: theQuestionmark <[email protected]>
d1c9527
to
9f2fd46
Compare
I rebased to the master-branch, squashed the commits and from the master i tried to force update this branch. The squashed commit is here: theQuestionmark@bdc327e |
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.
@nabijaczleweli would you mind looking at this.
@@ -75,6 +93,14 @@ check() { | |||
# shellcheck disable=SC2154 | |||
if [ -n "$hostonly" ]; then | |||
|
|||
if [ -f @sysconfdir@/default/zfs ]; then |
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.
Nowhere else in the dracut config do we source @sysconfdir@/default/zfs
for environment variables. If we need to be able to specify this we should do it in a way which is consistent the the design described in man/man7/dracut.zfs.7
.
The i-t bit makes sense, even if it's only preferable to have it in the part where we already process for fs in $ZFS_INITRD_ADDITIONAL_DATASETS; do
import_pool "${fs%%/*}"
mount_fs "$fs"
done Although, notably, diff --git a/etc/default/zfs.in b/etc/default/zfs.in
index ae813e9de..8db0dc451 100644
--- a/etc/default/zfs.in
+++ b/etc/default/zfs.in
@@ -1,7 +1,7 @@
# OpenZFS userland configuration.
# shellcheck disable=SC2154
-# NOTE: This file is intended for sysv init and initramfs.
+# NOTE: This file is intended for SysV init and initramfs-tools.
# Changing some of these settings may not make any difference on
# systemd-based setup, e.g. setting ZFS_MOUNT=no will not prevent systemd
# from launching zfs-mount.service during boot.
@@ -109,3 +109,7 @@ ZFS_DKMS_DISABLE_STRIP='no'
# Optional arguments for the ZFS Event Daemon (ZED).
# See zed(8) for more information on available options.
#ZED_ARGS="-M"
+
+# Datasets to mount (and pools to import) after the children of the boot dataset
+# in the initrd
+#ZFS_INITRD_ADDITIONAL_DATASETS= would be great if we're already touching it. Those two bits would be fine to include. I have no polite words to say about the dracut parts, and I'm not sure what OP is trying to do there. Get rid of them, a sensible implementation that addresses this can probably be invented if there's demand. |
Hi, Thank you, @theQuestionmark! Could you please review the remaining comments so it can be merged? Also, not directly related to this PR, but how do you specify additional pools in What helped me was modifying It seems the original Many thanks! |
Motivation and Context
Currently all zpools defined in ZFS_INITRD_ADDITIONAL_DATASETS
aren't imported correctly if they are on an other zpool than
the root-pool. The mount fails hence the zpool is not known.
Initramfs asks know for the second decryption-key on boot for
second zpool.
Fixes the following issue:
zfsonlinux/pkg-zfs#237
Description
Adding a for-loop after the rpool gets imported, execs only if ZFS_INITRD_ADDITIONAL_DATASETS is set in /etc/default/zfs.
The import is only done for zpools which are under the root-pool-base.
The script is going to import the additional zpools but does not succeed
because the zpool isn't imported when the mount is going to happen.
How Has This Been Tested?
Tested on Debian 11 with kernel 5.10.0-14-amd64 and with the following zpools:
Where the
rpool
and thevmpool
are encrypted with zfs native encryption.Now the zfsunlock-script askes also for the key of the vmpool and it's mounted according the defined mountpoint.
Types of changes
Checklist:
Signed-off-by
.