#960565 grub-common: update-grub ignores os-prober when not told to do so (no automatic dual boot with FreeBSD)

Package:
grub-common
Source:
grub2
Description:
GRand Unified Bootloader (common files)
Submitter:
Leandro Doctors
Date:
2021-12-10 11:00:04 UTC
Severity:
important
#960565#5
Date:
2020-05-14 01:16:19 UTC
From:
To:
Dear Maintainer,

I am trying to dual-boot Debian and FreeBSD. It seems update-grub ignores os-
prober when adding options to the boot menu.

FreeBSD is correctly detected by os-prober.

```
% sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.6.0-1-amd64
Found initrd image: /boot/initrd.img-5.6.0-1-amd64
Found FreeBSD 13.0-CURRENT on /dev/sda6
Adding boot menu entry for EFI firmware configuration
done
```

However, even after a 'grub-install', there is no FreeBSD menu entry in GRUB...

I have already checked /etc/default/grub, and there is no mention to
"GRUB_DISABLE_OS_PROBER"...

```
% more /etc/default/grub |grep DISABLE
#GRUB_DISABLE_LINUX_UUID=true
#GRUB_DISABLE_RECOVERY="true"
```

I have already read
https://wiki.debian.org/Grub#Dual_Boot_FreeBSD_with_GPT_partition.

However, I think that the manual modification of
`/etc/grub.d/40_custom` specified there implies an unnecessary
nuisance...

Shouldn't dual boot functionality work 'out-of-the-box' for any
detected other system? For instance, when a Microsoft Windows system is
detected, it is added by default to the GRUB menu. Why not applying the same
logic to FreeBSD? (or any other system)

Thank you for considering my request, dear Maintainer.

Sincerely,
Leandro Doctors
    esac
    prepare_grub_to_access_device `${grub_probe} --target=device
"$GRUB_BACKGROUND"`
    cat << EOF
insmod $reader
background_image -m stretch `make_system_path_relative_to_its_root
"$GRUB_BACKGROUND"`
EOF
    fi
fi
make_timeout ()
{
    cat << EOF
if [ "\${recordfail}" = 1 ] ; then
  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
else
EOF
    if [ "x${3}" != "x" ] ; then
    timeout="${2}"
    style="${3}"
    elif [ "x${1}" != "x" ] && \
     ([ "$quick_boot" = 1 ] || [ "x${1}" != "x0" ]) ; then
    # Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
    timeout="${1}"
    if [ "x${2}" != "x0" ] ; then
        grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value
when GRUB_HIDDEN_TIMEOUT is set is no longer supported.")"
    fi
    if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
        style="hidden"
        verbose=
    else
        style="countdown"
        verbose=" --verbose"
    fi
    else
    # No hidden timeout, so treat as GRUB_TIMEOUT_STYLE=menu
    timeout="${2}"
    style="menu"
    fi
    cat << EOF
  if [ x\$feature_timeout_style = xy ] ; then
    set timeout_style=${style}
    set timeout=${timeout}
EOF
    if [ "x${style}" = "xmenu" ] ; then
    cat << EOF
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=${timeout}
EOF
    else
    cat << EOF
  # Fallback hidden-timeout code in case the timeout_style feature is
  # unavailable.
  elif sleep${verbose} --interruptible ${timeout} ; then
    set timeout=0
EOF
    fi
    cat << EOF
  fi
fi
EOF
if [ "$recordfail_broken" = 1 ]; then
  cat << EOF
if [ \$grub_platform = efi ]; then
  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
  if [ x\$feature_timeout_style = xy ] ; then
    set timeout_style=menu
  fi
fi
EOF
fi
}
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
    cat <<EOF
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
EOF
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
"${GRUB_TIMEOUT_STYLE_BUTTON}"
echo else
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
echo fi
else
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
fi
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [
"x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then
    cat <<EOF
cmosclean $GRUB_BUTTON_CMOS_ADDRESS
EOF
fi
if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then
  echo "play ${GRUB_INIT_TUNE}"
fi
if [ "x${GRUB_BADRAM}" != "x" ] ; then
  echo "badram ${GRUB_BADRAM}"
fi

#960565#10
Date:
2020-05-14 01:29:09 UTC
From:
To:

#960565#15
Date:
2021-12-10 10:46:58 UTC
From:
To:
Hi,

Happening for me too. Worked around by commenting the "exit 0" line in
/etc/grub.d/30_os-prober.

It's strange, though, because the bug was originally reported half 2020;
while my computer (installed during 2021) started displaying the bug
only today. Probably the bug is triggered by some combination of other
factors.

Giovanni.