iPXE discussion forum
Cannot boot vmlinuz in efi - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Cannot boot vmlinuz in efi (/showthread.php?tid=7897)



Cannot boot vmlinuz in efi - silver310 - 2015-12-28 10:57

Hello, I've recently cam across this problem when trying to boot an installation iso of RHEL 6.7
I can boot centos 7, fedora 22, and rhel 7 with no issues in EFI and legacy mode.
However i cannot boot RHEL 6.7, when ever i try to boot the kernel i get the error code 2e008081 (http://ipxe.org/err/2e0080)

If i burn the iso to a usb key i can boot in both EFI and legacy.

Any idea why this is happening (old kernel version?), i've also tried coping vmlinuz from RHEL 7 iso and boot it with the initrd.img of RHEL 6, it boots but cannot recognize any network devices.

My last effort was to try to chain BOOTX64.efi, but i can't seem to make it load the config file.

Here's my menu entry:

:rhel67server
echo Starting RHEL 6.7 Server x64
set repo ${http-images}/iso_images/RHEL_6.7_server
imgfetch ${repo}/images/pxeboot/vmlinuzboot
initrd ${repo}/images/pxeboot/initrd.img
imgargs vmlinuzboot repo=${repo} initrd=initrd.img
boot vmlinuzboot || goto failed

i used imgfetch because if i use kernel it will stop with an error, with imgfetch it will go to boot and if failed then return to menu. BTW all other menu entries are exactly like this and they all work in EFI/Legacy.


RE: Cannot boot vmlinuz in efi - MultimediaMan - 2015-12-28 15:43

The Redhat 6.x vmlinuz does not have the EFI_Stub functionality configured in the kernel. You will need to boot iPXE to grub.efi and a correctly-configured grub.conf to then boot vmlinuz.

iPXE->grub.efi->grub.conf-vmlinuz->initrd

Hope this helps...


RE: Cannot boot vmlinuz in efi - silver310 - 2015-12-28 15:53

Yeah I just read about the efi stub issue.
I tried doing that with bootx64.efi but couldn't figure out how to automate it to boot vmlinuz immediately.

How hard would it be to compile a kernel for rhel 6 with efi stub enabled?


RE: Cannot boot vmlinuz in efi - MultimediaMan - 2015-12-28 16:09

(2015-12-28 15:53)silver310 Wrote:  Yeah I just read about the efi stub issue.
I tried doing that with bootx64.efi but couldn't figure out how to automate it to boot vmlinuz immediately.

How hard would it be to compile a kernel for rhel 6 with efi stub enabled?

When I asked about this through my Redhat TAM, he said flatly it wasn't going to happen because of how much regression testing would have to be done. It's easy to do (kernel-devel), but you would not be supported if you asked RHT for support and they determined it was a kernel-level issue.


RE: Cannot boot vmlinuz in efi - silver310 - 2015-12-28 16:24

OK I get it. Any advice on how to pass a conf file to grub so it'll boot automatically?
I tried '' chain ${http-images} /rhel67/EFI/BOOT/BOOTX64.efi ${http-images} /rhel67/EFI/BOOT/BOOTX64.conf''

But I just get the grub shell.


RE: Cannot boot vmlinuz in efi - MultimediaMan - 2015-12-28 21:53

(2015-12-28 16:24)silver310 Wrote:  OK I get it. Any advice on how to pass a conf file to grub so it'll boot automatically?
I tried '' chain ${http-images} /rhel67/EFI/BOOT/BOOTX64.efi ${http-images} /rhel67/EFI/BOOT/BOOTX64.conf''

But I just get the grub shell.

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-netboot-pxe-config-efi.html

It's a little messy with the 6.x kernels...


RE: Cannot boot vmlinuz in efi - silver310 - 2015-12-29 09:55

(2015-12-28 21:53)MultimediaMan Wrote:  
(2015-12-28 16:24)silver310 Wrote:  OK I get it. Any advice on how to pass a conf file to grub so it'll boot automatically?
I tried '' chain ${http-images} /rhel67/EFI/BOOT/BOOTX64.efi ${http-images} /rhel67/EFI/BOOT/BOOTX64.conf''

But I just get the grub shell.

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-netboot-pxe-config-efi.html

It's a little messy with the 6.x kernels...


OK I officially give up, I've tried EVERYTHING!

set 210:string ${tftp-server}
set 209:string bootx64.efi
chain ${tftp-server}/bootx64.efi

set 210:string ${tftp-server}
set 209:string efidefault
chain ${tftp-server}/bootx64.efi

set 210:string ${tftp-server}
set 209:string /pxelinux.cfg/efidefault
chain ${tftp-server}/bootx64.efi

set netX.dhcp/filename:string bootx64.efi || goto failed
chain ${tftp-server}/bootx64.efi || goto failed

set netX.dhcp/filename:string bootx64.efi || goto failed
set 210:string ${tftp-server}
set 209:string efidefault
chain ${tftp-server}/bootx64.efi || goto failed

And about 100 more variations of those, and also 10 different grub versions, on many different locations on the server (at root of tftp, http, in folders in tftp, etc...), I've been doing this for the last 4 hours.
This is just ridicules, i've tried exactly what people posted that have worked, and what was written in that red-hat guide, every single time i get the grub shell.
Can i somehow tell when grub is looking for the config file? (if it's looking at all)

Also when trying to use "set netX.dhcp/xxxxx" manu times i get an invalid argument error even thou i have those exact same lines in the same file working without a problem.


RE: Cannot boot vmlinuz in efi - MultimediaMan - 2015-12-29 09:58

(2015-12-29 09:55)silver310 Wrote:  
(2015-12-28 21:53)MultimediaMan Wrote:  
(2015-12-28 16:24)silver310 Wrote:  OK I get it. Any advice on how to pass a conf file to grub so it'll boot automatically?
I tried '' chain ${http-images} /rhel67/EFI/BOOT/BOOTX64.efi ${http-images} /rhel67/EFI/BOOT/BOOTX64.conf''

But I just get the grub shell.

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-netboot-pxe-config-efi.html

It's a little messy with the 6.x kernels...


OK I officially give up, I've tried EVERYTHING!

set 210:string ${tftp-server}
set 209:string bootx64.efi
chain ${tftp-server}/bootx64.efi

set 210:string ${tftp-server}
set 209:string efidefault
chain ${tftp-server}/bootx64.efi

set 210:string ${tftp-server}
set 209:string /pxelinux.cfg/efidefault
chain ${tftp-server}/bootx64.efi

set netX.dhcp/filename:string bootx64.efi || goto failed
chain ${tftp-server}/bootx64.efi || goto failed

set netX.dhcp/filename:string bootx64.efi || goto failed
set 210:string ${tftp-server}
set 209:string efidefault
chain ${tftp-server}/bootx64.efi || goto failed

And about 100 more variations of those, and also 10 different grub versions, on many different locations on the server (at root of tftp, http, in folders in tftp, etc...), I've been doing this for the last 4 hours.
This is just ridicules, i've tried exactly what people posted that have worked, and what was written in that red-hat guide, every single time i get the grub shell.
Can i somehow tell when grub is looking for the config file? (if it's looking at all)

Also when trying to use "set netX.dhcp/xxxxx" manu times i get an invalid argument error even thou i have those exact same lines in the same file working without a problem.

Let me grab my notes for this: it will be later today. As I recall, it was a frustrating exercise.


RE: Cannot boot vmlinuz in efi - NiKiZe - 2015-12-29 22:11

I do not recommend it, but you could use wimboot (since it creates an virtual filesystem) you would need something like this pseudo script
Code:
initrd -n bootx64.efi http://server/grub.efi bootx64.efi
initrd -n grub.conf http://server/grub.conf grub.conf
initrd -n kernel http://server/kernel kernel
initrd -n initrd http://server/initrd initrd
kernel http://server/wimboot
boot

this uses ipxe to download everything to a virtual fs. and grub is then only used to run the files from the virtual fs, at this time grub itself do not load anything from the network.

not sure about the exact name that is needed for grub, it might be bootmgr.efi, use pause and debug the output from wimboot.

In EFI it might work by just doing initrd for all the files (grub conf, kernel, initrd) before loading grub and with any luck the files will be available in the virtual efi fs.


RE: Cannot boot vmlinuz in efi - silver310 - 2015-12-30 13:43

OK so I've been trying to use syslinux to boot this image, but can't get ipxe to chain.
In legacy mode it works fine with the following menu entry:
set pxelinux ${tftp-server}/pxelinux/legacy
set 210:string /pxelinux/legacy
set 209:string /pxelinux.cfg/test
chain ${pxelinux}/pxelinux.0 || goto testing-legacy

pxelinux loads the config file without issues (haven't tried to boot anything, but for me if the config file is loaded then it's ok, legacy isn't an issue for ipxe anyway)
But in EFI mode using the exact menu entry
set pxelinux ${tftp-server}/pxelinux/efi
set 210:string /pxelinux/efi
set 209:string /pxelinux.cfg/test
chain ${pxelinux}/pxelinux.efi || goto testing-legacy

ipxe loaded the files, but when it tries to boot I get the following error
"Getting cached packed
my IP is x.x.x.x
could not boot: Error 0x7f048281 (http://ipxe.org/7f048281)"

What am I doing wrong?


RE: Cannot boot vmlinuz in efi - NiKiZe - 2015-12-30 13:47

(2015-12-30 13:43)silver310 Wrote:  could not boot: Error 0x7f048281 (http://ipxe.org/7f048281)"

What am I doing wrong?

It says that the efi can't be started, is it an efi executable in the correct format? (32bit vs 64bit etc)


RE: Cannot boot vmlinuz in efi - silver310 - 2015-12-30 13:52

(2015-12-30 13:47)NiKiZe Wrote:  
(2015-12-30 13:43)silver310 Wrote:  could not boot: Error 0x7f048281 (http://ipxe.org/7f048281)"

What am I doing wrong?

It says that the efi can't be started, is it an efi executable in the correct format? (32bit vs 64bit etc)

Yes it's x64 efi, i've tried to use 32 bit but that gives an error right away, with x64 it tries (i think) to boot it and then gives an error.
OK so, I've tried to boot pxelinux.efi directly and it works, loads menu and config and everything, and now i see that
"Getting cached packet
My IP is x.x.x.x"
are the first two lines of pxelinux, so now i'm sure the image is the correct format and arch, and that ipxe did boot pxelinux.efi but then it gave an error and returned to ipxe.


RE: Cannot boot vmlinuz in efi - silver310 - 2015-12-31 11:43

SOLVED, finally.
So after 3 days I finally found a solution/workaround, I'll explain everything so other people might use this.

Basically it all comes down to GRUB2, I created a standalone bootx64.efi image with a single menu entry for the desired installation image, in this case RHEL 6.7

To make the standalone bootx64.efi:
install required packages
Code:
sudo yum install grub2-efi*

grub2 uses tftp to download images, while i use http with ipxe, so I had to create a new folder structure in my tftp root folder (until now it only had ipxe for legacy and efi)
Code:
cd /tftpboot
mkdir -p grub2-efi/rhel67server/boot/grub/
cd grub2-efi/rhel67server

now the config file:
Code:
vim boot/grub/grub.cfg

set timeout=0

menuentry 'RHEL 6.7 Server' --class os {
     insmod net
     insmod efinet
     insmod tftp
     insmod gzio
     insmod part_gpt
     insmod efi_gop
     insmod efi_uga

     # tftp server
     set net_default_server=192.168.0.1

     # dhcp did not work, no idea why
     # net_bootp

     # assign a static IP
     net_add_addr eno0 efinet0 192.168.0.100

     echo 'Loading vmlinuz ...'
     linux (tftp)/grub2-efi/rhel67server/vmlinuz repo="http://192.168.0.1/images/iso_images/RHEL_6.7_server" root=/dev/null

     echo 'Loading initial ramdisk ...'
     initrd (tftp)/grub2-efi/rhel67server/initrd.img
}

without "root=/dev/null" the installation couldn't find any hard-drives (no idea why)

now, while in /tftpboot/grub2-efi/rhel67server/ run the following command:
Code:
grub2-mkstandalone -d /usr/lib/grub/x86_64-efi/ -O x86_64-efi --fonts="unicode" -o bootx64.efi boot/grub/grub.cfg

you'll see a new file "bootx64.efi", copy to the same directory the kernel and initrd files of the wanted installation.

Finally in ipxe I just chain to the newly created file:
Code:
:rhel67-efi
echo Starting RHEL 6.7 Server x64 (EFI)
chain ${tftp-server}/grub2-efi/rhel67server/bootx64.efi || goto rhel67-efi


And that's it, work perfectly fine, hope this helps someone else, I'm going to add some older versions of RHEL and hopefully it'll work for them as well.
Only issue is that grub uses tftp and it's a lot slower, loading the same files (vmlinuz, initrd.img) via http takes less then a second, while via tftp it can take up to 15-20 seconds, is it possible from grub to use http instead of tftp?


RE: Cannot boot vmlinuz in efi - sspans - 2016-05-24 10:04

I've solved this by using a memdisk to store the vmlinuz/initrd.
Sample script below:

Code:
# needed to build a custom bootloader
yum install grub2-efi-modules

mkdir -p boot/grub
cp grub.cfg boot/grub/
tar cvf memdisk.tar vmlinuz initrd.img boot
grub2-mkimage  -v --memdisk=memdisk.tar -o bootx64.efi -O x86_64-efi memdisk tar echo sleep linux linuxefi lsefi reboot multiboot linux16 boot efi_uga gfxterm
rm -rf memdisk.tar boot

And a grub.cfg like this:
Code:
menuentry "CentOS-6" {
    set gfxpayload=keep
    linux (memdisk)/vmlinuz ks=http://boot.mccm.mcinfra.net/install/centos-6/install.ks ksdevice=link
    initrd (memdisk)/initrd.img
}

set timeout=0
set default="CentOS-6"



RE: Cannot boot vmlinuz in efi - adokania - 2017-03-15 12:04

As I understood, this recompiled binary bootx64.efi will only work on tftp server with an IPaddress mentioned in grub.cfg file. Is there a way to make it general? Why are we assigning a static Ip address through grub.cfg?


(2015-12-31 11:43)silver310 Wrote:  SOLVED, finally.
So after 3 days I finally found a solution/workaround, I'll explain everything so other people might use this.

Basically it all comes down to GRUB2, I created a standalone bootx64.efi image with a single menu entry for the desired installation image, in this case RHEL 6.7

To make the standalone bootx64.efi:
install required packages
Code:
sudo yum install grub2-efi*

grub2 uses tftp to download images, while i use http with ipxe, so I had to create a new folder structure in my tftp root folder (until now it only had ipxe for legacy and efi)
Code:
cd /tftpboot
mkdir -p grub2-efi/rhel67server/boot/grub/
cd grub2-efi/rhel67server

now the config file:
Code:
vim boot/grub/grub.cfg

set timeout=0

menuentry 'RHEL 6.7 Server' --class os {
     insmod net
     insmod efinet
     insmod tftp
     insmod gzio
     insmod part_gpt
     insmod efi_gop
     insmod efi_uga

     # tftp server
     set net_default_server=192.168.0.1

     # dhcp did not work, no idea why
     # net_bootp

     # assign a static IP
     net_add_addr eno0 efinet0 192.168.0.100

     echo 'Loading vmlinuz ...'
     linux (tftp)/grub2-efi/rhel67server/vmlinuz repo="http://192.168.0.1/images/iso_images/RHEL_6.7_server" root=/dev/null

     echo 'Loading initial ramdisk ...'
     initrd (tftp)/grub2-efi/rhel67server/initrd.img
}

without "root=/dev/null" the installation couldn't find any hard-drives (no idea why)

now, while in /tftpboot/grub2-efi/rhel67server/ run the following command:
Code:
grub2-mkstandalone -d /usr/lib/grub/x86_64-efi/ -O x86_64-efi --fonts="unicode" -o bootx64.efi boot/grub/grub.cfg

you'll see a new file "bootx64.efi", copy to the same directory the kernel and initrd files of the wanted installation.

Finally in ipxe I just chain to the newly created file:
Code:
:rhel67-efi
echo Starting RHEL 6.7 Server x64 (EFI)
chain ${tftp-server}/grub2-efi/rhel67server/bootx64.efi || goto rhel67-efi


And that's it, work perfectly fine, hope this helps someone else, I'm going to add some older versions of RHEL and hopefully it'll work for them as well.
Only issue is that grub uses tftp and it's a lot slower, loading the same files (vmlinuz, initrd.img) via http takes less then a second, while via tftp it can take up to 15-20 seconds, is it possible from grub to use http instead of tftp?



RE: Cannot boot vmlinuz in efi - renato - 2017-09-11 20:17

(2017-03-15 12:04)adokania Wrote:  ... is it possible from grub to use http instead of tftp?

Yes, it is possible

Code:
# setup network
net_bootp

# boot using http
linux (http,server-ip)/vmlinuz
initrd (http,server-ip)/initrd.img

Renato