Bug#1052690: grub2: post-install script overrides manual changes to GRUB_DISABLE_OS_PROBER
Sorry, I never tested whether the setting actually persists; I just hoped that it would. But indeed it is not; I had to manually intervene once again. Jordi's analysis and patch look plausible to me. It might be slightly better to compare "${GRUB_DISABLE_OS_PROBER}" to "true" instead of "false" (swapping the branches of the conditional), since that's what /etc/grub.d/30_os-prober does. Thanks, Bertram
Bug#1052690: grub2: post-install script overrides manual changes to GRUB_DISABLE_OS_PROBER
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
Bug#1052690: grub2: post-install script overrides manual changes to GRUB_DISABLE_OS_PROBER
Agustin Martin wrote: > I have my 'local-settings.cfg' in that dir and works as expected. > > Does using '/etc/default/grub.d/99-osprober.cfg' work? That does work. As far as I can make out, the directory ships empty (though other packages may add stuff there), so it's hard to find out about that required extension. Not sure where that information belongs... ideas: - /etc/default/grub.d/README - /etc/default/grub - the `grub` texinfo document? That documents /etc/default/grub but not the /etc/default/grub.d override. But I haven't checked whether that's a grub feature or something added by Debian. Cheers, Bertram
Bug#1052690: grub2: post-install script overrides manual changes to GRUB_DISABLE_OS_PROBER
On Tue, Sep 26, 2023 at 09:38:22AM +0200, Bertram Felgenhauer wrote: > Package: grub2 > Version: 2.12~rc1-10 > > It's also worth noting that `update-grub` does not appear to pick up > files from `/etc/default/grub.d` so putting the setting there is > ineffective. (I put the setting into `/etc/default/grub.d/99-osprober` > and update-grub didn't pick it up in my test.) Hi, I have my 'local-settings.cfg' in that dir and works as expected. Does using '/etc/default/grub.d/99-osprober.cfg' work? Regards, -- Agustin
Bug#1052690: grub2: post-install script overrides manual changes to GRUB_DISABLE_OS_PROBER
Package: grub2 Version: 2.12~rc1-10 Dear Maintainer, * What led up to the situation? An update of grub a while ago changed the default os-prober behavior; see also #1038974. * What exactly did you do (or not do) that was effective (or ineffective)? I edited /etc/default/grub to reenable os-prober. * What was the outcome of this action? While at first effective, subsequent updates of grub reset the default each time. (It took me a while to realize this.) * What outcome did you expect instead? I expected the setting to stick when grub is updated. Additional information: It turns out that the post-install script patches /etc/default/grub here: https://git.launchpad.net/ubuntu/+source/grub2/tree/debian/postinst.in?h=debian/sid=f85ded33219dc350d3ef96caa9d1ce118247b086#n398 It's also worth noting that `update-grub` does not appear to pick up files from `/etc/default/grub.d` so putting the setting there is ineffective. (I put the setting into `/etc/default/grub.d/99-osprober` and update-grub didn't pick it up in my test.) The proper solution for now appears to be to run `dpkg-reconfigure grub-efi-amd64` (Would other grub packages work too? This is the package that owns the corresponding debconf setting `grub2/enable_os_prober` for me) Ideally, I'd prefer the manual edits to be recognized and kept. But at the very least, please add a comment in /etc/default/grub to point towards a reliable way of changing this setting. And maybe add a hint to the warning messages that update-grub prints about os-prober?