From 8ac58c3f567a87cc9b69d89cd18754b5dcf20cfc Mon Sep 17 00:00:00 2001 From: Damian Szuberski <30863496+szubersk@users.noreply.github.com> Date: Sat, 13 Nov 2021 16:02:50 +0100 Subject: [PATCH] Fix `zfs:AUTO` autodetection in initramfs scripts Don't exit early in find_rootfs() when zpool.bootfs is set to `zfs:AUTO`. Reviewed-by: Richard Laager Reviewed-by: Tony Nguyen Signed-off-by: szubersk Closes #12658 --- contrib/initramfs/scripts/zfs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs index ad20eeb494..ccb42ce103 100644 --- a/contrib/initramfs/scripts/zfs +++ b/contrib/initramfs/scripts/zfs @@ -79,7 +79,9 @@ find_rootfs() # If it's already specified, just keep it mounted and exit # User (kernel command line) must be correct. - [ -n "${ZFS_BOOTFS}" ] && return 0 + if [ -n "${ZFS_BOOTFS}" ] && [ "${ZFS_BOOTFS}" != "zfs:AUTO" ]; then + return 0 + fi # Not set, try to find it in the 'bootfs' property of the pool. # NOTE: zpool does not support 'get -H -ovalue bootfs'... @@ -756,7 +758,7 @@ mountroot() # rpool=rpool (default if none of the above is used) # root=/ (uses this for rpool - first part) # root=ZFS=/ (uses this for rpool - first part, without 'ZFS=') - # root=zfs:AUTO (tries to detect both pool and rootfs + # root=zfs:AUTO (tries to detect both pool and rootfs) # root=zfs:/ (uses this for rpool - first part, without 'zfs:') # # Option could also be