PXE boot CentOS 7.2 diskless fails with "Failed to start Switch Root"
Solution 1
I returned to this issue after many months and I found out what I was missing - an active firewall. It appears the PXE/TFTP BOOT functions are able to transfer the vmlinuz and initrd images just fine without the firewall rules running, but when it came time to NFS transfer the root filesystem to the client, it could not.
In Red Hat 7.3 I first copied the /etc/sysconfig/iptables file from my CentOS 6.6 server (from which the client could boot and mount the "diskless" filesystem) and then executed:
systemctl enable firewalld
systemctl start firewalld
The client now successfully mounted the remote filesystem and came up to the Linux login prompt.
Now to figure out which parts of that iptables file I really need in this instance.
Solution 2
You still working through this? I was having the same problem with RHEL/Centos 7.x. Never had this issue on 5.x or 6.x. I tried both legacy and UEFI mode with the same result.
I found the problem in my process. Two things actually.
I neglected to clean up /etc/sysconfig/network-scripts in my rsync'd filesystem. It still contained scripts from the source filesystem.
We have multiple NICs on our diskless clients. We were missing certain boot parameters in the network boot configs, like so:
APPEND initrd=images/centos/x86_64/7.2/diskless_initrd.img ip=bond1:dhcp root=nfs:10.0.0.1:/diskless/centos/7.2/root bond=bond1:eth4,eth5:mode=1 biosdevname=0 net.ifnames=0 rw quiet
In your case you might not be using bonded network devices, but you may still need to specify the device name of the NIC that your diskless client obtains the filesystem on, like so...
APPEND initrd=images/centos/x86_64/7.2/diskless_initrd.img ip=eth3:dhcp root=nfs:10.0.0.1:/diskless/centos/7.2/root biosdevname=0 net.ifnames=0 rw quiet
Related videos on Youtube
John Hupcey
Updated on September 18, 2022Comments
-
John Hupcey over 1 year
I am setting up a CentOS 7.2 server so clients can boot a diskless CentOS 7.2 image. I have done this with CentOS 6.6 and it works fine over multiple servers and clients over many years. Using the same configuration parameters.
/var/lib/tftpboot/pxelinux.cfg/default contains:default menu.c32 prompt 0 timeout 100 TOTALTIMEOUT 300 ONTIMEOUT CentOS MENU TITLE Linux 7.2 PXE Boot Menu LABEL CentOS MENU LABEL CentOS 7.2 x86_64 em1 KERNEL images/centos/x86_64/7.2/vmlinuz-3.10.0-327.el7.x86_64 APPEND initrd=images/centos/x86_64/7.2/diskless_initrd.img ip=dhcp nfs=10.0.0.1:/diskless/centos/7.2/root rw quiet
When PXE booting the client it gets quite far, but stops at: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
This drops me into the emergency shell, and if I look at /sysroot it is an empty directory!
I saved the diskless_initrd.img using
dracut -f diskless_initrd.img `uname -r`
and copying it to the specified location. I also tried "dracut -d nfs -d network" which some suggested.
I don't understand why this works with my CentOS 6.6 server but not here in 7.2.