FS#40029 - [grub] ${cmdpath} expansion in GRUB shell is wrong
Attached to Project:
Arch Linux
Opened by Dan Liew (delcypher) - Tuesday, 22 April 2014, 14:31 GMT
Last edited by Tobias Powalowski (tpowa) - Tuesday, 29 March 2022, 19:30 GMT
Opened by Dan Liew (delcypher) - Tuesday, 22 April 2014, 14:31 GMT
Last edited by Tobias Powalowski (tpowa) - Tuesday, 29 March 2022, 19:30 GMT
|
Details
Description:
I'm currently doing a UEFI install of Arch Linux and I was following instructions on the wiki to switch to using GRUB2 to load the kernel because of the EFISTUB bug in the kernel and I came across an issue where the ${cmdpath} variable in the shell was not being expanded correctly. grub> echo ${cmdpath} (hd0,msdos2)EFI/Boot The weird thing is I can do this... grub> ls ${cmdpath} bootx64.efi hashTool.efi loader.efi grub.cfg But then this fails grub> cat ${cmdpath}/grub.cfg error:invalid file name `EFI/Boot/grub.cfg'. grub> configfile ${cmdpath}/gru.cfg # The file is not loaded. However if I manually correct cmdpath like so (notice the slash before the 'E' in 'EFI') set cmdpath=(hd0,msdos2)/EFI/Boot then the cat and configfile comands work. Additional info: * grub 1:2.02.beta2-2 (version on live usb image 201404) Steps to reproduce: Sorry, it's probably easier to do this on an installed GRUB shell but I don't have an installed Arch system I can test this on yet. 1. Create Arch live usb using: https://wiki.archlinux.org/index.php/USB_Flash_Installation_Media#BIOS_and_UEFI_Bootable_USB 2. Follow the instructions at https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface#Using_GRUB Basically this involves creating a standalone version of GRUB on the liveusb and setting the embedded grub.cfg load an external grub.cfg by doing configfile ${cmdpath}/grub.cfg 3. Boot from the Arch live usb. The config file won't be loaded and the user will be dropped to the GRUB shell. Running the configfile commands manually in the GRUB shell confirms problem with the value of ${cmdpath}. |
This task depends upon
Closed by Tobias Powalowski (tpowa)
Tuesday, 29 March 2022, 19:30 GMT
Reason for closing: Works for me
Tuesday, 29 March 2022, 19:30 GMT
Reason for closing: Works for me
# wget http://mirror.aarnet.edu.au/pub/archlinux/iso/2014.04.01/archlinux-2014.04.01-dual.iso
# dd if=archlinux-2014.04.01-dual.iso bs=4M of=/dev/sdb
# partprobe
# mount /dev/sdb2 /mnt
# cd /mnt/EFI/boot
# echo 'configfile ${cmdpath}/grub.cfg' > /tmp/grub.cfg
# mv loader.efi old-loader.efi
# grub-mkstandalone -d /usr/lib/grub/x86_64-efi/ -O x86_64-efi --modules="part_gpt part_msdos" --fonts="unicode" --locales="en@quot" --themes="" -o ./loader.efi "/boot/grub/grub.cfg=/tmp/grub.cfg" -v
# vim grub.cfg # Add configuration file. Its contents doesn't matter because GRUB fails to load it!
# cd /
# umount /mnt
Now reboot and do UEFI boot from USB. Loading the configuration file fails (mine contained menu entries) and
grub> echo ${cmdpath}
(hd0,msdos2)EFI/Boot
grub> ls ${cmdpath}
bootx64.efi hashTool.efi loader.efi grub.cfg
grub> cat ${cmdpath}/grub.cfg
error:invalid file name `EFI/Boot/grub.cfg'.
grub> configfile ${cmdpath}/grub.cfg
# The file is not loaded, if it was a menu would appear.
Interestingly GRUB2 is also installed on my system and when I drop into the shell and do
grub> echo ${cmdpath}
(hd0,gpt1)/EFI/grub
in this case GRUB has correctly put the leading slash in place.