PXE Server - CentOS 6.5 64bit
Objective - Client should be presented with OS choices in network boot menu - Oracle Linux 6.5, RHEL 7, Ubuntu 14. Upon selection it should proceed with the selected OS installation.


You can boot grub over the network through TFTP. grub can then present a menu of choices for the next thing to boot in the manner that it usually does. Those choices can be various OS installers. grub can load the chosen OS installer also through TFTP.

I know that the Debian (and Ubuntu) installer can be booted as a single self-contained Linux kernel + initramfs (initrd) combination. That's the easiest because that can be booted by grub in a straightforward fashion (a menuentry with linux and initrd directives) and you don't need to arrange for the installer to gain access to anything else. Probably those other distribution's installers are similar.

There are some notes here on setting up grub to boot over TFTP with EFI. More documentation can be easily found by searching. Basically it comes down to configuring the DHCP server and putting the right files on the TFTP server. Locations for the DHCP server configuration file and TFTP server root directory will vary from one OS to another.

  • The DHCP server needs to supply a boot file name to the client as a DHCP option. This is standard for any net boot. The boot filename points to a filename located on the TFTP server that contains grub.

  • For the grub image, you can use either a bundled standalone image (instructions for making one at the previously referenced page), bootx64.efi, or just the grub core core.efi. In the latter case grub will need to load additional modules as well as its config file separately from the TFTP server once it is running.

  • grub.cfg should be a normal grub configuration file in which you specify the pathnames to the kernel and initrd as (tftp)/path/to/the/object. Of course you will give the kernels and initrds of different OS installers different names on the TFTP server.

  • Can you please explain in some detail. This method is totally new to me. I am used to the standard procedure of PXE boting using pxelinux.0. The problem this method is causing is that pxelinux.0 is unique to a distro and in dhcpd.conf you can only specify a single pxelinux.0. I hope I have been able to make myself clear. – Gh0sT Feb 1 '15 at 9:31
  • Right. That's why the key to this technique is to load grub first (by specifying bootx64.efi or core.efi as the file to load in the DHCP option), not any individual distro's pxelinux.0 or other file. It's adding an extra layer of bootloading. grub is a generic bootloader so it is capable of presenting a menu of choices and boot different OSes just like it can do when run from a local disk. grub can run anything as long as you can supply it in the form of a kernel and initrd. – Celada Feb 1 '15 at 9:45
  • Wow that's nice! I'm off to try this out. Will update if I run into issues. Thanks! – Gh0sT Feb 1 '15 at 9:54
  • 1
    Your EFI firmware can run anything if supplied kernel, initramfs image. Grub is the middleman, but this is an excellent use cae for it though. It might not be long though before grub becomes an anachronism even in this department: the latest version of refind incorporates experimental support for ipxe via a compile time option, which must mean ipxe is finally getting the efi kinks worked out. I guess pretty soon we'll be booting from google drive straight from firmware. – mikeserv Feb 1 '15 at 13:45
  • @mikeserv My Mac Mini is already capable of booting from the cloud straight from firmware. They have it as a feature to recover from broken (or absent) OS installations. – Celada Feb 2 '15 at 2:04

pxelinux.0 is a generic PXE boot loader for Linux from syslinux project. You can use single pxelinux.0 for all Linux distributions you have. The only thing you need to do is to update the PXE config pxelinux.cfg/default, pxelinux.cfg/CLIENT_MAC or pxelinux.cfg/PORTION_OF_CLIENT_IP depending on you settings.

You can:

  • chain menus, see pmagic_advanced entry
  • chain PXE loaders, see openbsd entry (AFAIK, Linux PXE bootloader can't boot BSD kernel)
  • chain TFTP servers, see pxeserver2 entry
  • drop to 1st HDD boot, you may copy it from syslinux menu (live USB) or isolinux menu (live CD) they belong to the same project and use same syntax for boot config.

Example for my pxelinux.cfg/default:

DEFAULT partedmagic_6.7

LABEL test_kernel
    MENU LABEL ^Test Kernel
    KERNEL hello.boot

LABEL partedmagic_6.7
    LINUX pmagic_6.7/bzImage
    INITRD pmagic_6.7/initramfs
    APPEND edd=off load_ramdisk=1 prompt_ramdisk=0 rw vga=normal loglevel=9 max_loop=256

LABEL partedmagic_5.5
    MENU LABEL PartedMagic 5.5
    LINUX pmagic_5.5/bzImage
    APPEND initrd=pmagic_5.5/initramfs edd=off noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 loglevel=0 max_loop=256

menu begin pmagic_advanced
        menu title PartedMagic 5.5 Advanced
        label mainmenu
                menu label ^Back..
                menu exit
        include /pmagic_5.5/boot/syslinux.cfg
menu end

LABEL clonezilla_20100623
    MENU LABEL ^CloneZilla 2010.06.23
    KERNEL clonezilla_20100623/vmlinuz
    APPEND initrd=clonezilla_20100623/initrd.img boot=live union=aufs noswap noprompt vga=788 ocs_live_keymap=NONE ocs_lang=en_US.UTF-8 fetch=tftp://

LABEL unattended_4.9
    MENU LABEL Unattended 4.9 for ^XP
    KERNEL unattended_4.9/bzImage
    APPEND initrd=unattended_4.9/initrd z_path=\\\install_4.9

LABEL slitaz
    MENU LABEL ^Slitaz.iso
Testing boot from iso.
    KERNEL memdisk
    APPEND initrd=slitaz-cooking.iso

LABEL mini_ubutnu
    MENU LABEL Mini-Ubuntu
    KERNEL memdisk
    APPEND initrd=ubuntu_mini.iso

LABEL freedos_std
Testing boot from Floppy IMG.
    KERNEL memdisk
    APPEND initrd=FDSTD.144

LABEL anax_bios_flash
    MENU LABEL Anax Bios Flash
    KERNEL memdisk
    APPEND initrd=anax_bios_flash.img

LABEL openbsd
    MENU LABEL ^OpenBSD 3.9
    KERNEL openbsd_3.9/pxeboot.0

LABEL plop_4.0.0
    MENU LABEL PlopLinux 4.0.0
    KERNEL ploplinux_4.0.0/bzimage
    APPEND initrd=ploplinux_4.0.0/initrfs.gz vga=1 nfsmount=

LABEL ubuntu_10.04_install
        menu label ^Ubuntu 10.04 net install
        kernel ubuntu_10.04/vmlinuz
        append vga=normal initrd=ubuntu_10.04/initrd.gz -- quiet

LABEL ubuntu_10.04_cli
        menu label Ubuntu 10.04 ^command-line net install
        kernel ubuntu_10.04/vmlinuz
        append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=normal initrd=ubuntu_10.04/initrd.gz -- quiet

LABEL pxeserver2
        menu label Switch to 2nd PXE server...
        kernel pxechain.com

Reference: AskUbuntu: Pxeboot Multiple image

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.