iPXE discussion forum
using ipxe.lkrn and script in grub.conf crashes - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: using ipxe.lkrn and script in grub.conf crashes (/showthread.php?tid=10560)



using ipxe.lkrn and script in grub.conf crashes - vigo332 - 2017-11-27 19:59

Hi, all,

I plan to use ipxe to kickstart upgrade/install the RHEL 7.4 OS on about 100 servers in different buildings with static IP settings.

In my testing VM using VirtualBox, I tried to use ipxe.lkrn and my custom script for this, I first boot using existing grub.efi and load grub.conf, I set the default to the ipxe.lkrn boot options. My grub.conf has the following, note (hd0,1) corresponds to /boot, (hd0,0) corresponds to /boot/efi

# tail grub.conf
title ipxeboot
root (hd0,1)
kernel (hd0,1)/ipxe.lkrn initrd=myscript.ipxe
initrd (hd0,1)/myscript.ipxe

the myscript.ipxe has: (I have two interfaces net0 is dhcp, net1 is host-only static interface used to download from ftp/http server)
#!ipxe
echo "Setting up the network interfaces"
ifopen
dhcp
set net1/ip 192.168.56.155
set net1/netmask 255.255.255.0
ifstat
chain http://192.168.56.150/ftp/ipxe/bootscript.ipxe

However, when I boot with these settings, the vm instantly crashes. It seems that it crashes after allocating pages for the kernel. This documentation http://ipxe.org/embed says it will work. Could anyone help?


Note: I was able to chainload grub.efi to ipxe.efi with embedded script to upgrade the OS. However, I have to build the ipxe.efi binary for each server to update with a specific IP it will use.
For example,

In grub.conf I have
title use ipxe
root (hd0,0)
chainloader /EFI/redhat/ipxe.efi

My ipxe.efi builds in with the following script
#!ipxe
echo "Setting up the network interfaces"
ifopen
dhcp
set net1/ip 192.168.56.155
set net1/netmask 255.255.255.0
ifstat
chain http://192.168.56.150/ftp/ipxe/bootscript.ipxe

My bootscript.ipxe has

#!ipxe
echo "Setting up the network interfaces"
ifopen
dhcp
set net1/ip 192.168.56.155
set net1/netmask 255.255.255.0

kernel http://192.168.56.150/ftp/tree/isolinux/vmlinuz initrd=initrd.img ks=http://192.168.56.150/ftp/tmp/test-ks.cfg ro root=live:http://192.168.56.150/ftp/tree/LiveOS/squashfs.img inst.repo=http://192.168.56.150/ftp/tree other kernel arguments ...
initrd http://192.168.56.150/ftp/tree/isolinux/initrd.img
boot

Since I have > 100 machines, I have to set the ip differently in the myscript.ipxe and bootscript.ipxe for each machine, which means I have to compile/embed the ipxe.efi with the scripts differently for each machine. This is not elegant as using the ipxe.lkrn, where I only need to distribute the myscript.ipxe with correct IP, no need to build the ipxe.efi.

Thanks