How to properly use UEFI, PXE, root=live: boot option?

General support questions
Post Reply
SamuelCardwell
Posts: 6
Joined: 2016/04/07 18:57:12

How to properly use UEFI, PXE, root=live: boot option?

Post by SamuelCardwell » 2017/05/26 16:12:44

I'm aiming to establish a properly done UEFI PXE diskless boot system that works from a LiveOS squashfs or rootfs.img (ext4 built) that establishes its root operation in ram for the diskless clients. So far I CANNOT seem to find the right examples/methods to make this latter happen!

My working starting point is a UEFI PXE diskless arrangement that works via NFS4 mount, but all the diskless clients effectively SHARE the same NFS mount point, so occationally one or the other steps on something during shutdown (mostly) or startup such that they are not reliable.
The grub entry in the tftp root directory has a menu option that looks like this:

Code: Select all

  menuentry 'Diskless CentOS7' {
    linuxefi export/uefi/vmlinuz ip=dhcp root=nfs4:192.168.1.10:/ExternalMounts/CentOs7ServerWithGUI rd.nfs.domain=mydisklessdomain.local rw selinux=0 console=tty0 console=ttyS0,115200n8
    initrdefi export/uefi/disklessRamfs.img
  }
I have a DHCP server setup which uses the shim.efi boot manager line:

Code: Select all

            filename "/export/uefi/shim.efi";
I used "dracut -N -f /boot/disklessRamfs.img 3.10.0-514.el7.x86_64" to produce the initrd image shown above.
I checked the modules to see that I wasnt hitting the problem I saw on viewtopic.php?t=46542 that matched what I'm seeing most often "been "FATAL: Don't know how to handle 'root=live ":

Code: Select all

[root@gp0 ~]# dracut --list-modules /export/uefi/LiveDisklessRamfs.img | grep livenet
livenet
[root@gp0 ~]# dracut --list-modules /export/uefi/LiveDisklessRamfs.img | grep squash
dmsquash-live

So following the best reference I think I've found so far (https://bugzilla.redhat.com/show_bug.cgi?id=1154670), I think the following SHOULD work in grub.cfg but ISN'T :

Code: Select all

    linuxefi export/uefi/vmlinuz ip=dhcp root=tftp://192.168.1.10/ExternalMounts/CommonOSandApps/LiveOS/squashfs.img quiet selinux=0 console=tty0 console=ttyS0,115200n8
    initrdefi export/uefi/LiveDisklessRamfs.img
Where I generated an ext4 rootfs.img file that contains the previously NFS4 working content, within the squashfs image above (having the LiveOS folder structure from the noted post above).

Here I also regenerated the LiveDisklessRamfs.img as before, but I also pointed it at the previous content fstab using --tmpdir option that with the addition of a line for / as tmpfs:
none / tmpfs defaults 0 0

with this or the prior initrd image both fail.


If ANYONE has gotten this to work, what are the right parameters in grub, possible different boot loader (other than shim?), or possible steps I've missed?

Has anyone found decent documentation with examples on how to get a network boot in UEFI with the root=live: noted options to work. I've tried the above with tftp, http, etc. but nogo even though the file is tested downloadable from the URL via browser.

Sam C.

SamuelCardwell
Posts: 6
Joined: 2016/04/07 18:57:12

Re: How to properly use UEFI, PXE, root=live: boot option?

Post by SamuelCardwell » 2017/06/05 14:48:22

I intend to make a more full post later on, but I DID get what I think is a resolution.

