PXE boot Centos 8 fails with "failed initrd-switch-root.service"

MacLCM asked:

I am trying to pxe boot centos 8 as a diskless system however, after the boot fails after loading the kernel and the initrd.img when it tries to hand over control to the root file structure. I get the following error

Starting Switch Root...
Failed to switch root: Specified switch root path /sysroot does not seem to be an OS tree. os-release file is missing.
initrd-switch-root.service: main process exited, code=exited, status=1/FAILURE

now I have seen other post about this but all save one have been about how to fix it on a single machine not pxe booting, except one which I could not comment on or add to because of reputation points or lack there of. however I do not believe that thread was adequate, I will list my configuration at the bottum if someone can point to a possible error there but mainly,

I assume the /sysroot path is invalid because it may be looking for a path on the original system that was cloned, so How can I edit or change the path the initrd.img file is looking for ?

or is this simple a pxe server issue where my directory listed in the pxelinux.cfg/default file is not reachable via nfs by the client. on that note though it is on the etc/export list and firewall allows tftp and nfs through.

pxelinux.cfg/default

default menu.c32
prompt 0 
timeout 10
ONTIMEOUT local

menu title ########PXE BOOT MENU #############

lable 1
menu label ^1) Install cnetos 8 
kernel root/boot/vmlinuz-4.18.0-193.e18.x86_64
append initrd=root/boot/initramfs-4.18.0-193.e18.x86_64.img root=nfs:192.10.100.10:/var/lib/tftpboot/root/ ip=dhcp ro net.ifnames=0 biosdevname=0

also I used rsync to flash a usb with a working system and then moved the contents to the tftpboot directory on the pxe server. that system is still up and running so I believe the contents in the root directory are fine I just cant get the pxe client to see and mount it. help would be very much appreciated.

My answer:


The normal way to do an NFS root filesystem is:

root=/dev/nfs nfsroot=192.10.100.10:/var/lib/tftpboot/root rw

I’m not sure if the syntax you used is even supported at all.

Also, whether it’s read-only or read-write is dependent on the distribution; all distributions require special setup for a read only root NFS filesystem, if they support it at all. You should probably start out read-write until you have everything else up and running.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.