Skip to content

Commit

Permalink
zfsbootmenu: warn when canmount=on is set for root dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
zdykstra committed May 13, 2023
1 parent aca5ae1 commit f688389
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions zfsbootmenu/lib/zfsbootmenu-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ get_sort_key() {
# returns: 0 iff at least one valid BE was found

populate_be_list() {
local be_list fs mnt active candidates ret sort_key
local be_list fs canmount mnt active candidates ret sort_key

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

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

# root datasets should never be automatically mounted by the boot environment
if [ "${canmount}" = "on" ]; then
zwarn "canmount=on set for '${fs}', should be canmount=noauto"
fi

candidates+=( "${fs}" )
done <<< "$(zfs list -H -o name,mountpoint,org.zfsbootmenu:active -S "${sort_key}")"
done <<< "$(zfs list -H -o name,canmount,mountpoint,org.zfsbootmenu:active -S "${sort_key}")"

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

0 comments on commit f688389

Please sign in to comment.