0

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.

0

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.

| improve this answer | |
  • thanks for the response Michael can you explain the root=/dev/nfs part, I haven't seen that in any of the documentation before even for setting up an nfs diskless system. a better understanding would help me out. I edited my file to the format you supplied but to no avail – MacLCM Jul 30 at 20:25
  • I tested whether I could reach the server from the client while running the centos system installed on its hardrive by running from only eth nic on client to the pxe servers nic and was able to reach it and all the files on the pxe server from the pxe ip address, so I do not think it is inaccessible just looking in the wrong place – MacLCM Jul 30 at 20:26
  • That's how it's specified in the official kernel docs as well as every tutorial I could find on the first page of Google. The docs say: "This is necessary to enable the pseudo-NFS-device. Note that it's not a real device but just a synonym to tell the kernel to use NFS instead of a real device." – Michael Hampton Jul 30 at 20:27
  • If you're able to reach the dracut emergency shell you should gather all the information that it saved for you. Something in there may have a clue. – Michael Hampton Jul 30 at 20:28
  • well that fail switch root section in the original post was what was from the error file it, interestingly I screwed with the path to the root tree and it failed in exactly the same spot with same errors. I have verified that the path is correct so I am thinking it is just not looking or I mean it is not reading the path from my pxe.cfg default file and is instead looking for it or just not I don't no. – MacLCM Jul 31 at 13:36
0

Ok for others out there her was the primary issue with my set up as well as some other insight gained from dealing with centos 8 and 7. the failed switch root was due to no ip address from the target, which it had from the original dhcpd from the server when it started the pxe menu. this was because I was using the initramfs.img file instead of the initrd.img file and the vmlinuz file from my cloned system instead of the vmlinuz and initrd.img files from the pxeboot directory on the dvd.iso installation files. This initrd file found and established the nic with the dhcp option specified in the pxe.cfg default file. also I know this may be obvious to more seasoned out there but I saw many different append lines in many different examples. for newer users this leaves us in the dark, so below were my discoveries

#append for an install of centos 7 or 8  
append initrd=/path/to/initrd/file/initrd.img ip=dhcp inst.repo=nfs:/sharedfilepath/ biosdevname=0 net.ifnames=0 rw 

#notes: initrd path is relative to the file you pointed to in the dhcpd.conf file so it #could be tftpboot or a sub directory like centos8/pxelinux.0 in my case etc..
#inst.repo is an installation option if you are trying to boot an already configured system
#like I was then this is wrong you need to simple set the root argument like below

append initrd.img ip=dhcp root=nfs:servername(or ip):/path/to/root/of/image/ rw net.ifnames=0 biosdevname=0

#also if you are going to a headless setup you will need to include the serial console and #baud rate in the append
append initrd.img root=nfs:serverip:/path/to/image ro net.. bios.. console=ttys0,115200

| improve this answer | |

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.