Skip to content

Commit 5688c39

Browse files
Baughnwizeman
authored andcommitted
zfs: Keep trying root import until it works
Works around #11003. (cherry picked from commit 98b213a) Reason: several people cannot boot with ZFS on NVMe
1 parent 81a8ce8 commit 5688c39

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • nixos/modules/tasks/filesystems

nixos/modules/tasks/filesystems/zfs.nix

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,19 @@ in
228228
esac
229229
done
230230
''] ++ (map (pool: ''
231-
echo "importing root ZFS pool \"${pool}\"..."
232-
zpool import -d ${cfgZfs.devNodes} -N $ZFS_FORCE "${pool}"
231+
echo -n "importing root ZFS pool \"${pool}\"..."
232+
trial=0
233+
until msg="$(zpool import -d ${cfgZfs.devNodes} -N $ZFS_FORCE '${pool}' 2>&1)"; do
234+
sleep 0.25
235+
echo -n .
236+
trial=$(($trial + 1))
237+
if [[ $trial -eq 60 ]]; then
238+
echo
239+
echo "$msg"
240+
break
241+
fi
242+
done
243+
echo
233244
'') rootPools));
234245
};
235246

0 commit comments

Comments
 (0)