Skip to content

Commit f688389

Browse files
committed
zfsbootmenu: warn when canmount=on is set for root dataset
1 parent aca5ae1 commit f688389

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

zfsbootmenu/lib/zfsbootmenu-lib.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ get_sort_key() {
546546
# returns: 0 iff at least one valid BE was found
547547

548548
populate_be_list() {
549-
local be_list fs mnt active candidates ret sort_key
549+
local be_list fs canmount mnt active candidates ret sort_key
550550

551551
be_list="${1}"
552552
if [ -z "${be_list}" ]; then
@@ -561,7 +561,7 @@ populate_be_list() {
561561
: > "${be_list}"
562562

563563
# Find valid BEs
564-
while IFS=$'\t' read -r fs mnt active; do
564+
while IFS=$'\t' read -r fs canmount mnt active; do
565565
if [ "${mnt}" = "/" ]; then
566566
# When mountpoint=/, BE is a candidate unless org.zfsbootmenu:active=off
567567
[ "${active}" = "off" ] && continue
@@ -577,8 +577,13 @@ populate_be_list() {
577577
continue
578578
fi
579579

580+
# root datasets should never be automatically mounted by the boot environment
581+
if [ "${canmount}" = "on" ]; then
582+
zwarn "canmount=on set for '${fs}', should be canmount=noauto"
583+
fi
584+
580585
candidates+=( "${fs}" )
581-
done <<< "$(zfs list -H -o name,mountpoint,org.zfsbootmenu:active -S "${sort_key}")"
586+
done <<< "$(zfs list -H -o name,canmount,mountpoint,org.zfsbootmenu:active -S "${sort_key}")"
582587

583588
# put bootfs on the end, so it is shown first with --tac
584589
[ -n "${BOOTFS}" ] && candidates+=( "${BOOTFS}" )

0 commit comments

Comments
 (0)