10

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?

2
  • 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?
    – Dylan
    Mar 18, 2015 at 2:48
  • 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). Mar 18, 2015 at 12:56

3 Answers 3

16

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.

5
  • 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)? Aug 10, 2015 at 14:36
  • 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 . Aug 10, 2015 at 23:37
  • 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. Aug 10, 2015 at 23:37
  • 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" ;-) Aug 11, 2015 at 7:30
  • It is all right, Alex. The extension of an answer is rather a matter of points of view. Aug 11, 2015 at 9:58
0

For recent versiones of iPXE efi chainloading is possible. In the ipxe.iso is an image (esp.imp) which contains the needed efi structure. You can copy the BOOTX64.EFI file to a different place in your EFI partition and chainload it with grub.

New contributor
user526214 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
-2

Generally, I have found the PXE boot option only exists on a system BIOS boot selection menu. Once you get into grub it is basically too late.

On Dell machines, it looks to be possible to program this action remotely (and programatically) depending on the hardware you have installed. Especially using the Dell iDRAC. This capability might be possible on other vendor hardware as well.

1
  • 4
    This answer has proven wrong. Should be removed. Nov 21, 2016 at 15:47

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.