Page 2 of 2

Re: How to change Grub menu item description

Posted: Sun Mar 03, 2024 10:14 pm
by fehlix
fbagnato wrote: Sun Mar 03, 2024 9:36 pm

Code: Select all

Found Windows Vista on /dev/sda1
Found Windows Vista on /dev/sda2
done
Both entries should not be there.
I guess that looks like a "bug" in os-prober:
For now add 2nd line so you have this two lines within /etc/default/grub:

Code: Select all

GRUB_OS_PROBER_SKIP_LIST="B22CF5132CF4D2F9 2C88743C8874071C"
GRUB_OS_PROBER_SKIP_LIST="$GRUB_OS_PROBER_SKIP_LIST B22CF5132CF4D2F9@/dev/sda1 2C88743C8874071C@/dev/sda2"
and post "sudo update-grub" again.
Will check this later, whether it's a bug or something we might have overlooked during upgrade to latest grub on bookworm.

Re: How to change Grub menu item description

Posted: Mon Mar 04, 2024 5:14 am
by fehlix
fbagnato wrote: Sun Mar 03, 2024 9:36 pm

Code: Select all

Found Windows Vista on /dev/sda1
Found Windows Vista on /dev/sda2
done
Yep, found it, that's a bug in os-prober, esp. within the file /etc/grub.d/30_os-prober
Which you can fix by running this:

Code: Select all

sudo sed -i '/ x /s// x"${DEVICE}" /' /etc/grub.d/30_os-prober
With this fix you can keep just this line

Code: Select all

GRUB_OS_PROBER_SKIP_LIST="B22CF5132CF4D2F9 2C88743C8874071C"
within /etc/default/grub.
And do run again

Code: Select all

sudo update-grub
to confirm the skip-list was recognized.

B/c device names like /dev/sda1 can change in case the kernel decides
to give it another name like /dev/sdb1, which may happen if you have a usb-stick
plugged in.

FWIW, for the record: Explaination of the "bug" and the fix
They try to check whether the device found contains a "@"sign, but fail with

Code: Select all

    if [ x"${DEVICE#*@}" != x  ] ; then
      EXPUUID="${EXPUUID}@${DEVICE#*@}"
    fi
b/c x"${DEVICE#*@}" is never x but is just the device if there is no @-sign
and wrongly add the whole device to the UUID
The fix to check for the at-sigh is this

Code: Select all

    if [ x"${DEVICE#*@}" != x"${DEVICE}" ] ; then
      EXPUUID="${EXPUUID}@${DEVICE#*@}"
    fi

Re: How to change Grub menu item description

Posted: Tue Mar 05, 2024 2:47 am
by fbagnato
Hello fehlix,

Read elsewhere that the correct format of the GRUB_OS_PROBER_SKIP_LIST is GRUB_OS_PROBER_SKIP_LIST=UUID@/dev/????

So, I modified the

Code: Select all

GRUB_OS_PROBER_SKIP_LIST="B22CF5132CF4D2F9 2C88743C8874071C"
To read

Code: Select all

GRUB_OS_PROBER_SKIP_LIST="B22CF5132CF4D2F9@/dev/sda1 2C88743C8874071C@/dev/sda2"
Then reran

Code: Select all

sudo update-grub
This worked, leaving the 2 modified Windows Vista entries in the Grub menu.

Thanks very much for all your help fehlix.

Regards,

fbagnato

Re: How to change Grub menu item description

Posted: Tue Mar 05, 2024 7:49 am
by fehlix
Good, that it worked.
Anway, some comments:
fbagnato wrote: Tue Mar 05, 2024 2:47 am Read elsewhere that the correct format of the GRUB_OS_PROBER_SKIP_LIST is GRUB_OS_PROBER_SKIP_LIST=UUID@/dev/????

So, I modified the

Code: Select all

GRUB_OS_PROBER_SKIP_LIST="B22CF5132CF4D2F9 2C88743C8874071C"
To read

Code: Select all

GRUB_OS_PROBER_SKIP_LIST="B22CF5132CF4D2F9@/dev/sda1 2C88743C8874071C@/dev/sda2"
As mentioned in above post #12, the way to add UUID@device works b/c of the discovered "bug" in os-prober (package grub-common: file /etc/grub.d/30_os-prober).
But, as soon as the kernel decides to give another name to the device and partition e.g instead of /dev/sda1 it would suddenly show up as e.g. /dev/sdb1, the UUID@/device would suddenly not work anymore.
So, even when os-prober get's fixed, either within MX only or maybe by Debian, this workaround UUID@device may not work any longer.
Hence my advice given in post #11 to use both entries

Code: Select all

UUID UUID@/device
which would work even after os-prober get fixed.

The intended corrected way is mentioned in the GRUB documentation:
GNU GRUB Manual: 6.1 Simple configuration handling wrote:
‘GRUB_OS_PROBER_SKIP_LIST’

List of space-separated FS UUIDs of filesystems to be ignored from os-prober output.
For efi chainloaders it’s <UUID>@<EFI FILE>
but unfortunately wrongly implemented, so for now use the work around, but keep in mind, it may not work, in case the device get's another name assigned by the kernel.