GRUB2 UEFI & PXE — Cobbler ready!

Note: my experience with GRUB2 is the heavily hacked version from Fedora 19. I don’t think upstream behaves this way (TODO testing on upstream).

GRUB2 on UEFI/PXE seems to have matured enough that it might be usable in Cobbler to replace grub-legacy. It has network support now and it searches for its grub.cfg in creative ways from the TFTP server by using name-mangling just like PXELINUX and grub-legacy (UEFI/PXE)

Recap: PXELINUX boot will try to find its config by constructing  a filename from the mac address, IP address-digit-striping. E.g.,01-88-99-aa-bb-cc-dd  C000025B C000025

Cobbler makes use of this for per-system installation configs. For UEFI/PXE systems: grub-legacy 0.97 that comes with Red Hat-like systems emulates PXELINUX behaviour. When grub-legacy is booted using UEFI/PXE it will reach back to the TFTP server and pull its config with filenames constructed from  UUID, mac address, IP address-digit-striping.

Unfortunately, grub-legacy UEFI/PXE + RHEL6.x installer gives me problems on Dell PowerEdge servers. On some boots I cannot get console graphics, as if the UEFI-GOP is not initialised correctly.  The installer works because I am able to use the serial console and anaconda over vnc. I have hit this on M910, R715 and a whole assortment of PowerEdge servers. The funny thing is that when the installation completes, I have no problems booting the system with grub-legacy and seeing the Linux penguin icons at the top of the boot messages. Perhaps the installer initialises the video in a more conservative fashion.

E.g., CentOS 6.4 installer ISO on UEFI — no console during installation but serial console and vnc both work.

I was hoping to move to GRUB2 as I have had it boot the OS installer (RHEL6.x type)  without fail on Dell PowerEdge in UEFI mode. Dell’s own OpenManage Deployment Toolkit v4.3 (Linux) has also switched to GRUB2; it touts UEFI-support and I’m guessing the move to GRUB2 is due to the rather fragile grub-legacy/UEFI behaviour.

However GRUB2/UEFI/PXE as a Cobbler grub-legacy replacement component depends on a working PXE stack and config file search algorithm. That day has arrived!

Prepared a PXE/UEFI-aware GRUB2 image (from Fedora 19) using:

grub2-mkstandalone –net-directory /var/lib/tftpboot  –subdir grub2-efi

The resulting core.efi bootloader has efinet, tftp and other essential network modules loaded; the variables root and prefix are set correctly so that grub2 can find its modules and config file. In fact, before loading the config file, the bootloader immediately reaches back to the TFTP server and pulls some modules.

Here is the full list of files that GRUB2/UEFI/PXE pulled down. You can see the search algorithm.

BOOTX64.efi <– copied /grub2-efi/x86_64-efi/core.efi here

/grub2-efi/x86_64-efi/normal.mod
/grub2-efi/x86_64-efi/terminal.mod
/grub2-efi/x86_64-efi/crypto.mod
/grub2-efi/x86_64-efi/extcmd.mod
/grub2-efi/x86_64-efi/gettext.mod
/grub2-efi/x86_64-efi/gzio.mod
//grub.cfg
/grub2-efi/grub.cfg-01-30-85-a9-46-ae-9e
/grub2-efi/grub.cfg-C0A80196
/grub2-efi/grub.cfg-C0A8019
/grub2-efi/grub.cfg-C0A801
/grub2-efi/grub.cfg-C0A80
/grub2-efi/grub.cfg-C0A8
/grub2-efi/grub.cfg-C0A
/grub2-efi/grub.cfg-C0
/grub2-efi/grub.cfg-C
/grub2-efi/x86_64-efi/command.lst
/grub2-efi/x86_64-efi/fs.lst
/grub2-efi/x86_64-efi/fs.lst
/grub2-efi/x86_64-efi/crypto.lst
/grub2-efi/x86_64-efi/crypto.lst
/grub2-efi/x86_64-efi/terminal.lst
/grub2-efi/x86_64-efi/terminal.lst
/grub2-efi/grub.cfg
/grub2-efi/x86_64-efi/linux.mod
/grub2-efi/x86_64-efi/video.mod
/grub2-efi/x86_64-efi/video.mod
/grub2-efi/x86_64-efi/relocator.mod
/grub2-efi/x86_64-efi/mmap.mod
/grub2-efi/x86_64-efi/mmap.mod
//images/centos-6.4-x86_64/vmlinuz
//images/centos-6.4-x86_64/initrd.img

Now to see when Cobbler incorporates this as an alternate bootloader.

One weirdness of Fedora 19-GRUB2 is that some variables don’t seem to be populated. Bug, much?

net_default_interface=efinet1
net_default_ip=
net_default_mac=
net_default_server=
pxe_default_server=

Hmmmm…… why all the blank variables? Shouldn’t they be copied from net_efinet1_XX? The missing *_server variables look fishy. P.S. Further testing show that upstream GRUB2 fills in all the aforementioned vars.