pxe boot "mounting root filesystem rw failed"

Beeblebrox

Aspiring Daemon

Reaction score: 151
Messages: 985

I have been trying to set up diskless booting but had some problems. To simplify everything, a copy of FreebSD on an old HDD formatted as ufs. No problems so far and
Code:
# showmount -e
/	192.168.2.0
I boot the diskless client and everything seems to go fine until just before the mountroot operation diskless client shows:
Code:
fxp0: link state changed to DOWN
For some reason the boot process shuts down the NIC and of course, nfs cannot be mounted as root. The loader.conf for diskless client is:
Code:
nfscl_load=yes
vfs.root.mountfrom="nfs:192.168.2.1:/"
if_fxp_load="YES"
ipv6_load="NO"
Host error message shows:
Code:
tftpd: got ERROR packet TFTP aborted
tftpd: Filename '/boot/pxeboot'
tftpd: Mode: octet
tftpd: 192.168.2.7: read request for /boot/pxeboot: success
....
tftpd: Timeout #5 send ACK 31 giving up
My questions about this:
1. I have a trimmed-down kernel so the most logical thing I have come up with is that I have not loaded a module that is needed by tftpd/nfsd?
2. How can you customise loader.conf for each diskless client? Surrently as I have only one cleint, I manually re-name the conf I want booted as loader.conf!

Progress on Q1: I copied a generic kernel from CD to the HDD and made the diskless client boot the generic kernel. It had some minor problems but it was able to mount root from nfs (drops to single user but df shows mounted)
 
OP
Beeblebrox

Beeblebrox

Aspiring Daemon

Reaction score: 151
Messages: 985

For Q1 (no nfs devices) here is the solution: NFS_ROOT MUST be enabled in your kernel.config. Without it MOUNT NFS fails. NFSCLIENT does not need to be in kernel, it can be loaded as module.
Code:
options 	NFS_ROOT		# NFS usable as /, requires NFSCLIENT
loader.conf for the client looks like:
Code:
1. if_fxp_load="YES"
2. nfscl_load=yes
3. boot.nfsroot.server="192.168.2.1"
4. boot.nfsroot.path="/usr/jails/pxeboot"
5. #vfs.root.mountfrom="nfs"
6. vfs.root.mountfrom="nfs:192.168.2.1/usr/jails/pxeboot"
7. vfs.root.mountfrom.options="ro"
Not all successful though, boot process stops with: "cannot mount root as rw" and drops to single-user mode. Also line 6 should normally not be necessary and line 5 should suffice, but it does not - kernel panics and shuts down when 5 is enabled, so I have to keep 6 for now. I was hoping lines 7 & 8 would allow for ro mounting but don't. I assume the problem is with missing r/w mount for /var & /tmp (/var/tmp) which I have not prepared yet.

EDIT: According to documentation, nfs root should mount regardless of other settings. I'm getting the same error as here: http://forums.freebsd.org/showpost.php?p=161524&postcount=18
 
OP
Beeblebrox

Beeblebrox

Aspiring Daemon

Reaction score: 151
Messages: 985

OK, did a really UGLY hack: modified diskless/etc/rc.d/root and commented out
Code:
stop_boot true
so that system would go on booting. Then I understood why nfs does not mount because I got better error output:
Code:
setting hostuuid: <some numbers>
setting hostid: <some numbers>
.......
mount_nfs: no <host>:<dirpath> nfs-name
Mounting root filesystem rw failed, startup aborted
eval: cannot create etc-hostid: read-ony file system
/etc/rc: WARNING: could not set hostuuid in /etc/hostid
Client then boots into system as "expected" (barring errors). Interesting that # df shows for /var mounted on /dev/md0 without prior specs.

EDIT: All these posts and no one would tell me the solution: in jail/etc/rc.conf, place
Code:
root_rw_mount="NO"
(Thanks to Martin Simmons)
 
Top