When I create a host and enabled build mode, the 01-{mac:address} folder with the corresponding boot.cfg file is not created. When booting the host, it fails after getting a DHCP lease:
Start PXE over IPv4
Station IP address is 10.11.12.50
Server IP address is 10.11.12.4
NBP filename is grub2/bootx64.efi
NBP filesize is 0 bytes
PXE-E23: Client received TFTP error from server.
The host does not load mboot.efi. The contents of a Dell esxi 6.5 build 8935087 iso have been copied to /var/lib/tftpboot/boot/ESXi-6.5-8935087 and its corresponding mboot.efi copied to /var/lib/tftpboot (ownership to foreman-proxy:root)
The scripts have been discovered:
2018-11-13T14:00:11 [I|app|] Finished discovering 2 hooks for Host::Managed#after_build
2018-11-13T14:00:11 [I|app|] Finished discovering 2 hooks for Host::Managed#before_provision
The after_build and before_provisions logs keep complaining jgrep is not found:
/usr/share/foreman/config/hooks/host/managed/after_build/hook_functions.sh: line 24: jgrep: command not found
/usr/share/foreman/config/hooks/host/managed/before_provision/hook_functions.sh: line 24: jgrep: command not found
I’ve gone through the config multiple times and it looks exactly like what the guide suggested without any deviations.
Any help to point me in the right direction would be much appreciated.
I’m not sure why you’re encountering that particular error, but you can probably workaround it without altering the script by adding /usr/share/foreman/vendor/ruby/2.3.0/bin/ to the PATH of whatever user is invoking that script. This is usually done in .bashrc.
/tmp/after_build.log and /tmp/before_provision.log now have no errors:
Thu Nov 15 10:04:21 AWST 2018: received after_build on esxi65build04
Thu Nov 15 10:08:32 AWST 2018: received before_provision on esxi65build04
But still failing when PXE booting with the same PXE error:
NBP filename is grub2/bootx64.efi
NBP filesize is 0 bytes
PXE-E23: Client received TFTP error from server
Its not handing over to mboot.efi and I also noticed when the host is enabled for build mode, the '01-{mac-address} directory is not created in /var/lib/tftpboot.
I’ve given others write permission to the tftpboot directory but still no joy;
drwxr-xrwx 9 root nogroup 4096 Nov 15 10:03 tftpboot/
Without the ‘01-{mac-address}’ directory and the boot.cfg file inside it, I’m assuming the PXE boot doesn’t handover to mboot.efi.
Hello,
The mboot.efi bootloader does not exist by default in Foreman. You need to edit the source code to create an entry for it. It’s under section 3.2 of the guide. Once that is done, change the PXE Loader of the host to this newly created entry and set build mode to on. Then in dhcpd.leases file you should see an entry of the host with bootfile as mboot.efi.
grub2 does not even come into the picture here because it cannot chainload the ESXi EFI bootloader.
I’ve followed the guide exactly except for section 2 which is BIOS boot which I don’t need. The entire section 3 was completed, including 3.2.
Once build mode is enabled, I verify that after_build.log is updated and I then PXE boot the physical machine. But it fails to load mboot.efi. As shown earlier, the dhcp lease does not have the bootfile entry.
dhcpd.conf does have the bootfile handoff section like in the requirements section of the guide. But how does this part …
dhcpd.leases file you should see an entry of the host with bootfile as mboot.efi
… occur? Is there some other configuration that will make this happen?
If the host PXE-Loader is anything other than “None”, Foreman creates an entry for that host in the leases file with the appropriate pxe loader as bootfile once build mode is set. No additional configuration is needed.
A couple of stuff to verify for you:
Try to deploy any other Linux OS (CentOS) through Foreman. See if the lease file points to the right pxe loader once build mode is set.
When you set the custom PXE loader for mboot.efi in the host on the webpage, does Foreman throw an error?
The foreman user needed write access to /var/lib/tftpboot
A subnet needed to be created on the Foreman web interface for the DHCP scope (DOH!)
Then create a host in build mode as per the doco, configure the host for uefi boot and the nic as the first boot sequence, disk as second boot sequence. The host will then pick up a DHCP lease, load mboot.efi and run the installer. After installation, the host will reboot, fail to pxe boot and then boot to the next option which is the disk where esxi is installed.
I highly suggest to use Python for hooks, we have an example script there. Both bash and Ruby are a bit problematic (shell scripting is usually a bit limited, jgrep does not work well with Ruby SCL and you need to reinstall it after upgrade manually).