I think the element that was NOT working DID turn out to be the initramfs (in my example posted thus far "LiveDisklessRamfs.img"

The following line was used to regenerate the image that then DID support the root=live:... option

Code: Select all

 dracut -N --nomdadmconf --nolvmconf --xz --add-fstab /tinkeredOSStructure/etc/fstab --tmpdir /mytmpspace --logfile /mytempspace/MakeInitRamfs.log --force-add "nfs network base dmsquash-live livenet kernel-modules uefi-lib rootfs-block" /mytmpspace/LiveDisklessRamfs.img 3.10.0-327.36.3.el7.x86_64
Though lsinitrd on my prior initrd images showed dmsquash-live and livenet, I think using the --force-add option with dmsquash-live, livenet, and the others above including uefi-lib and rootfs-block above may have done the trick to ensure thinks were really there. I was able to use the regenerated LiveDisklessRamfs.img in both UEFI and legacy BIOS style PXE boots to get my rootfs.img within a squashfs imag operating in their own ram tmpfs root mount for my diskless clients.

again, more to post later that may help others, but to get it captured for now.

LetsAutomateIt
Posts: 1
Joined: 2020/02/21 05:40:22

Re: How to properly use UEFI, PXE, root=live: boot option?

Post by LetsAutomateIt » 2020/02/23 01:07:25

I spent a week looking for an answer trying to get uEFI PXE working. Finally found this thread. I didn't see a walk through so I figured I'll add my own to this.

I had figure out how to PXE boot using UEFI on a Dell PowerEdge R740xd. I pulled down Dell's support disc for this server model to make my life easier, it already had the network drivers I needed and it is CentOS 7 based.

From the support disc I ran the dracut command to create the initrd image and moved the image to my VM handling the PXE/HTTP/DHCP.

Creating the initrd0.img

Code: Select all

dracut -N --nomdadmconf --nolvmconf --xz -d "i40e igb" --filesystems "ext4" --force-add "nfs network base dnsquash-live livenet kernel-modules uefi-lib rootfs-block" initrd0.img
You'll need to replace the "i40e igb" with your own network drivers.

On my VM I had already setup DHCP, TFTP, and HTTP services. Disabled any possible roadblocks (SELinux, Firewall) while testing.

I used the vmlinuz0 from my livecd, extracted the livecd iso contents to

Code: Select all

/var/www/html/centos
and ensured that there would be no permission issues using

Code: Select all

chmod 777 /var/www/html/centos
I came across issues just mounting the iso to the directory in case you're thinking of doing that.

My TFTP directory consists of isolinux and uefi directories.

isolinux directory contents:
  • initrd0.img <-- This is our newly created initrd image
  • vmlinuz0 <-- From our livecd iso
uefi directory contents:
  • grub.cfg <-- Something you'll create, the output is below for mine.
  • bootx64.efi <-- Copied from the livecd (../centos/EFI/BOOT/BOOTX64.efi)
Here is my grub.cfg

Code: Select all

set default=0

set timeout=30

echo -e "\n Top Menu TItle\n\n"

menuentry 'LiveOS Environment' --class centos --class gnu-linux --class gnu --class os{
	linuxefi /isolinuix/vmlinuz0 ro ip=dhcp inst.repo=http://192.168.48.1/centos root=live://192.168.48.1/centos/LiveOS/squashfs.img rd.driver.pre=loaop rd.writable.fsimg=1 rd.neednet=1
	initrdefi /isolinux/initrd0.img
}

Here is my dhcpd.conf

Code: Select all

option space PXE;
option PXE.mtftp-ip		code 1 = ip-address;
option PXE.mtftp-cport	code 2 = unsigned integer 16;
option PXE.mtftp-sport	code 3 = unsigned integer 16;
option PXE.mtftp-tmout	code 4 = unsigned integer 8;
option PXE.mtftp-delay	code 5 = unsigned integer 8;
option arch code 93 = unsigned integer 16; # RFC4578

subnet 192.168.48.0 netmask 255.255.252.0 {
	option routers 1921.68.48.1; # This is the IP address for my VM
	range 192.168.48.10 192.168.51.254;
		class "pxeclient" {
			match if substring (option vendor-class-identifiers, 0, 9) = "PXEClient";
			next-server 192.168.48.1;
			
			if option arch = 00:07 {
				filename "uefi/bootx64.efi";
			} else if option arch = 00:08 {
				filename "uefi/bootx64.efi";
			} else if option arch = 00:09 {
				filename "uefi/bootx64.efi";
			} else {
				# PXE boot
				filename "pxelinux.0; # This file doesn't exist in my setup
			}
		}
}
Looking at the dhcp.conf there is some clean up that'll be needed, but this is a working uefi pxe boot and to me that's want matters.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to properly use UEFI, PXE, root=live: boot option?

Post by TrevorH » 2020/02/23 13:57:23

We don't usually allow posting to 3 year old threads but since this one actually supplies useful information...
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply