From 94975ff79b3a4b6f6e4a401e8cd54aca614dc6b8 Mon Sep 17 00:00:00 2001 From: Turbo Fredriksson Date: Thu, 4 Dec 2025 13:57:39 +0000 Subject: [PATCH] Fix issue with finding degraded pool(s). When a pool is degraded, or needs special action, the `zpool import` (without pool to import) line will report: ``` pool: rpool id: 01234567890123456789 state: ONLINE action: The pool can be imported using its name or numeric identifier. config: [..] ``` If the import with the pool name fails, it is supposed to try importing using the pool ID. However, the script is also getting the `action` line (and probably `scrub:` if/when that's available): pool; The pool can be imported using its name or numeric identifier.;config:; which causes issues on consequent import attempts. Cleanup the information by rewriting the `sed` command line. Reviewed by: Brian Behlendorf Reviewed-by: Rob Norris Signed-off-by: Turbo Fredriksson Closes #18000 --- contrib/initramfs/scripts/zfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs index 7944ea5b0..390fa89df 100644 --- a/contrib/initramfs/scripts/zfs +++ b/contrib/initramfs/scripts/zfs @@ -107,7 +107,7 @@ find_rootfs() find_pools() { _find_pools=$("${@}" 2> /dev/null | \ - sed -Ee '/pool:|^[a-zA-Z0-9]/!d' -e 's@.*: @@' | \ + sed -Ee '/ pool: | id: /!d' -e 's@.*: @@' | \ tr '\n' ';') echo "${_find_pools%%;}" # Return without the last ';'.