Hello all,
It seems that the debconf setting 'grub2/enable_os_prober' gets reset to
false every time the package is reconfigured, possibly as part of a
package upgrade or reinstallation. When one invokes 'dpkg-reconfigure
grub-efi-amd64' (or grub-pc etc.) the previously chosen answer to the
'enable_os_prober' query is forgotten and the preselected answer is now
'No'. When dpkg-reconfigure is run with the '-phigh' option this happens
silently and os-prober is once again disabled. The same occurs when
reinstalling or upgrading the corresponding grub package.
Additional information: It turns out that the post-install script
patches /etc/default/grub here:
Yes, but by the time this postinst script is executed, debconf will have
already been misconfigured and the 'db_get grub2/enable_os_prober'
command as seen on line 401 will receive a possibly incorrect 'false'.
The double negative used in the configuration is a bit confusing,
especially once you deal with a commented line (meaning its contents are
disabled) declaring that the variable that dictates whether or not to
disable a certain setting should be set to disabled. The package script
'config' warns the reader 'Watch for the inverted logic here', and
ironically this is where the bug is at. I have attached a patch that
will rectify this issue. For simplicity I decided to compare the config
variable GRUB_DISABLE_OS_PROBER from /etc/default/grub to 'false', i.e.
a value of exactly 'false' will set the 'grub2/enable_os_prober' debconf
setting to 'true' and all other contents will result in
'grub2/enable_os_prober = false'. One could possibly expand the check to
include 0, no, False, FALSE and whatnot, but that is ultimately up to
the maintainers and I wanted to keep things simple. With this patch
applied the previously chosen answer is remembered and a
(re)installation or reconfiguration no longer changes the setting. Also,
manually uncommenting the line with GRUB_DISABLE_OS_PROBER=false (as
mentioned in the package changelog) will now result in debconf properly
changing the 'grub2/enable_os_prober' setting to 'true' the next time it
is invoked, so on upgrades and such that line will no longer be
rewritten into something that disables os-prober. Changing it to
anything other than 'false' will result in 'grub2/enable_os_prober' to
be set to 'false', and consequently the line containing
GRUB_DISABLE_OS_PROBER=whatever in /etc/default/grub will get rewritten
to the default commented '#GRUB_DISABLE_OS_PROBER=false', which means
the setting will now default to 'true', as before.
--
Kind regards,
Jordi Bosveld
diff -ur grub2-2.12~rc1.orig/debian/config.in grub2-2.12~rc1/debian/config.in
--- grub2-2.12~rc1.orig/debian/config.in 2023-10-08 13:31:00.421268494 +0200
+++ grub2-2.12~rc1/debian/config.in 2023-10-08 13:31:49.889261283 +0200
@@ -60,7 +60,11 @@
fi
# Watch for the inverted logic here...
if [ "${GRUB_DISABLE_OS_PROBER+set}" = set ]; then
- db_set grub2/enable_os_prober "false"
+ if [ "${GRUB_DISABLE_OS_PROBER}" = "false" ]; then
+ db_set grub2/enable_os_prober "true"
+ else
+ db_set grub2/enable_os_prober "false"
+ fi
fi
case @PACKAGE@ in