URL: <https://savannah.gnu.org/bugs/?66208>
Summary: GRUB_OS_PROBER_SKIP_LIST (mis)behaviour or
documentation
Group: GNU GRUB
Submitter: billiardmarker2
Submitted: Thu 12 Sep 2024 12:51:07 PM UTC
Category: User Interface
Severity: Major
Priority: 5 - Normal
Item Group: Software Error
Status: None
Privacy: Public
Assigned to: None
Originator Name: billiardmarker2
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: other
Release:
Reproducibility: Every Time
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Thu 12 Sep 2024 12:51:07 PM UTC By: billiardmarker <billiardmarker2>
Environment: machine running in BIOS mode with GPT mass storage (though I am
sure GPT or MBR is irrelevant) with multiple Linux versions and one Windows
version installed. I use Windows so seldom on this machine that I want to
exclude Windows & Windows Recovery entries from the Grub menu items built by
the OS Prober, while keeping the other Linux versions.
Using GRUB_OS_PROBER_SKIP_LIST in /etc/default/grub provides a way to do this,
but I found the documentation in Grub 2.12 Reference section 6.1 unhelpful and
had to add diagnostics to /etc/grub.d/30_os-prober to make progress.
Specifically, just using the UUID of the filesystem of the Windows partitions
I wanted to exclude did not work, and by experiment using just the UUID of the
filesystem of a Linux partition also did not work. Grub version is
2.12-1ubuntu7, I think it's unlikely that any changes made by ubuntu project
will affect matters.
The relevant code in Grub 2.12 /etc/grub.d/30_os-prober, round about line 140,
is
for OS in ${OSPROBED} ; do
DEVICE="`echo ${OS} | cut -d ':' -f 1`"
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
BOOT="`echo ${OS} | cut -d ':' -f 4`"
if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then
EXPUUID="$UUID"
if [ x"${DEVICE#*@}" != x ] ; then
EXPUUID="${EXPUUID}@${DEVICE#*@}"
fi
if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo
${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
continue
fi
fi
.
.
where OSPROBED is a list of bootable partitions built starting from os-prober
utility output.
On my machine, the os-prober utility output for the main Windows partition is
/dev/sda5:Windows 8:Windows1:chain
and the filesystem uuid is C44C53AA4C5395D0. By adding "echo ... >&2"
statements, I can see that in BIOS mode the code gives a EXPUUID value of
C44C53AA4C5395D0@/dev/sda5 and this is then checked for a match against the
GRUB_OS_PROBER_SKIP_LIST.
This is not what the documentation says. Is this behavior intentional? It
seems perverse, having specified a unique partition id, to also have to
specify the corresponding device name - expecially since this is not
guaranteed to remain the same if the machine's mass storage configuration
changes. (If you include this EXPUUID in the GRUB_OS_PROBER_SKIP_LIST then the
specified partition is indeed skipped, so my objective of skipping the Windows
entries could be achieved.)
In UEFI mode, for a (chain-loaded) Windows installation, the EXPUUID is as
documented, <UUID>@<EFI FILE>, with the <UUID> of the efi system partition and
the <EFI FILE> specifies the path to an .efi bootstrap file, for example
647D-0FDA@/EFI/Microsoft/Boot/bootmgfw.efi from one of my other machines. (I
don't have a uefi machine where the os prober would also encounter Linux
partitions, so cannot comment on that case.)
The documentation implies that the @xxxxx part of a skip list entry is
intended to be used only for chain-loading in UEFI mode, so should be needed
in other circumstances, but as there are no explanatory comments in the code
quoted above (or indeed in the rest of the script) about what it is trying to
do it is unclear to me whether the documentation is incomplete or the code is
wrong.
See also bug #63481 against Grub 2.06 open since 07 December 2022 which
plausibly suggests that the code is wrong. Can someone who is familiar with
the design and implementation of 30_os-prober address this issue, please?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?66208>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
