Ask Your Question
0

PXE UEFI GRUB Booting

asked 2018-03-19 04:44:16 -0500

jaaf64 gravatar image

updated 2018-03-19 10:42:04 -0500

Hi, I am trying to setup a PXE environment to boot from network in uefi mode with grub. I use a standalone file embedding this grub.cfg file taken from the Installation Guide

function load_video {
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod all_video
}

load_video
set gfxpayload=keep
insmod gzio

menuentry 'Install Fedora 64-bit'  --class fedora --class gnu-linux --class gnu --class os {
linuxefi f26/vmlinuz ip=dhcp inst.repo=http://download.fedoraproject.org/pub/fedora/linux/releases/26/Server/x86_64/os/
initrdefi f26/initrd.img
}

menuentry 'Install Fedora 26 Server'  --class fedora --class gnu-linux --class gnu --class os {
kernel f26/vmlinuz
append initrd=f26/initrd.img inst.repo=http://download.fedoraproject.org/pub/fedora/linux/releases/26/Server/x86_64/os/ ip=dhcp ks=https://git.fedorahosted.org/cgit/spin-kickstarts.git/plain/fedora-install-server.ks?h=f21
}

menuentry 'Rescue installed system'  --class fedora --class gnu-linux --class gnu --class os {
kernel f26/vmlinuz
append f26/initrd=initrd.img root=live:http://download.fedoraproject.org/pub/fedora/linux/releases/26/Server/x86_64/os/LiveOS/squashfs.img rescue
}

I have previously downloaded the kernel images and initrd in a f26 subfolder of the tftp server root. The result is a correct menu displayed. But when attempting to boot an entry, I get the message : error : invalid filemame f26/vmlinuz The error is the same when I place the vmlinuz directly under the root and change the menuentries accordingly in order to avoid a path in the filename.

What should I do ?

When I use this grub.cfg

menuentry 'Install Fedora 64-bit'  --class fedora --class gnu-linux --class gnu --class os {
     insmod net
     insmod efinet
     insmod tftp

     insmod part_gpt
     insmod efi_gop
     insmod efi_uga
     set net_default_server=192.168.1.19

echo 'Loading vmlinuz'
linux (tftp)/f26/vmlinuz ip=dhcp inst.repo=http://download.fedoraproject.org/pub/fedora/linux/releases/26/Server/x86_64/os/

echo 'Loading initial ramdisk'
initrd (tftp)/f26/initrd.img
}

I get

Error : destination unreachable when attempting to load the kernel

edit retag flag offensive close merge delete

Comments

What do you mean by "a standalone file embedding this grub.cfg"? Are you loading grub from the tftp server?

I PXE boot UEFI laptops in several locations.

ssieb gravatar imagessieb ( 2018-03-19 17:59:01 -0500 )edit

I mean a core image of the GRUB including the grub.cfg file that is downloaded from the tftp server.

jaaf64 gravatar imagejaaf64 ( 2018-03-20 12:34:22 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2018-03-19 18:11:51 -0500

ssieb gravatar image

updated 2018-03-20 13:29:43 -0500

I just noticed your other question about making Grub standalone. I would suggest leaving out the grub.cfg file from the combined package and put it on the tftp server instead. Otherwise you might have to tell grub where the root is because it didn't have to find the config file. I have always used the grub efi file from the install ISOs for my setups rather than making my own. Making your own also might not work with secure boot.

Edit to add details:

Due to me having to support EFI and non-EFI PXE booting and past history I have a certain directory structure, but it is not necessary. You could put all the files in the top tftp directory if you want. In my dhcpd.conf file for the subnet involved, I have (in part):

next-server <tftp server ip address>;
filename "efi/shim.efi";

shim.efi comes from the shim package (or is called BOOTX64.EFI on the live ISO) and is required for secure boot support. You might not need it, but that's the way I have it setup and everything works. In the same directory as the shim.efi, you need to have grubx64.efi which I extracted from a live DVD ISO. Also in that directory you need to have your grub.cfg file. It's just a standard grub.cfg. Again, I copied one from the live ISO and adjusted it for my purposes. Any paths in the grub.cfg are relative to the top of the tftp server directory, not where grub is. Keep it simple and don't use directories at all.

edit flag offensive delete link more

Comments

Thank you. At first I started that way. But it stopped before displaying the menu (probably unable to find its config). After I embedded grub.cfg the menu appears. Thus my guess is that grub lacks the ability to connect to the network. In fact none of the net commands are available at grub prompt. I am going to do a step back and try again what you advise.

jaaf64 gravatar imagejaaf64 ( 2018-03-19 23:38:51 -0500 )edit

I have tried to use shim.efi, shimX64.efi, and grubx64.efi in turn. There were picked up from my /boot/efi/EFI/fedora directory. Each time, changing the dhcpd.conf accordingly, I get :

ip adress is 192.168.1.19

filename is <the filename="">

filesize is 0 byte

PXE:E23 client received error from server

The only efi executable I am able to download from tftp server is mine i.e. the bootx64.efi standalone I have made.

jaaf64 gravatar imagejaaf64 ( 2018-03-20 00:04:51 -0500 )edit

As you have managed to have it working, It would be kind of you to provide me with the grub.cfg file you have used as well as exactly what is the structure of you tftpboot and what each dir/subdir contains?

jaaf64 gravatar imagejaaf64 ( 2018-03-20 00:24:39 -0500 )edit

I updated the answer. Hopefully that helps you.

ssieb gravatar imagessieb ( 2018-03-20 13:30:42 -0500 )edit

Thank you again for your patience. I did what you suggest and which is more or less what the installation guide of Fedora says. I extracted the BOOTX64.EFI and grubx64.efi and put them into a test dir in the tftpboot (the root of the TFTP server). I managed to download GRUB2 but it fails as it is unable to find the linux and initrd commands. Thus I changed them into linuxefi and initrdefi and it works pretty fine. In fact I already found an other way to manage to boot using the grub2-mknetdir command. This command populate the ftpdboot dir with all the necessary stuff. (to follow)

jaaf64 gravatar imagejaaf64 ( 2018-03-21 05:12:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-19 04:44:16 -0500

Seen: 2,700 times

Last updated: Mar 20 '18