bugGNU GRUB - Bugs: bug #62886, Wrong $cmdpath when booting from...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #62886: Wrong $cmdpath when booting from an optical disc

Submitter:  nl6720
Submitted:  Thu 11 Aug 2022 09:55:39 AM UTC
   
 
Category:  Booting Severity:  Major
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release:  other
Release:  Reproducibility:  Every Time
Planned Release:  None

Thu 11 Aug 2022 12:26:23 PM UTC, comment #3: 

comment #1:

> FAT is case-insensitive


While the El Torito image from which GRUB is launched is FAT, (cd0) which GRUB uses in its $cmdpath is ISO 9660 + Rock Ridge + Joliet.

nl6720
Thu 11 Aug 2022 12:10:47 PM UTC, comment #2: 

The issue is that configfile ${cmdpath}/grub.cfg doesn't work since $cmdpath is (cd0)/EFI/Boot.


configfile (cd0)/EFI/Boot/grub.cfg


doesn't work,
while


configfile (cd0)/EFI/BOOT/grub.cfg


works.

P.S. Sorry, I made a copy-paste fail in the "steps to reproduce", the directory should be "isoroot/EFI/BOOT" in all occurrences.

nl6720
Thu 11 Aug 2022 11:46:39 AM UTC, comment #1: 

What is the actual problem? FAT is case-insensitive so /EFI/Boot and /EFI/BOOT is the same thing on it. If some pay doesn't test it this way it's the problem of the days part

Vladimir Serbinenko <phcoder>
Group administrator
Thu 11 Aug 2022 09:55:39 AM UTC, original submission:  

When booting GRUB standalone (created following https://wiki.archlinux.org/title/GRUB/Tips_and_tricks#GRUB_standalone ) from an optical disc (an emulated one using IODD 2531), where it was placed at /EFI/BOOT/BOOTx64.EFI in both the ISO9660 and in an attached FAT image used as an EFI system partition, GRUB's $cmdpath was wrong. echo $cmdpath returned (cd0)/EFI/Boot. Notice that it's Boot not BOOT, but ls (cd0)/EFI/ showed that the directory is indeed called BOOT.

This only happens on my HP ProBook 450 G2 laptop. I can't reproduce it on another PC I own nor on the same laptop when the ISO is written to a USB flash drive.


OS: Arch Linux
Package versions:
grub 2:2.06.r261.g2f4430cc0-1
libisoburn 1.5.4-2
dosfstools 4.2-2
mtools 1:4.0.40-1


Steps to reproduce:


$ mkdir -p isoroot/BOOT/EFI



$ echo 'configfile ${cmdpath}/grub.cfg' > grub-embed.cfg



$ cat <<'EOF' > isoroot/BOOT/EFI/grub.cfg
insmod part_gpt
insmod part_msdos
insmod fat
insmod iso9660
insmod all_video
insmod font
if loadfont "${prefix}/fonts/unicode.pf2" ; then
    insmod gfxterm
    set gfxmode="auto"
    terminal_input console
    terminal_output gfxterm
fi

menuentry 'UEFI Firmware Settings' --id 'uefi-firmware' {
    fwsetup
}

menuentry "System shutdown" --class shutdown --class poweroff {
    echo "System shutting down..."
    halt
}

menuentry "System restart" --class reboot --class restart {
    echo "System rebooting..."
    reboot
}
EOF



$ grub-mkstandalone -O x86_64-efi \
        --modules="part_gpt part_msdos fat iso9660" \
        --locales="en@quot" \
        --themes="" \
        -o "isoroot/BOOT/EFI/BOOTx64.EFI" \
        "boot/grub/grub.cfg=grub-embed.cfg"



$ mkfs.fat -C efiboot.img 8192



$ mmd -i efiboot.img ::/EFI ::/EFI/BOOT



$ mcopy -i efiboot.img isoroot/BOOT/EFI/BOOTx64.EFI isoroot/BOOT/EFI/grub.cfg ::/EFI/BOOT/



$ xorriso -as mkisofs \
        -iso-level 3 \
        -full-iso9660-filenames \
        -joliet \
        -joliet-long \
        -rational-rock \
        -partition_offset 16 \
        -append_partition 2 0xef efiboot.img \
        -eltorito-alt-boot \
        -e '--interval:appended_partition_2:all::' \
        -no-emul-boot \
        -isohybrid-gpt-basdat \
        -output "grub-boot-test.iso" \
        isoroot/


Burn and boot grub-boot-test.iso.

archiso issue: https://gitlab.archlinux.org/archlinux/archiso/-/issues/183 . Currently archiso uses the following embeded grub configuration file to work around it:


if ! [ -d "$cmdpath" ]; then
    if regexp --set=1:isodevice '^(\([^)]+\))\/?[Ee][Ff][Ii]\/[Bb][Oo][Oo][Tt]\/?$' "$cmdpath"; then
        cmdpath="${isodevice}/EFI/BOOT"
    fi
fi
configfile "${cmdpath}/grub.cfg"


nl6720

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by nl6720 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-aa77.
    Corresponding source code