PXE-Booting a Modern Ubuntu live CD via UEFI mode
-
Background
I have a need to live-boot a linux distribution over PXE/FOG for testing hardware purposes. So far I’ve got my FOG server setup, and merrily using WinPE and deploying linux and other images when I need to. So far so good (e.g. i’ve figured out the basics).
However, when I went to the best instructions/tutorial I could find around PXE-booting linux distros (here), it seems it’s a bit dated and does not really support EFI except for WinPE, ESX and an old version of Ubuntu (17.10) that’s too old for my needs.
Unfortunately, for technical reasons I MUST use EFI here over PXE boot as the BIOS has disabled legacy boot on these machines.
What I’d like to do:
Because I know the current Ubuntu distributions (either 18.04 or 19.10, or 20+ if you want to be adventurous ) work in terms of booting from EFI from a live-CD, I’d like use those as a template and then use my own squashfs’d root file systems to do what I need to do.Can someone (maybe @george1421 ?) tell me what the magic incantations are for the entries in the FOG web GUI ?
Ideally, perhaps they could even update the tutorial linked above with the instructions so everyone can find it in the same place?
-
To clarify… I am looking to do this via the iPXE menu options and not turn the setup into a netboot-only server. I simply want to boot a linux live CD in EFI mode when the option is selected, run a script, and then stop. I’m not super-skilled in the dark arts of BIOS/UEFI and it’s possible i’m confused here. Is it the case that once iPXE is loaded I can chain load a system setup to boot legacy and don’t need to be trying to use grubx64.efi, as shown here: https://forums.fogproject.org/topic/11194/poc-using-fog-as-a-netboot-server ?
P.S. it’s not super-important to support secureboot/signed boot in this particular case, but I wouldnt mind if that happened to fall out.
-
@alesser Those instructions will/should work for both bios and uefi systems. The only one that won’t work is the one where you load the iso directly with memtest which is bios only.
For the unbuntu distro it list 16.04 but the concepts can be applied to 18.04. The transfer of both the kernel and virtual hard drive (initrd) to the target computer is done by iPXE, but once that kernel is launched its in control of the hardware so uefi/bios compatibility is up to the kernel not fog.
-
@alesser said in PXE-Booting a Modern Ubuntu live CD via UEFI mode:
I simply want to boot a linux live CD in EFI mode when the option is selected, run a script, and then stop.
Reading between the lines here, I wonder if another approach would be better/faster/greener?
Let me tell you a bit how fog images computers. The iPXE menu in conjunction with the boot.php program send 2 files to the target computer with some kernel parameters that tell the target computer what to do. Those two files are bzImage (the kernel) and init.xz (virtual hard drive a.k.a initrd). Those two files make up the os known as FOS (Fog Operating System). FOG uses buildroot to construct the initrd as well as compiles bzImage.
So one might wonder, do you need a full commercial OS run your script or just a linux OS? Do you need a persistent disk storage or once the script runs can the virtual machine just disappear?
So the grey beard hacker in me wonders if you could take FOS Linux delivered by the FOG server to do your bidding? Unless you are doing something crazy (like vlans, wireless, packet filtering) FOG’s bzImage should do what you need. It supports both uefi and bios modes, as well as init.xz. FOG supplies both a 64 bit and 32 bit version of FOS Linux.
So how do you hack init.xz to not image your target computer? Simply unpack the inits https://wiki.fogproject.org/wiki/index.php/Modifying_the_Init_Image Once you unpack the inits then look in the
/etc/init.d
directory forS99fog
and delete it. Repack the inits and then pxe boot the computer again. Now you have a command line linux OS to play with that boots in under 15 seconds and disappears when powered off. The entire OS fits into 512MB of RAM, so its very VM friendly. If you need persistence memory just map an NFS share and grab your persistent data from there.You might want to look into the
/etc/init.d/S99fog
file a bit deeper since you want to run a script theS99fog
to do your task. https://github.com/FOGProject/fos/blob/master/Buildroot/board/FOG/FOS/rootfs_overlay/etc/init.d/S99fogNow what do you do if FOS Linux doesn’t contain the linux programs you need. Welp, then you need to turn to build root and build your own init.xz (initrd) file. No worries since the FOG Project also provides the buildroot config file and fs overlay you need in the github site. https://github.com/FOGProject/fos/tree/master/Buildroot