Skip to content

Instantly share code, notes, and snippets.

@cwacek
Last active January 17, 2022 21:26
Show Gist options
  • Save cwacek/5910195 to your computer and use it in GitHub Desktop.
Save cwacek/5910195 to your computer and use it in GitHub Desktop.
A description of how to make Cobbler, PXE, and UEFI behave for Red Hat Enterprise Linux 6 installations

UEFI PXE Installation of RHEL6.4

For some reason, starting a PXE boot installation of RHEL6.4 on UEFI systems is poorly documented. Simultaneously, the process is not terribly verbose when it fails. Here's what I had to do to get this to work.

We going to use Cobbler to take care of a lot of the gruntwork (TFTP, DHCP, etc). It's entirely possible to do it without Cobbler, but even accounting for its warts it will make you more sane. Here's a basic list of what you'll need:

  • One host to run all of the Cobbler services. I'm going to refer to this as the server.
  • A local network connecting the hosts you want to PXE install.
  • A copy of the RHEL installation media.

Setting up Cobbler

There's usually a version of Cobbler in the EPEL repository, but it's also quite old and much of the EFI PXE functionality has been updated in the Cobbler source. As such I recommend grabbing it from Github.

On the server:

git clone https://github.com/cobbler/cobbler
git checkout cobbler-2.4.0-1 # Get the 2.4.0 release branch
cd cobbler
make rpms
# You may have to satisfy some dependencies for 
# this next step. Use Yum do to so.
sudo rpm -i cobbler-2.4.0-1.el6.noarch.rpm

You now have a basic Cobbler installation. We'll need to modify some things to get everything working. First, let's make sure Cobbler is running and accessible.

sudo service httpd restart
sudo service cobblerd restart
# Get the EFI (and other) boot loaders we'll need
cobbler get-loaders

Make sure you 'restart' cobblerd. If you 'start' it when it's already started it gets into a bad state.

Configuring Cobbler

Before we tweak the Cobbler installation, get the installation media available by inserting the DVD or mounting the ISO somewhere. I'll refer to the location with the source as $RHEL_SOURCE. Now we'll import it into Cobbler.

cobbler import --arch=x86_64 --name=rhel6.4
--path=$RHEL_SOURCE

This will produce a distro and a profile for RHEL6.4 within Cobbler. You can see them if you run cobbler report. The profile will appear as a boot option once we sync the changes, but first we need to configure a few more things.

Go to the Cobbler configuration directory:

cd /etc/cobbler

The main configuration file is called settings. Modify as necessary for your environment, but make sure you set the following options:

# /etc/cobbler/settings
kernel_options:
    ksdevice: link # If you have more than one *connected* 
                   # network card you may need something different 
                   # here. The default option is 'bootif',
                   # but the PXE environment doesn't seem to
                   # pass the right options so it doesn't
                   # work.
    lang: 'en_US'  # Obviously use your language of choice

manage_dhcp: 1
next_server: <ip>  # The IP of server on the local network
server: <ip>       # Same

You'll also need to modify the DHCP configuration template located at /etc/cobbler/dhcp.template as appropriate for your environment. Now we'll restart Cobbler to accept the changes

service cobblerd restart

Fixing things for UEFI/PXE

The standard Cobbler install won't load the installer properly on UEFI systems. One of the reasons for this is that it doesn't include the bootsplash image, without which you'll just get yellow text on a white screen (don't ask, I don't know why).

We'll modify our profile to transfer the boot splash image to the TFTP directory and to use basic video mode:

cobbler distro edit --name=rhel6.4-x86_64 --boot-files="/var/lib/tftpboot/grub/splash.xpm.gz=$RHEL_SOURCE/EFI/BOOT/splash.xpm.gz --kopts="xdriver=vesa nomodeset"

And we modify the /etc/cobbler/pxe/efidefault file to load the boot splash:

# /etc/cobbler/pxe/efidefault
default=0
timeout=10
splashimage=(nd)/splash.xpm.gz

$grub_menu_items

Booting the clients

Restart Cobbler one more time:

service  cobblerd restart

Check for any errors. This will probably produce warnings, but they're not all fatal. Fix any that look particularly bad

cobbler check

Sync Cobbler to push all the changes:

cobbler sync

Boot the clients in PXE mode, and the installer should start right up. Presumably you'll want to use a Kickstart file, but there are lots of good references for that.

@FlorianHeigl
Copy link

Thanks!

@opoplawski
Copy link

cobbler is updated pretty well in EPEL these days, and 2.4.0 is ancient at this point. Should be /etc/cobbler/pxe/efidefault.template with cobbler 2.6. Maybe time to just drop this file?

Copy link

ghost commented Oct 15, 2016

Could you give an example of how to do this UEFI thing for CentOS 7 please, this is not working for me.

@kihara-m
Copy link

Hi

Would this be a typo?

You mention:
We'll modify our profile to transfer the boot splash image to the TFTP directory and to use basic video mode:

But instead of updating the profile, it looks like you updated the distro:
cobbler distro edit --name=rhel6.4-x86_64

@kihara-m
Copy link

Got it working. This helped

"cobbler get-loaders --force"

@kihara-m
Copy link

This may actually be wrong:
We'll modify our profile to transfer the boot splash image to the TFTP directory and to use basic video mode:

I think you meant to say:
We'll modify our distro to transfer the boot splash image to the TFTP directory and to use basic video mode:

@jabooi
Copy link

jabooi commented Mar 2, 2020

Nice! Just got this to work on Cobbler 2.8.5 with Centos7 :)

Tips for the curious ones: If you're having trouble finding a splash.xpm.gz, just google how to create a custom grub(legacy) splash, there is plenty of guides for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment