# FreeBSD 9.0 diskless nfs root in rw mode



## ro (Dec 19, 2012)

Hi all.

I'm trying to mount nfs root in rw mode, but have messages like:

```
Trying to mount root from nfs:192.168.4.122:/shares/nfs/freebsd [rw]...
mountroot: waiting for device  nfs:192.168.4.122:/shares/nfs/freebsd ...
Mounting from nfs:192.168.4.122:/shares/nfs/freebsd failed with error 19.
Trying to mount root from nfs: []...
NFS ROOT: 192.168.4.122:/shares/nfs/freebsd
...
mount_nfs: can't update /var/db/mounttab for 192.168.4.122:/shares/nfs/freebsd
eval:  cannot create /etc/hostid: Permission denied
/etc/rc: WARNING: could not store hostuuid in /etc/hostid
...
```

NFS in 192.168.4.122:

```
root@su-desktop:/ # showmount -e 192.168.4.122 | grep freebsd
/shares/nfs/freebsd
root@su-desktop:/ #
```
And I can mount it in rw mode from my desktop:

```
root@su-desktop:/ # mount.nfs 192.168.4.122:/shares/nfs/freebsd /mnt
root@su-desktop:/ # mount | grep nfs
192.168.4.122:/shares/nfs/freebsd on /mnt type nfs (rw,addr=192.168.4.122)
root@su-desktop:/ #
```

Diskless FreeBSD 9.0 amd64. Kernel config:

```
ident           DISKLESS

options         BOOTP
options         BOOTP_NFSROOT
options         BOOTP_COMPAT

include         GENERIC
```

loader.conf on diskless:

```
vfs.root.mountfrom="nfs:192.168.4.122:/shares/nfs/freebsd"
vfs.root.mountfrom.options=rw
```

diskless fstab:

```
192.168.4.122:/shares/nfs/freebsd     /       nfs     rw      0       0
proc                                  /proc   procfs  rw      0       0
```

Is it possible to mount nfs root in rw mode?
10x


----------



## mlsemon (Dec 20, 2012)

ro said:
			
		

> Is it possible to mount nfs root in rw mode?



Yes.  Now I hope that the real experts will come along and help you.

Might you post the line from /etc/exports that actually exports the NFS share to the client?  Also, any NFS-related variables from /etc/rc.conf on both PCs, such as nfs_client_enable="YES", would be useful.

I use PXE to boot a truly diskless PC over NFS, with help from DHCP and TFTPD on the server.  I got (and still get) the error 19 on boot.  However, the client seems to try again and boot with success.

My novice advice:

1) Try -maproot=0 in your export to the client, even if only for testing.  My setup boots to a separate FreeBSD install from the server, so I don't worry too much.  YMMV.

2) statd and lockd may need to run on both client and server.

3) The earlier in the boot process that statd and lockd start, the fewer permissions errors you will get.  The errors are odd, and I can't do so much as change my password from the client until these two services are running.  I set early_late_divider="mountcritremote" in rc.conf on the client, but I had to tinker quite a bit with the REQUIRE lines in my client's rc scripts to get everything to kick over correctly.  My method was something like this:


```
cd /etc/rc.d
# Here I edit REQUIRE line in whatever script I think will help.
rcorder *
```

If rcorder found circular dependencies, I either edited another rc script or backed out of the last change I made.  At this point, I think that statd and lockd start after syslog but before nearly everything else.  It's not ideal, but it works really well.

4) My client boots into a clean system that was made by following the directions "Setting up a Jail Directory Tree" from the jail(8) man page.  This meant touching a file here and there, creating new files, and making sure that permissions were okay from place to place.

This took me a while to get it right, mostly because I leaned on the directions in jail(8) when the directions from diskless(8) made me cringe a little bit, and they're different instructions for different tasks.  Errors were made.  However, the results were surprisingly pleasant and painless.

Anyway, I hope one of the real NFS experts comes along with the correct answer here.  Good luck!


----------

