<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello all,</p>
<p>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.</p>
<p>
<blockquote type="cite">
<pre class="message">Additional information: It turns out that the post-install script
patches /etc/default/grub here:</pre>
</blockquote>
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'.<br>
</p>
<p>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.<br>
</p>
<pre class="moz-signature" cols="72">--
Kind regards,
Jordi Bosveld</pre>
</body>
</html>