Is it possible to add some 'PXE Network Boot' option to GRUB?

18,606

Yes, you can add a (i)PXE Launcher to Grub.

For dpkg-based systems like Debian&derivatives: Only apt-get install ipxe is required

I would expect other distros to have integrated it as well fairly comfortably.

==> A "PXE Boot" menu entry will exist on next reboot.

In case you want to know inner-working-details:

The post-install hook scripts automatically adds an iPXE entry to the grub configuration, using the "template" file /etc/grub.d/20_ipxe.

You end up with an entry like the following in /boot/grub/grub.cfg

menuentry 'Linux NetBoot Environment' {
  set root='(hd0,1)'
  <More, less important options>
  linux16 /boot/ipxe.lkrn
}

This just means, that instead of a (linux-)kernel, grub gives full computer control to another "simple" program, in this case ipxe.lkrn. MemTestx86 is launched in basically the same way.

The PXE Stack is software normally stored somewhere on the main-board. Just in this case we load it from somewhere the drivers from GRUB can access.

Example of a usage scenario:

You will want to install a basic GRUB on the drive, having the PXE entry first, and a fall-back on Position 2 to local chain-boot from (say) Partition 1.

The configuration iPXE would use will then depend on the files residing on your boot-configuration-server. There you will make the default, first menuchoice "Boot from local Partition 1", then more choices (Boot-AV, SuperGrub, Debian NetInst...).

==> Your Users normally don't touch anything until they see the Graphical Login Prompt from the local Installation.

Boot-Sequence: GRUB - iPXE - OS-in-Partition-1 (Fallback to OS-In-Partition-1, if PXE unsuccessful)

==> Physically present at the PC, you could choose other Boot-Options.

==> Not physically present at the PC, you can change the server-side PXE configuration to "one-off" boot another choice than the default.

Share:
18,606

Related videos on Youtube

Arlene Mariano
Author by

Arlene Mariano

Updated on September 18, 2022

Comments

  • Arlene Mariano
    Arlene Mariano over 1 year

    This is an example of my available GRUB menu boot options:

     1     menu label   ^  1) Xubuntu 14.04.02 LTS
     2     menu label   ^  2) Windows 7, x86 & AMD64
     3     menu label   ^  3) Windows 8, AMD64
     4     menu label   ^  4) Hirens Boot CD 8.8, x86
     5     menu label   ^  5) Kali 1.0.7 Live, amd64
    

    In order to repair/reconfigure/rescue servers or machines without keyboard&screen, it would be very useful to be capable of booting remote machines to PXE Network without needing to physically go near the computer to select the PXE option in the BIOS.

    Adding a PXE Network Boot option to GRUB would be fantastic. Something like:

     1     menu label   ^  1) Xubuntu 14.04.02 LTS - Sopalajo Mod, amd64
     2     menu label   ^  2) Windows 7, x86 & AMD64
     3     menu label   ^  3) Windows 8, AMD64
     4     menu label   ^  4) Hirens Boot CD 8.8, x86
     5     menu label   ^  5) Kali 1.0.7 Live, amd64
     6     menu label   ^  6) PXE Network server on this LAN
    

    I am patching the problem for now by selecting PXE as the first boot option in the BIOS, but I don't always want PXE as the first boot option.
    As long as GRUB includes some really useful programs like grub-reboot or, at least, accepts remote reconfiguration, adding PXE to GRUB could be a perfect solution.

    Is it possible to add a PXE option to the GRUB boot menu?

    • Jacob Matias
      Jacob Matias about 9 years
      I could be way off base here but wouldn't you set that in the BIOS boot order? So set PXE as boot option one and if there is no server found it would resume with the normal boot option and boot into grub?
    • Arlene Mariano
      Arlene Mariano about 9 years
      Yep, @Dylan, that is my workaround. But it is not valid if you have multiple computer with that BIOS config rebooting in a not predictable manner in the LAN (i.e: installing Windows 7 on computer A, B and C at the same time).
  • Arlene Mariano
    Arlene Mariano almost 9 years
    This sound interesting, Alex. But adding menu entries to GRUB is rather awkward since v2. Could you please detail the method (file/s to modify, lines to add... etc)?
  • Arlene Mariano
    Arlene Mariano over 8 years
    Awesome, : just installing the ipxe package, and there is a new menu on my GRUB options. But I think I requested you an expanding that was not neccesary, so your answer is too long for a question-answer site. Allow me to suggest you some more wiki-like rewording like this one: pastebin.com/UgCqh8F8 .
  • Arlene Mariano
    Arlene Mariano over 8 years
    As an example of what I think are concise-yet-complete answers: unix.stackexchange.com/a/222065/57439 (compare to the other answer/s: they have no need to be soo long). Example for short-possible answer: superuser.com/questions/728810/… . Example for need-to-be-long answer: askubuntu.com/a/49679/109008 (same: compare to the other answers) . And thanks you for your good attitude.
  • Alex Stragies
    Alex Stragies over 8 years
    I've incorporated some of your suggestions, and changed the formatting to indicate the 3 distinct "sections" of the answer. Do this now meet your mark? If not, I can always go back to my first answer text: "Yes, you can. Install ipxe" ;-)
  • Arlene Mariano
    Arlene Mariano over 8 years
    It is all right, Alex. The extension of an answer is rather a matter of points of view.
  • Arlene Mariano
    Arlene Mariano over 7 years
    This answer has proven wrong. Should be removed.