I'm trying to automate the installation of physical servers using PxE. In this case I'm installing Oracle Virtual Servers (OVS for short, RHEL/Centos-like systems with Xen and custom linux kernel). I followed the steps outlined in the official documentation and implemented them using ansible.
To summarize I took in account some important notes:
- I'm using version 3.4.2 so I'm building my own boot loader for UEFI-based PXE clients.
- I'm using Oracle Linux 7.3 since it provides the grub2-tools package that is required to build the GRUB2 boot loader.
With ansible I configured my tftp, dhcp and http servers (for simplicity all of them in the same box) which all seem to be working as expected (tested downloading files and IP assignment and everything works). Here is how I'm building the boot loader
$ grub2-mkimage -p '(tftp,<tftp server IP>)' -O x86_64-efi -d <path to grub2 modules taken from installation iso> -c <path to grub2.cfg file> -o <path to tftp-server dir>/core.efi <embeded modules: net efinet tftp gzio part_gpt efi_gop efi_uga video_bochs video_cirrus all_video ext2 multiboot2 normal>
Here is the current state of my grub2.cfg file:
set timeout=60
# Load modules
insmod net
insmod efinet
insmod tftp
insmod gzio
insmod part_gpt
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod all_video
insmod ext2
insmod multiboot2
insmod normal
menuentry 'Install Oracle VM Server 3.4.2' --class fedora --class gnu-linux --class gnu --class os {
# dhcp, tftp server in my network
set net_default_server=<tftp IP>
# This is for testing
echo 'Network status: '
net_ls_addr
net_ls_routes
echo 'Loading Xen...'
multiboot2 /isolinux/xen.gz dom0_mem=max:11582M dom0_max_vcpus=20 noreboot
echo 'Loading Linux Kernel...'
module2 /isolinux/vmlinuz ip=dhcp vlanid=<vlan> repo=http://<Http server IP>/pxelinux/ISOs/OVS3.4.2 ks=http://<http server IP>/pxelinux/kickstart/ovs-3.4.2.ks ksdevice=<mac address of the dhcp configured nic>
echo 'Loading initrd...'
module2 /isolinux/initrd.img
}
The server boots properly, the IP is being set, both the core.efi image and the grub2.cfg file are being downloaded from the tftp server and I get the "Welcome to Grub!" message but just when it should run what's configured in the grub2.cfg file this happens:
//Start PXE Over IPv4
Station IP Address is X.X.X.X
Server IP Address is X.X.X.X
NBP filename is /boot/grub2/core.efi
NBP filesize is 397824 Bytes
Downloading NBP file...
Succeed to download NBP file.
Downloading NBP file...
Succeed to download NBP file.
Welcome to GRUB!
Unknown command 'menuentry'.
Unknown command '#'.
Unknown command '#'.
Unknown command 'echo'.
efinet0 <mac address> <dhcp delivered ip>
efinet0:local <net segment>/<netmask> efinet0
efinet0:default 0.0.0.0/0 gw <network gateway>
Unknown command 'echo'.
Unknown command 'echo'.
Unknown command 'echo'.
Unknown command '}'.
And finally I'm directed to the grub prompt, where I can type all the commands in the grub2.cfg file correctly and actually boot and install my system with kickstart. So I'm guessing I'm missing something in the grub2 image creation because it's like some modules are not being imported before running the grub2.cfg file?? Only certain commands are being run, the rest are "Unknown".