0

Everybody seems to be using GRUB to boot UEFI machines via PXE from the network. While it works, it lacks an important feature to be able to direct certain known clients right away. GRUB just requests grub/grub.cfg right away.

PXELINUX has the following feature: before loading the "default" configuration, it tries a few special names, derived from client's MAC address and IP address. For example, for a client which has IP 172.31.1.38 (which is hexadecimal AC1F0126), and MAC BC:24:11:21:4D:14 it will try to load a configuration from TFTP server in the following order:

pxelinux.cfg/01-bc-24-11-21-4d-14
pxelinux.cfg/AC1F0126
pxelinux.cfg/AC1F012
pxelinux.cfg/AC1F01
pxelinux.cfg/AC1F0
pxelinux.cfg/AC1F
pxelinux.cfg/AC1
pxelinux.cfg/AC
pxelinux.cfg/A
pxelinux.cfg/default

So, with PXELINUX I can create a dedicated configuration files for certain known clients where I can include a reference to a preseed or kickstart script which was specially crafted for that client. It would perform a fully unattended installation of the system, and all of this is used in automation (both to spawn VMs and to prepare bare metal servers). When the installation is started it just removes this dedicated bootloader configuration so next time the machine will boot off network, but there it will now hit the default configuration file which instructs to boot from a local hard disk. I actually ran such an infrastructure for 10+ years, and it was awesome.

But nowadays we need to have the same for UEFI clients, and PXELINUX doesn't seem to work with UEFI.

Is there a way to have the similar functionality with GRUB PXE, to be able to do the same thing with UEFI clients, for it to request a dedicated configuration file, or to use a client-specific "default" boot menu option from a common configuration file?

Or, maybe there is yet another UEFI PXE bootloader which is able to do it like this?

1 Answer 1

0

Actually GRUB supports the same configuration file scheme as PXELinux. It is described in the GRUB manual.

I did not happen to see it working because I used some random build of GRUB from Ubuntu which seems to omit this feature. Also, there is a discrepancy in the manual: it says we have to name the file grub.cfg-<MAC>, and the from the example it is clear that should be replaced with MAC address, where colons : are replaced with dashes -, and all "letters" in the hex changed to lowercase, like this: grub.cfg-52-54-00-ec-33-81. But in reality, GRUB requested the file grub.cfg-01-<MAC> (at least, my GRUB built in Gentoo with mostly default USE-flags), e.g., in my case, it was grub.cfg-01-bc-24-11-5b-65-e5, very much like PXELinux does. Also, despite being announced in the manual, my GRUB did not request the file grub.cfg-<UUID>. But it requested all the grub.cfg-<IP_part> variants exactly as described in the manual (grub.cfg-AC1F0134, grub.cfg-AC1F013 and so on, for 172.31.1.52).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .