2

This is an embedded device with a custom kernel (see below for relevant config). It's an x86-32 machine booting like this: coreboot->uboot->linux. I can mount the NFS share in linux if I use on-board storage for the rootfs. I'm pretty sure that linux is correctly autoconfiguring the network at boot using ip=dhcp (note: this is using the network's DHCP server; it's just handing out IP addresses, and has nothing to do with BOOTP or anything like that). I've also tried explicitly setting parameters with ip=, results are the same as for ip=dhcp.

Here's what gets executed in uboot:

set ethaddr 02:00:00:10:00:43; set serverip 204.54.80.195; set ipaddr 204.54.80.37
set bootargs rootwait raid=noautodetect rw console=ttyS0,115200 root=/dev/nfs nfsroot=$serverip:/yukon ip=dhcp
ext4load mmc 0 ${kernel_addr} ${kernel_path} ; ext4load mmc 0 ${initrd_addr} ${initrd_path} ; zboot ${kernel_addr} 0 ${initrd_addr}

Here's the network coming up in linux:

Sending DHCP requests ., OK
IP-Config: Got DHCP answer from 204.54.80.10, my address is 204.54.80.37
IP-Config: Complete:
     device=eth0, hwaddr=02:00:00:10:00:43, ipaddr=204.54.80.37, mask=255.255.255.0, gw=204.54.80.1
     host=204.54.80.37, domain=jdnet.deere.com, nis-domain=(none)
     bootserver=0.0.0.0, rootserver=204.54.80.195, rootpath=
     nameserver0=204.54.84.14, nameserver1=164.121.15.220

Linux panics when it can't mount the rootfs:

VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6

Relevant kernel config:

root@localhost:~# zgrep -E NFS\|IP_PNP /proc/config.gz
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NFS_FS=y
CONFIG_NFS_V2=y
CONFIG_NFS_DEF_FILE_IO_SIZE=4096
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
CONFIG_NFS_V4=y
# CONFIG_NFS_SWAP is not set
# CONFIG_NFS_V4_1 is not set
CONFIG_ROOT_NFS=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
# CONFIG_NFSD is not set
CONFIG_NFS_COMMON=y

NFS can be mounted in linux with

mount.nfs 204.54.80.195:/yukon /mnt

I'm probably missing something obvious. I'm looking for ideas and common mistakes.


Updates:

  • The nfsrootdebug kernel parameter doesn't have any effect.
  • Though there is an initrd, it is not used. It is definitely not necessary for booting with on-board storage. All the necessary drivers are compiled into the kernel, not as modules.

Aside: I have determined that using ethernet in uboot makes it unusable in linux; that's another bug for me to solve, but I can avoid using the network in uboot so that shouldn't be an issue.

  • Are you sure the device name is root=/dev/nfs? I would suspect that this where the problem is. – Jeight May 21 '15 at 18:30
  • @Jeight That's how you tell linux to use NFS as the rootfs. kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt – jpkotta May 21 '15 at 18:51
  • I'm not sure then. Maybe it has something to do with this: rdinit=<executable file> To specify which file contains the program that starts system initialization, administrators can use this command line parameter. The default value of this parameter is "/init". If the specified file exists and the kernel can execute it, root filesystem related kernel command line parameters, including `nfsroot=', are ignored. – Jeight May 21 '15 at 19:12
  • But I don't specify rdinit=, and if I did, where would it live (in the initrd, I'd guess). There actually isn't any initrd, I will update the question to reflect this. – jpkotta May 21 '15 at 19:31
0

I would suggest to check /etc/exports, /etc/hosts.deny, /etc/hosts.allow on the server to see if dhcp-allocated address (204.54.80.37) is allowed.

  • I can mount the nfs rootfs once I'm in Linux, using the same hostname:/path as I'm giving the kernel in the cmdline. – jpkotta Sep 2 '15 at 22:59
0

I was really close. I needed to enable no_root_squash in /etc/exports:

/srv/nfs       204.54.0.0/16(rw,fsid=0,insecure,no_subtree_check,async,no_root_squash)
/srv/nfs/yukon 204.54.0.0/16(rw,nohide,insecure,no_subtree_check,async,no_root_squash)

And although both mount.nfs $serverip:/yukon /mnt and mount.nfs $serverip:/srv/nfs/yukon /mnt worked, I needed the full path for the Linux cmdline:

console=ttyS0,115200 rootwait rw nfsroot=$serverip:/srv/nfs/yukon ip=dhcp root=/dev/nfs

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.