This script is used to convert the tftp boot files (found in /var/lib/tftpboot/pxelinux.cfg/) which are automatically generated by Satellite 6 into the old legacy grub format.
Why is this useful? Recently I encountered some HP servers which have an additional 10GbE card in one of the PCI-E slots on the machine which is used for the PXE boot.
Unfortunately this additional interface only supports UEFI boot and not classic bios boot. By default Satellite 6 uses the shim image for UEFI (https://github.com/rhinstaller/shim) but this doesn't work with the older Linux kernel used by RHEL6.X (rhboot/shim#65).
If this script is executed on a capsule or satellite server which has TFTP enabled, it will automatically replace the boot files using the old format which gives a successful boot for RHEL6.
- The syntax of the boot files changed in Satellite 6.1.X to 6.2, for some reason the file now uses upper case names, this was fixed.
- If the machine is booted before the script has executed, it will fail to boot. You should wait 1-3 minutes for the script to run before booting a machine.
- Once a machine has its operating installed, the boot order should be changed so network boot is low priority. The current script doesn't provide a 'local boot' option like in grub2, so the machine will fail to boot after its OS has been installed previously.
There are multiple steps to configuring the boot. First off, we need to modify the dhcp configuration to pickup the legacy grub config instead of the config automatically setup by Satellite.
- Note that if you modify the dhcp config, you should modify your katello install options so the configuration is not replaced after an upgrade/re-run of satellite installer.
First, modify the DHCP configuration to include your networks in which you wish to serve DHCP requests from. If you need to span to multiple subnets, don't forget to add DHCP helpers.
Below is an example configuration, note the grub1 PXE options:
dhcpd.conf
omapi-port 7911;
default-lease-time 3600;
max-lease-time 86400;
log-facility local7;
ddns-update-style none;
option domain-name "somedomain.com";
option domain-name-servers 128.163.133.51, 128.9.49.51;
allow booting;
allow bootp;
option fqdn.no-client-update on; # set the "O" and "S" flag bits
option fqdn.rcode2 255;
next-server 128.10.152.10;
# grub1 pxe options
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option architecture code 93 = unsigned integer 16;
if option architecture = 00:00 {
filename "pxelinux.0";
} elsif option architecture = 00:09 {
# filename "shim.efi";
filename "/pxelinux/grub.efi";
} elsif option architecture = 00:07 {
# filename "shim.efi";
filename "/pxelinux/grub.efi";
} elsif option architecture = 00:06 {
# filename "shim.efi";
filename "/pxelinux/grub.efi";
} else {
filename "pxelinux.0";
}
include "/etc/dhcp/dhcpd.hosts";
#################################
# somedomain.com
#################################
# some random network
subnet 128.10.152.0 netmask 255.255.248.0 {
range 128.10.152.1 128.10.159.254;
option subnet-mask 255.255.248.0;
option routers 128.10.152.1;
option broadcast-address 128.10.159.255;
}
- If you modify the dhcp config, don't forget to restart the dhcpd daemon:
systemctl restart dhcpd
- Create the folder /var/lib/tftpboot/pxelinux/ and the grub.efi image from a RHEL6 installation (should be found in /boot/EFI or /boot/efi/EFI/redhat) or the RHEL6 DVD (should be found in /EFI/BOOT/BOOTX64.efi and can be renamed to grub.efi).
- Set the correct SELinux context and file permissions on the folder and boot image.
- Copy the RHEL6/7 images from /var/lib/tftpboot/images/ folder (vmlinuz, img files) to /var/lib/tftpboot/pxelinux/ and give files correct permissions. Note that the script performs this step automatically.
-
Download the efi-converter.sh script, give it the correct context and file permissions. If you wish to run the script as another user, make sure you adjust the file location/permissions so the user can execute the script.
-
The example below shows how to run the script from root home directory via root's crontab (crontab -e).
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
/* * * * * /root/efi-converter.sh
- More cron options can be found here: https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-autotasks-cron-configuring.html
- Make sure all steps have been done correctly. The script can be run manually and boot files can be checked in /var/lib/tftpboot/pxelinux.
- Restart services and boot a server, it should network boot correctly.