# unable to mount root via NFSv4

## srd

I've been setting up a diskless node and though the console output flys too quickly during it's booting to where I am unable to see the error messages, I believe it's unable to mount the root fs via nfs. I think this because functions I see in the stack trace are:

mount_block_root

mount_root

prepare_namespace

kernel_init

The /diskless fs which resides on the master node (like the rest of the file systems on the master node) all reside over LMV2. So I'm wondering if I need to change anything because of this since it appears to not be able to mount root or find the block device correctly.

The /diskless/pxelinux.cfg file:

```

DEFAULT /gentoo-x86_64/boot/kernel-3.14.14-gentoo

APPEND ip=dhcp ro rootfstype=nfs root=/dev/nfs nfsroot=10.0.50.111:/diskless/gentoo-x86_64 init=/linuxrc 

```

The /diskless/gentoo-x86_64/etc/fstab:

```

10.0.50.111:/diskless/gentoo-x86_64 / nfs sync,hard,intr,ro   0 0

10.0.50.111:/opt      /opt        nfs sync,hard,intr,rw   0 0

10.0.50.111:/home     /home       nfs sync,hard,intr,rw   0 0

10.0.50.111:/root     /root       nfs sync,hard,intr,rw   0 0

```

The masters /etc/fstab:

```

/dev/sda1       /boot       vfat        noauto,noatime  0 2

/dev/mapper/vg0-root    /       ext4        noatime     0 1

/dev/mapper/vg0-swap    none        swap        sw      0 0

/dev/mapper/vg0-home    /home       ext4        noatime     0 0

/dev/mapper/vg0-var /var        ext4        noatime     0 0

/dev/mapper/vg0-diskless /diskless  ext4        noatime     0 0

/dev/mapper/vg0-opt /opt        ext4        noatime     0 0

/dev/mapper/vg0-tmp /tmp        ext4        noatime     0 0

/dev/cdrom      /mnt/cdrom  auto        noauto,ro   0 0

/dev/fd0        /mnt/floppy auto        noauto      0 0

```

The masters /etc/exports file:

```

/diskless/gentoo-x86_64 10.0.0.0/16(sync,ro,no_subtree_check,no_root_squash,no_all_squash)

/opt    10.0.0.0/16(sync,rw,no_subtree_check,no_root_squash,no_all_squash)

/home   10.0.0.0/16(sync,rw,no_subtree_check,no_root_squash,no_all_squash)

/root   10.0.0.0/16(sync,rw,no_subtree_check,no_root_squash,no_all_squash)

```

Any help much appreciated.Last edited by srd on Tue Mar 10, 2015 6:55 pm; edited 2 times in total

----------

## krinn

https://forums.gentoo.org/viewtopic-p-7592928.html#7592928

try adding the nfs version info

----------

## srd

I added vers=4 to the pxelinux.cfg/default boot arg, but still no good. Here's a bit more info on what I've done.

While trying to boot diskless nodes, the console output flies by too quickly, but here is the stack trace of what is left.

```

? panic

? panic

mount_block_root

mount_root

prepare_namespace

kernel_init_freeable

? do_early_param

? rest_init

kernel_init

ret_from_fork

? rest_init

```

I am thinking the problem is that it can't open or is unable to open the root file system via NFS. Here's what I've done for NFSv4. NFS client and server (vers 4+) support built into kernels.

pxelinux.cfg/default

```

DEFAULT /gentoo-x86_64/boot/kernel-3.14.14-gentoo

APPEND ip=dhcp ro rootfstype=nfs root=/dev/nfs rootdelay=10 nfsroot=10.0.0.11:/exports/gentoo-x86_64,vers=4,_netdev rootfstype=nfs init=/linuxrc 

```

Virtual root directories on server.

```

mkdir /export

mkdir /export/gentoo-x86_64

mkdir /export/home

mkdir /export/opt

mkdir /export/root

```

