0

The title is the intro: I realy need some linux experts on this one, this is not an obvious one or at least to me its not. I have a pretty good idea of how to do this and have done so before but this time around I am missing something. in this case my pxe image's fail to boot with a failed to switch root.

What I have done to create the current images I have tried:

  1. Installed and setup a linux redhat version 7 on target hardware.

  2. created a custom initramfs with "nfs" and "network" modules included (so this image boots and works from the on board hardrive.

  3. used rsync cmd to copy over the root file system and then put my custom initramfs and the matching kernel in the tftpboot server for pxe.

  4. Cleared the fstab file and commented out the uuid of the harddrive and tried both(fstab empty or fstab with root mounted on nfs)

  5. changed the permissons on the initramfs and vmlinuz

  6. setup an nfs server service and put the root file system as exportable with no_root_squash and rw

issues I'm having: The image will pxe over and run the vmlinuz and then the initramfs but fails once it gets to the switch root service. It drops me in a dracut shell after a time and I looked at the dracut report /run/initramfs/rdsosreport.txt and one line had the following

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 

I have looked and the os-release file is there and is the same as the one on the working image on the target hardware's hardrive(which successfully boots every time).

the root files system is there and pointed to apropriatley via the correct absolute path and here is my pxelinux.cfg default line for it

root=nfs:192.9.600.5:/correct/path/to/rootfilesystem  

also when this line was wrong or incorrect in the past I would get a dracut fatal error with dracut does not know how to handle root=nfs... etc or if the rootfilesystem was not available because of wrong path or permissions it would spit out a inadequate permissions error.

I also have noticed that I lose connectivity with the pxe server during the switch root which is maybe why it is failing since the root is over nfs, but it has the nfs and network modules other wise the initramfs would fail before switch-root.service ? so I am left puzzled why I loose connection at this point. Especially since the image the pxe image was created from does have nfs up and enabled for on boot .

I have researched this to no avail if someone can point out what I am doing wrong or help me discover the source of the issue I would be tremendously grateful.

0

It can be a lockup on NFS versions. First of all manual recommends using root=nfs:server-ip:/exported/root/directory,vers=4.2 as a boot option. You can also mount /root in /mnt from working system to check:

  1. If it is mounted properly
  2. cat /proc/mounts to check NFS version in default mount
  3. lsmod can show what actual modules were used

NFS is quite tricky, because NFSv4 has many derivatives and incompatibilities, and NFSv3 demand to have RPC daemons working around, sometimes this is a mess. Running some diskless clients I can say that modules in initramfs can behave much different than in main system.

You can also try to mount NFS from dracut and give us results. tcpdump'ing client traffic also can help to see if something happen at all.

I will also try to boot modern EL7 tonight to see if there are some other caveats.

2
  • I will try what you have suggested and post results except for the mounting nfs from dracut? I don't think this will be possible as I loose all network access during the switch root(maybe not suppose to, but I do. I cannot even ping the pxe server that served up the vmlinuz and initramfs from the dracut shell) which I thing is the main reason I cannot mount the root path. I will try to mount the nfs from the running system though to see if nfs is working on both systems. I did have to install rpcbind to get nfs-utils to install after some version conflicts so I will look into that as well thx – MacLCM Apr 27 at 23:15
  • Not sure but likely you have to have network running in dracut, otherwise you have not nfs but network problems here. – kab00m Apr 28 at 22:02

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.