Grub2 (Efi) boot via PXE - load config file automatically
I´ve got a problem booting my OS via Grub2 bootloader.
Environment:
I´ve got a PXE-Boot Infrastructure and want to test PXE-Booting Grub2.efi via Network (TFTP).
Downloading the efi-file to the client works and grub gets loaded on the machine - I can see the grub prompt grub> - I´m using Grub Version 2.00.
I´ve created a config file (grub.cfg) and placed it in the same TFTP-Directory as the grub.efi file.
I can see from the TFTP-logs that GRUB gets downloaded - and obviously loaded on the client - and afterwards the grub.cfg get downloaded by grub.
My grub.cfg looks as follows:
set root=(hd0,gpt1)
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
bootMinimalistically I just want to boot Windows with GRUB. Please don´t ask why; that would take too long to describe…
I would expect GRUB to find the downloaded grub.cfg file and load Windows.
What happens: I just get thrown to the grub> prompt.
When I load the grub.cfg from the grub prompt via
configfile /grub.cfgthe OS gets loaded perfectly, so that seems to be OK so far.
So my problem is, how can I get GRUB to automatically load the config file and boot Windows?
2 Answers
Grub looks for a config file /grub/grub.cfg or /grub/x86_64-efi/grub.cfg (or similar).
NB: It is a path from the TFTP server root. That means even if you run your Grub binary from a path like $tftproot/path/to/grubnetx64.efi, don't try to put the direcotry grub/ to the same directory, but really to your TFTP root: $tftproot/grub/
How to find out
In the Grub console:
grub> cat (memdisk)/grub.cfg
if [ -e $prefix/x86_64-efi/grub.cfg ]; then source Sprefix/x86_64-efi/grub.cfg
else source Sprefix/grub.cfg
fiAnd the important part, what the $prefix is:
grub> echo $prefix
(tftp,x.x.x.x)/grub 3 Make it in a menuentry and set default="0".
Reference: wiki.ubuntu.com - UEFI/PXE-netboot-install
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"