Server /etc/fstab, added the following:

```

/home           /export/home    none        bind        0 0

/root           /export/root    none        bind        0 0

/opt            /export/opt none        bind        0 0

/diskless/gentoo-x86_64 /export/gentoo-x86_64 none  bind        0 0

```

Client /etc/fstab, added the following:

```

10.0.0.11:/diskless/gentoo-x86_64 /     nfs     rw,_netdev,auto         0 0

10.0.0.11:/opt          /opt            nfs     rw,_netdev,auto         0 0

10.0.0.11:/home         /home           nfs     rw,_netdev,auto         0 0

10.0.0.11:/root         /root           nfs     rw,_netdev,auto         0 0

```

Server /etc/exports

```

/export            10.0.0.0/16(rw,fsid=0,no_subtree_check)

/export/gentoo-x86_64   10.0.0.0/16(ro,no_subtree_check)

/export/opt        10.0.0.0/16(rw,nohide,insecure,no_subtree_check)

/export/home           10.0.0.0/16(rw,nohide,insecure,no_subtree_check)

/export/root           10.0.0.0/16(rw,nohide,insecure,no_subtree_check)

```

Server /etc/conf.d/nfs, edited the following line:

```

OPTS_RPC_NFSD="100 -V 4.2 -V 4.1 -V 4 -N 3 -N 2"

```

Server showmount command

```

$ sudo showmount -e myhost

Export list for myhost:

/export/root          10.0.0.0/16

/export/home          10.0.0.0/16

/export/opt           10.0.0.0/16

/export/gentoo-x86_64 10.0.0.0/16

/export               10.0.0.0/16

```

However, after all of this, I am still unable to see the diskless node boot, and believe it's failing while trying to mount the root file system via NFS.

----------

## Hu

Does the server receive any network traffic from the diskless client?  Can you modify the diskless initramfs to drop to a shell on failure so that you can explore?

----------

## srd

I'm pretty certain at this point that things haven't even entered the initramfs yet. One of the bootargs is "init=/linuxrc" and that script hasn't been started at this point, unless I'm interpreting the stack trace incorrectly, and I think its saying that it hasn't mounted the root fs. The only traffic that's happened so far is PXE booting to where the kernel has been tftp'd to the node and it's now 3 seconds into the boot and the kernel panics. I've got a pic of the stack trace around here somewhere's.

----------

## Hu

When an initramfs is used, that is always mounted and if a valid init is found, it is executed instead of mounting root.  Usually, an initramfs will mount the real root filesystem and then switch_root to it.

----------

## srd

Ok, on second thought, I'm now editing this post as I don't think the initramfs is what I need.

DHCP tells the slave nodes where to get the initial file system. In this case, the kernel, then it downloads it, and then it boots the kernel. Normally an initramfs could tell the kernel what to mount, but in the case of mounting diskless nodes, I think NFS is how the rootfs gets mounted. I also have a boot arg for the init script where I do alot of other temp fs mounting. The Gentoo Diskless Wiki's don't use initram's in their configs, they mount via NFS. The pxelinux.cfg/default file is what I'm using to give the location of the linuxrc script (which by itself I didn't consider an initramfs). But now that I look at it more closely, even this doesn't mount root. Seems root is supposed to be mounted via NFS which my master exports (configs above). The more I think about it, I'm think my problem comes down to NFSv4 being the problem, can't seem to get it to work right.

I did add an initrams just like I have on the master node, and it did boot further (I didn't make enough changes), so even though that worked, I still don't think I need an initramfs on the slave node, so I removed it. Or maybe I do, but just not so complete as the master. Anyways, I'm thinking that mounting root via NFS is the prob.

----------

## Hu

Root on NFS can be done without an initramfs.  If you choose to do it that way, then you must not have an initramfs (either embedded or from the bootloader), since having the initramfs causes the kernel to skip automatically mounting a separate root filesystem.

----------

