Re: [PATCH] Change "efi" to "EFI" in grub-mkrescue for secure boot
On 07/09/2024 at 10:30, Thomas Schmitt via Grub-devel wrote: Pascal Hambourg wrote: When booting from a EFI partition on a regular disk, then $root is set to the EFI partition (hdX,Y). When booting from a EFI El Torito image on a CD, then $root is set to the whole CD (cdX), and the El Torito image is not visible. (...) There remains my curiosity why this difference between booting via El Torito and via partition table from the same FAT filesystem exists and whether this is a bug. From what I can see in EFI shell, UEFI maps El Torito images as block devices, like partitions, but I suppose that GRUB uses only block devices which map to entire drives and maps partitions with its own partition table drivers (and has no El Torito driver). ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] Change "efi" to "EFI" in grub-mkrescue for secure boot
On 06/09/2024 at 15:15, Askar Safin wrote: While testing this script I noticed this: if I boot from disk (i. e. using "-drive" Qemu option), then "grub.cfg" is read from ESP, i. e. FAT. But if I boot from CD (i. e. using "-cdrom" Qemu option), then "grub.cfg" is read from main .iso partition, i. e. iso9660. I don't know whether this is expected behavior or just a bug. I do not know either, but it matches my previous observation. When booting from a EFI partition on a regular disk, then $root is set to the EFI partition (hdX,Y). When booting from a EFI El Torito image on a CD, then $root is set to the whole CD (cdX), and the El Torito image is not visible. FAT is case insensitive from GRUB point of view. But iso9660 is case sensitive. So, the file (in case of CD boot) must be named exactly /EFI/debian/grub.cfg. Name /efi/debian/grub.cfg will not work, I faced a similar issue when trying to use $cmdpath instead of the hardcoded prefix /EFI/debian; the case in $cmdpath is variable and depends on the UEFI firmware and boot method (from EFI boot entry, select boot device, select EFI file). I have seen "/EFI/BOOT" most often but also "/EFI/Boot" and "/efi/boot". On 06/09/2024 at 20:09, Thomas Schmitt wrote: I can confirm that many distro ISOs have a copy of the file tree of their EFI system partition as file tree "/EFI/boot" in the ISO 9660 filesystem. Nobody seems to complain about the mixed case. This copy normally plays no role in booting It plays a role in Debian ISOhybrid images when booting from CD with a monolithic signed GRUB image which fetches an early grub.cfg in the EFI partition, because GRUB does not see the El Torito image and can read the early grub.cfg only from the ISO 9660 filesystem. ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
EFI El Torito image on ISO9660 (was: [PATCH] bli: Fix crash in get_part_uuid)
On 16/07/2024 at 08:55, Michael Chang via Grub-devel wrote: 4. When booting from an ISO, the ESP is treated as an El Torito image in the boot catalog. It is therefore presented by firmware and interpreted by grub as a disk (cd0). In my limited experience, (cd0) is the whole CD/DVD/BD and GRUB does not show the EFI El Torito image as such. Tested with debian-12.6.0-amd64-netinst.iso on QEMU+OVMF and real hardware: grub> echo $cmdpath (cd0)/EFI/BOOT grub> ls (proc) (memdisk) (cd0) (cd0,apple2) (cd0,apple1) (cd0,msdos2) grub> ls (cd0) Device cd0: Filesystem type iso9660 - Label 'Debian 12.6.0 amd64 n' ... grub> ls (cd0)/ /boot /css /debian /dists /doc /EFI ... The /EFI directory in the ISO9660 filesystem contains a copy of the EFI El Torito image contents so that GRUB can find its config file (cd0)/EFI/debian/grub.cfg. The Apple and MSDOS partitions are caused by the hybrid structure of the Debian installation image. Partition (cd0,apple2) matches the position of the EFI El Torito image but would not exist on a "pure" ISO9660 image. ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH v2][Bugfix] util/grub.d/00_header.in: quote background image pathname in output
This is required if the pathname contains spaces or grub shell metacharacters, else the generated config file check will fail. Signed-off-by: Pascal Hambourg --- v2: Correct subject util/grub.d/00_header.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index 6a316a5ba..f86b69bad 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -275,7 +275,7 @@ EOF prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` cat << EOF insmod $reader -background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"` +background_image -m stretch "`make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`" EOF fi fi -- 2.39.2 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH][Bugfix] debian/grub.d/05_debian_theme: quote background image pathname in output
This is required if the pathname contains spaces or grub shell metacharacters, else the generated config file check will fail. Signed-off-by: Pascal Hambourg --- util/grub.d/00_header.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index 6a316a5ba..f86b69bad 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -275,7 +275,7 @@ EOF prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` cat << EOF insmod $reader -background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"` +background_image -m stretch "`make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`" EOF fi fi -- 2.39.2 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH v2] util/grub.d/30_os-prober.in: Fix GRUB_OS_PROBER_SKIP_LIST for non-EFI
GRUB documentation states: ‘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 @ But the actual behaviour does not match this description. GRUB_OS_PROBER_SKIP_LIST="" does nothing. In order to skip non-EFI bootloaders, you must set GRUB_OS_PROBER_SKIP_LIST="@" which is both absurd ( and are redundant) and wrong ( such as /dev/sd* may not be persistent across boots). Also, any non-word character is accepted as a separator, including '-' and '@' which may be present in UUIDs. This can cause false positives because of partial UUID match. This patch fixes these flaws while retaining some backward compatibility with previous behaviour which may be expected by existing setups: - also accept @/dev/* (with warning) for non-EFI bootloaders - also accept comma and semicolon as separator Fixes: 55e706c9 (Add GRUB_OS_PROBER_SKIP_LIST to selectively skipping systems) Signed-off-by: Pascal Hambourg --- Changes in v2: - enforce UUID boundaries with correct separators - warn if @/dev/* is found in GRUB_OS_PROBER_SKIP_LIST - update documentation - call grub-probe only when needed docs/grub.texi | 7 +-- util/grub.d/30_os-prober.in | 19 +-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi index a225f9a88..594d475fc 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1561,8 +1561,11 @@ this option to @samp{false} to enable this feature in the @command{grub-mkconfig} command. @item 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 @@ +List of space-separated case insensitive UUIDs of filesystems to be ignored +from os-prober output. For EFI chainloaders it's @@. For +backward compatibility with previous behaviour, @@/dev/* is also accepted +for non-EFI chainloaders even if the device does not match, and comma and +semicolon are also accepted as separator. @item GRUB_DISABLE_SUBMENU Normally, @command{grub-mkconfig} will generate top level menu entry for diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 656301eaf..394747759 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -117,19 +117,26 @@ if [ "x$GRUB_TOP_LEVEL_OS_PROBER" != x ]; then OSPROBED=$(grub_move_to_front "$GRUB_TOP_LEVEL_OS_PROBER" ${OSPROBED}) fi +case "$GRUB_OS_PROBER_SKIP_LIST" in *@/[dD][eE][vV]/*) + grub_warn "$(gettext_printf "GRUB_OS_PROBER_SKIP_LIST contains deprecated @/dev/* notation. The @/dev/* suffix is ignored.")" +esac + 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" + unset UUID + if [ -n "${GRUB_OS_PROBER_SKIP_LIST}" ] && UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then +SPACE='[[:space:],;]' # regex matching spaces and common separators -if [ x"${DEVICE#*@}" != x ] ; then - EXPUUID="${EXPUUID}@${DEVICE#*@}" +if [ x"${DEVICE##*@*}" = x ] ; then + EXPUUID="$UUID@${DEVICE#*@}" +else + EXPUUID="$UUID(@/dev/.*)?" fi -if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then +if printf %s " ${GRUB_OS_PROBER_SKIP_LIST} " | grep -Eqie "${SPACE}${EXPUUID}${SPACE}" ; then echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2 continue fi @@ -299,7 +306,7 @@ EOF echo "$title_correction_code" ;; macosx) - if [ "${UUID}" ]; then + if [ "${UUID=`${grub_probe} --target=fs_uuid --device ${DEVICE}`}" ]; then OSXUUID="${UUID}" osx_entry xnu_kernel 32 osx_entry xnu_kernel64 64 -- 2.39.2 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v2] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries
Any feedback on this ? On 19/01/2024 at 16:25, Pascal Hambourg wrote: On systems which support multiple boot platforms such as BIOS or EFI, it makes no sense to show menu entries which are not supported by the current boot platform. Menu entries generated from os-prober 'chain' boot type use boot sector chainloading which is supported by PC BIOS platform only. Show 'chain' menu entries only if boot platform is PC BIOS. Show 'efi' menu entries only if boot platform is EFI. This is aimed to allow os-prober to report both EFI and PC BIOS boot loaders regardless of the current boot mode on x86 systems which support both EFI and legacy BIOS boot. Signed-off-by: Pascal Hambourg --- Note: I did not change indentation to keep the patch minimal. v2: - show 'chain' menu entries if platform=pc instead of platform!=efi - add explanatory comments in generated config util/grub.d/30_os-prober.in | 6 ++ 1 file changed, 6 insertions(+) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 043e5dfea..e9e217208 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -155,6 +155,8 @@ for OS in ${OSPROBED} ; do onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF +# this menu entry is supported only by PC BIOS platform +if [ "\$grub_platform" = "pc" ]; then menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { EOF save_default_entry | grub_add_tab @@ -179,6 +181,7 @@ EOF cat < ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] util/grub.d/30_os-prober.in: Fix GRUB_OS_PROBER_SKIP_LIST for non-EFI
On 27/04/2024 at 08:32, Glenn Washburn wrote: On Fri, 19 Jan 2024 11:28:55 +0100 Pascal Hambourg wrote: GRUB documentation states: '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 @ But the actual behaviour does not match this description. Setting GRUB_OS_PROBER_SKIP_LIST="" does not ignore non-EFI boot loaders detected on filesystem . In order to skip non-EFI boot loaders, you must set GRUB_OS_PROBER_SKIP_LIST="@" which is both absurd (UUID and device are redundant) and wrong (device names such as /dev/sd* may not be persistent across boots). This patch fixes the detection of "@" in the device string reported by os-prober. Fixes: 55e706c9 (Add GRUB_OS_PROBER_SKIP_LIST to selectively skipping systems) Note: the UUID matching regex uses word boundaries '\b' but '@' is not a word character. As a consequence, setting GRUB_OS_PROBER_SKIP_LIST="@" will ignore non-EFI boot loaders detected on filesystem even though the goal is to ignore a given EFI boot loader only. However I think this is desirable to preserve the behaviour of existing setups which use GRUB_OS_PROBER_SKIP_LIST="@". Additionally, '-' may be present in UUIDs and is not a word character either, so the regex may also match UUID substrings instead of whole UUIDs only. For example a FAT UUID may match an ext4 UUID substring. It would be good to have this in a comment in an appropriate place in the code. I know of no complaints about this, I found these in grub lists: <https://lists.gnu.org/archive/html/help-grub/2018-11/msg5.html> <https://lists.gnu.org/archive/html/bug-grub/2022-12/msg2.html> And in a few forum threads: <https://www.linuxquestions.org/questions/linux-desktop-74/solved-grub-detecting-2-windows10-only-one-really-works-4175678998/> <https://forum.manjaro.org/t/after-installing-manjaro-xfce-there-are-two-options-for-boot-in-my-uefi-one-is-uefi-os-and-another-one-is-my-ssd-which-one-should-i-choose/12592/15> <https://bbs.archlinux.org/viewtopic.php?pid=2075691#p2075691> <https://superuser.com/questions/237565/how-to-hide-recovery-partition-from-grub2> <https://askubuntu.com/questions/453038/update-grub-ignoring-some-options-in-etc-default-grub> I guess some people have come to believe the current behaviour is normal, for example <https://wiki.phobos-net.fr/doku.php/sysadmin/grub2/supprimer_options_demarrage> but I think it would be good to work on transitioning to what should be done. What is the "correct behavior" regarding items containing '@' ? Is it acceptable that "@" skips non-EFI boot loaders, as implemented by this patch ? Or should only "" and "@/dev/*" skip non-EFI boot loaders ? Is is acceptable to skip a boot loader if its UUID is only a substring of a UUID in GRUB_OS_PROBER_SKIP_LIST (which is highly unlikely) ? Perhaps the correct behavior should be available with a envvar and wait a full release to to enable by default giving people time to transition. What do you mean by "available with a envvar" ? - Define a new variable such as GRUB_OS_PROBER_UUID_SKIP_LIST whose processing implements the correct behaviour and preserve GRUB_OS_PROBER_SKIP_LIST current processing ? - Define a new variable such as GRUB_OS_PROBER_SKIP_LIST_FIX whose value affects the processing of GRUB_OS_PROBER_SKIP_LIST ? - Something else ? Signed-off-by: Pascal Hambourg --- util/grub.d/30_os-prober.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index e9e217208..a24c01334 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -125,7 +125,7 @@ for OS in ${OSPROBED} ; do if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then EXPUUID="$UUID" -if [ x"${DEVICE#*@}" != x ] ; then +if [ x"${DEVICE%@*}" != x"${DEVICE}" ] ; then EXPUUID="${EXPUUID}@${DEVICE#*@}" fi ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] util/grub.d/30_os-prober.in: Fix GRUB_OS_PROBER_SKIP_LIST for non-EFI
Friendly ping. Any comments about this ? On 19/01/2024 at 11:28, Pascal Hambourg wrote: GRUB documentation states: '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 @ But the actual behaviour does not match this description. Setting GRUB_OS_PROBER_SKIP_LIST="" does not ignore non-EFI boot loaders detected on filesystem . In order to skip non-EFI boot loaders, you must set GRUB_OS_PROBER_SKIP_LIST="@" which is both absurd (UUID and device are redundant) and wrong (device names such as /dev/sd* may not be persistent across boots). This patch fixes the detection of "@" in the device string reported by os-prober. Fixes: 55e706c9 (Add GRUB_OS_PROBER_SKIP_LIST to selectively skipping systems) Note: the UUID matching regex uses word boundaries '\b' but '@' is not a word character. As a consequence, setting GRUB_OS_PROBER_SKIP_LIST="@" will ignore non-EFI boot loaders detected on filesystem even though the goal is to ignore a given EFI boot loader only. However I think this is desirable to preserve the behaviour of existing setups which use GRUB_OS_PROBER_SKIP_LIST="@". Signed-off-by: Pascal Hambourg --- util/grub.d/30_os-prober.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index e9e217208..a24c01334 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -125,7 +125,7 @@ for OS in ${OSPROBED} ; do if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then EXPUUID="$UUID" -if [ x"${DEVICE#*@}" != x ] ; then +if [ x"${DEVICE%@*}" != x"${DEVICE}" ] ; then EXPUUID="${EXPUUID}@${DEVICE#*@}" fi ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: Idea: Improve ext2 to allow for embedding
On 13/03/2024 at 16:18, Dr. Tilmann Bubeck wrote: Yes, thats exactly the use case: I always have multiple linux installations (ubuntu and fedora) in two seperate partitions. To stay compatible with their individual kernel and grub updates, I always install a second GRUB into the root parition of the specific linux installation. In MBR I have a master GRUB to select the linux system (partition) to chainload the second GRUB of that distribution. For this use case I need GRUB to be installed into ext4 of the root partition of that linux system. Alternatively, the primary GRUB can load a secondary GRUB core image file /boot/grub/i386-pc/core.img with the "multiboot" command to avoid relying on block lists. ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: Idea: Improve ext2 to allow for embedding
On 13/03/2024 at 11:25, Mate Kukri wrote: Do you have a proposed use-case for this in mind? On MBR disks there is usually enough space for core.img before the first partition. On GPT you can simply create a so-called "BIOS boot partition" to store core.img. A use case could be when you do not want to install the GRUB boot image in the disk MBR as the primary boot loader but in a partition boot sector as a secondary boot loader. On Wed, Mar 13, 2024 at 10:22 AM Dr. Tilmann Bubeck wrote: I would like to propose a change to GRUB to allow embedding (fs_embed) of core.img for ext2/3/4 into the filesystem. This allows the installation of GRUB into ext2 without the need to use (unsafe) block lists. It will be realized using the ioctl(EXT4_IOC_SWAP_BOOT) introduced into Linux 3.10 in 2013. This ioctl basically swaps the data blocks of the associated file with the EXT2_BOOT_LOADER_INO inode. After using the ioctl the code of core.img is stored in the BOOT_LOADER incode of the filesystem and it is not accessible to file system tools anymore. This ensures, that the boot code is safe and installation into a partition is possible. What would you think about this proposal. Are you willing to integrate this, if I develop this for GRUB? Changes will be done mainly in setup.c and ext2.c ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH v2] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries
On systems which support multiple boot platforms such as BIOS or EFI, it makes no sense to show menu entries which are not supported by the current boot platform. Menu entries generated from os-prober 'chain' boot type use boot sector chainloading which is supported by PC BIOS platform only. Show 'chain' menu entries only if boot platform is PC BIOS. Show 'efi' menu entries only if boot platform is EFI. This is aimed to allow os-prober to report both EFI and PC BIOS boot loaders regardless of the current boot mode on x86 systems which support both EFI and legacy BIOS boot. Signed-off-by: Pascal Hambourg --- Note: I did not change indentation to keep the patch minimal. v2: - show 'chain' menu entries if platform=pc instead of platform!=efi - add explanatory comments in generated config util/grub.d/30_os-prober.in | 6 ++ 1 file changed, 6 insertions(+) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 043e5dfea..e9e217208 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -155,6 +155,8 @@ for OS in ${OSPROBED} ; do onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF +# this menu entry is supported only by PC BIOS platform +if [ "\$grub_platform" = "pc" ]; then menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { EOF save_default_entry | grub_add_tab @@ -179,6 +181,7 @@ EOF cat <https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH v2] util/grub.d/30_os-prober.in: Skip drivemap for Windows 8 to 19, Server 2012 and later
If Windows Vista, Seven and Server 2008 do not need drivemap, then later versions using bootmgr should not need it either. This patch checks Windows versions up to 19 because distinguishing 20 from 2000 requires more complex logic. Hopefully Windows will drop legacy BIOS boot support before version 20. Signed-off-by: Pascal Hambourg --- v2: - Harden the version check to exclude Windows 1.* (even though os-prober does not detect it) util/grub.d/30_os-prober.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 656301eaf..043e5dfea 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -167,7 +167,7 @@ EOF fi case ${LONGNAME} in - Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*) + Windows\ Vista*|Windows\ [78]*|Windows\ 1[0-9]*|Windows\ Server\ 2008*|Windows\ Server\ 20[1-9]*) ;; *) cat << EOF -- 2.30.2 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH] util/grub.d/30_os-prober.in: Fix GRUB_OS_PROBER_SKIP_LIST for non-EFI
GRUB documentation states: '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 @ But the actual behaviour does not match this description. Setting GRUB_OS_PROBER_SKIP_LIST="" does not ignore non-EFI boot loaders detected on filesystem . In order to skip non-EFI boot loaders, you must set GRUB_OS_PROBER_SKIP_LIST="@" which is both absurd (UUID and device are redundant) and wrong (device names such as /dev/sd* may not be persistent across boots). This patch fixes the detection of "@" in the device string reported by os-prober. Fixes: 55e706c9 (Add GRUB_OS_PROBER_SKIP_LIST to selectively skipping systems) Note: the UUID matching regex uses word boundaries '\b' but '@' is not a word character. As a consequence, setting GRUB_OS_PROBER_SKIP_LIST="@" will ignore non-EFI boot loaders detected on filesystem even though the goal is to ignore a given EFI boot loader only. However I think this is desirable to preserve the behaviour of existing setups which use GRUB_OS_PROBER_SKIP_LIST="@". Signed-off-by: Pascal Hambourg --- util/grub.d/30_os-prober.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index e9e217208..a24c01334 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -125,7 +125,7 @@ for OS in ${OSPROBED} ; do if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then EXPUUID="$UUID" -if [ x"${DEVICE#*@}" != x ] ; then +if [ x"${DEVICE%@*}" != x"${DEVICE}" ] ; then EXPUUID="${EXPUUID}@${DEVICE#*@}" fi -- 2.30.2 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries
On 17/01/2024 at 17:48, Vladimir 'phcoder' Serbinenko wrote: Le mer. 17 janv. 2024, 18:10, Pascal Hambourg a écrit : On 17/01/2024 at 04:15, Vladimir 'phcoder' Serbinenko wrote: +if [ "\$grub_platform" != "efi" ]; then This is not the right check. Only "pc" platform supports chainloadin boot sector. All other: coreboot, qemu, emu, ieee1275, xen and non-x86. The only one which might is xen_pvh but this needs to be checked From <https://wiki.xenproject.org/wiki/Understanding_the_Virtualization_Spectrum#PVH>: "This is exactly what PVH is. It’s a fully PV kernel mode, running with paravirtualized disk and network, paravirtualized interrupts and timers, no emulated devices of any kind (and thus no qemu), no BIOS or legacy boot" If I understand correctly, "no BIOS or legacy boot" implies no boot sector chainloading. I expect os-prober to report boot type "chain" only on platforms which support chainloading. Isn't it enough ? Os-prober has no idea how system is booted. And one of my systems can boot as any of coreboot, multiboot, EFI, PC or xen. Then I can run qemu version using whole disk. This together means that the same disk can boot in any way. Fine, then assume that os-prober boot type "chain" actually means "BIOS boot sector" and show menu entries only if grub_target = pc ? ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries
On 17/01/2024 at 04:15, Vladimir 'phcoder' Serbinenko wrote: onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF +if [ "\$grub_platform" != "efi" ]; then This is not the right check. Only "pc" platform supports chainloadin boot sector. All other: coreboot, qemu, emu, ieee1275, xen and non-x86. The only one which might is xen_pvh but this needs to be checked I expect os-prober to report boot type "chain" only on platforms which support chainloading. Isn't it enough ? The goal is to hide "chain" menu entries when booting in EFI mode, no more. ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] util/grub.d/30_os-prober.in: Skip drivemap for Windows 8 to 19, Server 2012 and later
On 17/01/2024 à 04:17, Vladimir 'phcoder' Serbinenko wrote: On Sat, Jan 6, 2024 at 6:38 PM Pascal Hambourg wrote: If Windows Vista, Seven and Server 2008 do not need drivemap, then later versions using bootmgr too should not need it either. (...) case ${LONGNAME} in - Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*) + Windows\ Vista*|Windows\ [781]*|Windows\ Server\ 2008*|Windows\ Server\ 20[1-9]*) What happens to Windows 1.01 ? Or is it detected as MS-DOS? The condition can be split in two for 7..8 and 10..19 : Windows\ [78]*|Windows\ 1[0-9]* But os-prober returns only the following names for pre-bootmgr versions: Windows NT/2000/XP MS-DOS 5.x/6.x/Win3.1 Windows 95/98/Me ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH] util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries
On systems which support both BIOS/legacy and EFI boot, it makes no sense to show menu entries for EFI bootloaders when booted in BIOS/legacy mode and show menu entries for BIOS/legacy boot loaders when booted in EFI mode. Show 'chain' menu entries only if not booted in EFI mode. Show 'efi' menu entries only if booted in EFI mode. This will allow os-prober to report both EFI and BIOS legacy boot loaders regardless of the current boot mode on systems which support both EFI and BIOS/legacy boot. Note: I did not change indentation to keep the patch minimal. Signed-off-by: Pascal Hambourg --- util/grub.d/30_os-prober.in | 4 1 file changed, 4 insertions(+) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 8e5cbb50e..a16f7549b 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -155,6 +155,7 @@ for OS in ${OSPROBED} ; do onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF +if [ "\$grub_platform" != "efi" ]; then menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { EOF save_default_entry | grub_add_tab @@ -179,6 +180,7 @@ EOF cat <https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH] util/grub.d/30_os-prober.in: Skip drivemap for Windows 8 to 19, Server 2012 and later
If Windows Vista, Seven and Server 2008 do not need drivemap, then later versions using bootmgr too should not need it either. Note: This patch checks Windows versions up to 19 because distinguishing 20 from 2000 requires more complex logic. Hopefully Windows will drop BIOS/legacy boot support before version 20. Signed-off-by: Pascal Hambourg --- util/grub.d/30_os-prober.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 656301eaf..8e5cbb50e 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -167,7 +167,7 @@ EOF fi case ${LONGNAME} in - Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*) + Windows\ Vista*|Windows\ [781]*|Windows\ Server\ 2008*|Windows\ Server\ 20[1-9]*) ;; *) cat << EOF -- 2.30.2 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel