Skip to content
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: support mountpoint=legacy for root dataset #15149

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

rkitover
Copy link
Contributor

@rkitover rkitover commented Aug 3, 2023

Support mountpoint=legacy for the root dataset in the dracut zfs support scripts.

mountpoint=/ or mountpoint=/sysroot also works.

Change zfs-env-bootfs.service to add zfsutil to BOOTFSFLAGS only for non-legacy root datasets, using the support function determine_rootflags() added to zfs-lib.sh.

Motivation and Context

This allows using the dracut kernel commandline option root=ZFS=pool/dataset for datasets that have mountpoint=legacy set.

This is documented as already working, but it looks like once the root mount was switched to use the generator stuff it broke.

How Has This Been Tested?

I made the changes in my /usr/lib/dracut/modules.d/90zfs and reran dracut on my system, testing booting the root dataset with mountpoint being /, /sysroot and legacy.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

@rkitover
Copy link
Contributor Author

rkitover commented Aug 4, 2023

@nabijaczleweli Hi, could you take a look please?

Copy link
Contributor

@nabijaczleweli nabijaczleweli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, must've missed this use-case when converting. functionally looks sane, but see comment

Support mountpoint=legacy for the root dataset in the dracut zfs support
scripts.

mountpoint=/ or mountpoint=/sysroot also works.

Change zfs-env-bootfs.service to add zfsutil to BOOTFSFLAGS only for
root datasets with mountpoint != legacy.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
@nabijaczleweli
Copy link
Contributor

If you use 3eaacdf which has a diff -w of

diff --git a/contrib/dracut/90zfs/zfs-env-bootfs.service.in b/contrib/dracut/90zfs/zfs-env-bootfs.service.in
index 7ebab4c1a..fe362b930 100644
--- a/contrib/dracut/90zfs/zfs-env-bootfs.service.in
+++ b/contrib/dracut/90zfs/zfs-env-bootfs.service.in
@@ -12,6 +12,7 @@ ExecStart=/bin/sh -c '
     decode_root_args || exit 0;                                                                \
     [ "$root" = "zfs:AUTO" ] && root="$(@sbindir@/zpool list -H -o bootfs | grep -m1 -vFx -)"; \
     rootflags="$(getarg rootflags=)";                                                          \
+    [ "$(@sbindir@/zfs get -H -o value mountpoint "$root")" = legacy ] ||                      \
         case ",$rootflags," in                                                                 \
             *,zfsutil,*) ;;                                                                    \
             ,,) rootflags=zfsutil ;;                                                           \

(untested, but no reason it shouldn't work) then this is g2g imo.

@rkitover
Copy link
Contributor Author

rkitover commented Aug 4, 2023

Thanks for the quick response. I will test this and update the PR.

@rkitover rkitover force-pushed the dracut-legacy-root-mount branch from bf8ae34 to 3eaacdf Compare August 4, 2023 19:38
@rkitover
Copy link
Contributor Author

rkitover commented Aug 4, 2023

@nabijaczleweli tested and updated to your commit, thank you.

By the way, for future reference, how do I install just the dracut modules from the zfs tree?

@nabijaczleweli
Copy link
Contributor

idk, i just apply the diffs. but if you make install DESTDIR=/whatever you can pick out the dracut stuff from under /whatever (which may also be wrong if you otherwise have a distribution zfs installed)

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Aug 7, 2023
@behlendorf behlendorf merged commit b8c9070 into openzfs:master Aug 8, 2023
@rkitover rkitover deleted the dracut-legacy-root-mount branch August 8, 2023 18:33
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Aug 25, 2023
Support mountpoint=legacy for the root dataset in the dracut zfs support
scripts.

mountpoint=/ or mountpoint=/sysroot also works.

Change zfs-env-bootfs.service to add zfsutil to BOOTFSFLAGS only for
root datasets with mountpoint != legacy.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Closes openzfs#15149
behlendorf pushed a commit that referenced this pull request Aug 25, 2023
Support mountpoint=legacy for the root dataset in the dracut zfs support
scripts.

mountpoint=/ or mountpoint=/sysroot also works.

Change zfs-env-bootfs.service to add zfsutil to BOOTFSFLAGS only for
root datasets with mountpoint != legacy.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Closes #15149
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Dec 12, 2023
Support mountpoint=legacy for the root dataset in the dracut zfs support
scripts.

mountpoint=/ or mountpoint=/sysroot also works.

Change zfs-env-bootfs.service to add zfsutil to BOOTFSFLAGS only for
root datasets with mountpoint != legacy.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Closes openzfs#15149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants