Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chainloading grub2 pxe efi file
2016-11-23, 05:35
Post: #1
Chainloading grub2 pxe efi file
There appears to be a bug where iPXE cannot chainload a GRUB2 EFI file. This is used with Clonezilla & DRBL installations, where the GRUB2 file is dynamically generated.

Steven Shiau of the DRBL & Clonezilla projects posted something recently in the DEV e-mail chain about this, but did not get a response: http://lists.ipxe.org/pipermail/ipxe-dev...05214.html

I've included the error, as described by Steven here:

---------------------------------------

Is this issue mentioned in this thread fixed?
http://lists.ipxe.org/pipermail/ipxe-dev...04454.html
It seems the issue still remains. Here is my way to reproduce the issue:
1. On dhcp server, the isc-dhcp-server config is like:
option arch code 93 = unsigned integer 16;
if option arch = 00:06 {
filename "bootia32.efi";
} else if option arch = 00:07 {
filename "bootx64.efi";
} else if option arch = 00:09 {
filename "bootx64.efi";
} else {
filename "pxelinux.0";
}

The bootx64.efi was created on Ubuntu 16.04 x86-64 with this command:
grub-mkimage -C xz -O x86_64-efi -o /tftpboot/nbi_img/bootx64.efi
--prefix='(tftp)/grub-efi.cfg/' -c /tmp/grub-efi.70hXmd/grub-header.cfg
normal tftp efinet chain echo net gzio xzio linux efi_gop efi_uga png
gfxterm gfxterm_background gfxterm_menu serial part_gpt part_msdos boot
multiboot progress search ext2 xfs reiserfs jfs hfsplus fat ntfs
configfile test sleep tr reboot halt
The contents of /tmp/grub-efi.70hXmd/grub-header.cfg:
*****************************************************.
set prefix=(tftp)/grub-efi.cfg
echo "Grub CPU and platform: $grub_cpu, $grub_platform"
echo 'Network status: '
net_ls_cards
net_ls_addr
net_ls_routes

tr --set pretty_mac x: x- $net_default_mac

echo "Loading config file $prefix/grub.cfg-01-$pretty_mac..."
configfile $prefix/grub.cfg-01-$pretty_mac

echo "Loading config file $prefix/grub.cfg-$net_default_ip..."
configfile $prefix/grub.cfg-$net_default_ip

echo "Loading config file: $prefix/grub.cfg"
configfile $prefix/grub.cfg

echo "Could not find config file $prefix/grub.cfg-$pretty_mac,
$prefix/grub.cfg-$net_default_ip or $prefix/grub.cfg!"
sleep 15

*****************************************************.

In the client I boot a live CD (Clonezilla live) on uEFI machine, with
iPXE in the grub2 config:
menuentry "iPXE"{
search --no-floppy --set=root -f /live/ipxe.efi
chainloader /live/ipxe.efi + 1
}

The ipxe.efi was compiled with the latest release from iPXE git repository:
https://git.ipxe.org/ipxe.git/commit/0be...83258f81ff

So when iPXE uEFI boots, it gets the IP address from the DHCP server,
downloads bootx64.efi, the output on the screen is attached as ipxeboot.png.
Later then it stops at:
Could not find config file (tftp)/grub.cfg-, (tftp)/grub.cfg- or
(tftp)/grub.cfg!
(See attached file grub-stop.png).
And after 15 secs, it enters grub shell (see attached grub-shell.png).

ATTACHMENTS:
http://lists.ipxe.org/pipermail/ipxe-dev...t-0003.png
http://lists.ipxe.org/pipermail/ipxe-dev...t-0004.png
http://lists.ipxe.org/pipermail/ipxe-dev...t-0005.png
Find all posts by this user
Quote this message in a reply
2016-11-23, 19:10
Post: #2
RE: Chainloading grub2 pxe efi file
I think your issue could be solved by enabling the "EFI downgrade" option see the commit at http://git.ipxe.org/ipxe.git/commitdiff/a15c0d7

If that solves your issue you might want to contact the Grub people and try to get them to make a fix on their end.

But there is no need to use Grub since you can have both menu and loading of kernel directly from ipxe, grub does not give any benefit IMHO

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2016-11-27, 04:41
Post: #3
RE: Chainloading grub2 pxe efi file
(2016-11-23 19:10)NiKiZe Wrote:  But there is no need to use Grub since you can have both menu and loading of kernel directly from ipxe, grub does not give any benefit IMHO
Could you please shed more lights about this? Some examples or docs will be great. Thanks.

Steven
Find all posts by this user
Quote this message in a reply
2016-11-27, 16:45
Post: #4
RE: Chainloading grub2 pxe efi file
There is loots and loots of examples on how to use ipxe to load different things, but below is example for working in both legacy and efi mode and depnding on CPU bitness

In this case it is based on systemrescuecd

Code:
#!ipxe

# if kbmap is not already set, we set a default to avoid question on boot
isset ${kbmap} || set kbmap us

# generate a setting with 32 or 64 depending on what the cpu supports
cpuid --ext 29 && set bitn 64 || set bitn 32


# This is for 4.8.1-beta002.iso or later
kernel altker${bitn} initrd=initram.igz initrd=sysrcd.dat.cpio edd=off vga=791 scandelay=0 dodhcp setkmap=${kbmap} nomdadm nodmraid rootpass=l
initrd initram.igz

# ipxe does currently only support adding cpio headers on the fly to bzImage boots,
# but not efi, for now use preadded cpio header
# generate with: echo sysrcd.dat | cpio -H newc -o > sysrcd.dat.cpio
initrd sysrcd.dat.cpio

boot

If you put this in a separate "sysrcd.ipxe" file and then chain http://server/sysrcd.ipxe
it should boot (As long as you have all the other files available as well)

This is just an example, and it can be done easier and more advanced, it is also possible to have menues and other things, se http://ipxe.org/cmd/menu as a base for how menues can be implemented.

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2016-12-07, 01:57
Post: #5
RE: Chainloading grub2 pxe efi file
(2016-11-23 19:10)NiKiZe Wrote:  I think your issue could be solved by enabling the "EFI downgrade" option see the commit at http://git.ipxe.org/ipxe.git/commitdiff/a15c0d7

If that solves your issue you might want to contact the Grub people and try to get them to make a fix on their end.

Enabling EFI downgrade did not appear to have any effect. The same error message that steven is describing persists.

Any other options besides scrapping GRUB?
Find all posts by this user
Quote this message in a reply
2017-08-28, 15:42
Post: #6
RE: Chainloading grub2 pxe efi file
I've come across this problem when trying to chainload GRUB2 as a workaround to the booting of RHEL 7.3 install images.

Has anyone experienced this also?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)