NFS rootfs hangs for 50 seconds?
I'm trying to boot RPI with rootfs on NFS server. Here is cmdline.txt:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/nfs nfsroot=10.0.0.10:/path/to/rpi/rootfs nfsrootdebug ip=10.0.0.12:10.0.0.10:10.0.0.1:255.255.255.0:rpi:eth0:off rootfstype=nfs elevator=noop rootwait
Here is booting log:
[ 4.999437] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x43E1
[ 5.037709] IP-Config: Complete:
[ 5.045729] device=eth0, hwaddr=b8:27:eb:a7:c9:db, ipaddr=10.0.0.12, mask=255.255.255.0, gw=10.0.0.1
[ 5.060247] host=rpi, domain=, nis-domain=(none)
[ 5.070161] bootserver=10.0.0.10, rootserver=10.0.0.10, rootpath=
[ 54.356954] nfs: server 10.0.0.10 not responding, still trying
[ 54.376007] nfs: server 10.0.0.10 OK
[ 54.388687] VFS: Mounted root (nfs filesystem) on device 0:12.
[ 54.408408] devtmpfs: mounted
As you can see, there is a gap between 5.07 seconds when IP configuration is done to 54.37 second when NFS is mounted.
Maybe message nfs: server 10.0.0.10 not responding, still trying is indicative.
I tried with different servers for NFS, but nothing changed. Now, NFS server is Debian Stable and everything is mounting very fast, from any PC in network.
I've tried with latest and updated Raspbian and with older kernel (3.6.something) from 2013-09-25 release, results are same.
Could this be a bug in bootloader or firmware or it just needs some time to bring network up and running?
UPDATE:
I've made many tests to see what happens and I've seen some strange issues. Very strange. So, we have 40 RPIs installed and plugged in one network switch. That is important as I remember that when I was testing only one RPI in network, NFS was fast on mount.
So, I tried again same scenario, and it looks like there is a problem when there are many RPIs in one network. My first suspect was server, so I tried with the other one and there was no difference. Also, other PCs from same network can mount NFS share from server in 0.1 second or so. Also, I've tried with 3 different Cisco switches, it seams there is no difference between them.
When there is only one RPI in network, NFS rootfs mounts in ~5 seconds. When there are 40 RPIs in network, NFS rootfs mounts in ~50 seconds. Same share is mounted by any PC in any network case, very fast.
Could it be something regarding MAC addresses and RPI confusing each other or someone can say that its definitely not RPI issue (although it would be hard to explain this behavior then)?
Thanks
After hours of investigating this issue, we have came to conclusion that this problem has nothing to do with NFS at all.
We have noticed that regardless whether Raspberry's root filesystem is on SD card or NFS server, when Raspberry is plugged into a switch that has many devices (we have tried IP phones or other Raspberries) already connected to it (30+), Raspberry will need 40-50 seconds to bring its network up and working. That means to get an IP from DHCP server or basically to be able to respond to network pings.
We have tried with Cisco Catalyst 2960-48 and Cisco SF-300-48 (both old and new generation) switches. To eliminate switch as root of the problem, we will try to test some others too.
I'm closing this issue as its really not accurate. After we investigate enough to confirm that there is a Raspberry (firmware?) problem you can expect me back with the report :)
Sounds like it might be spanning tree protocol, it gave me major problems network booting normal desktops
The switch doesn't enable the port right away, then the bios dhcp Times out and gives up, so it never boots
STP is used by the switches to detect multiple paths causing a lop in the network, it will regularly broadcast special packets out all ports, and monitor any newly linked ports for those packets before allowing it to relay normal traffic
the switch leaves the port in that special mode for longer then the dhcp timeout in my bios, causing the dhcp to never get a lease, and every time it reboots to try again, the switch starts over
increasing the retry rate in your dhcp client may make it go thru faster, once the switch kicks into gear, or you can just turn STP off like i did
@cleverca22 You were right, it was STP, when I turn it off, it's working as it should.
@cleverca22 Interesting. I believe I've seen this using a tomato firmware router. I was having stalls on both the Pi running off nfs and the iPad playing videos from nfs share. Not just with nfs boot, but sometimes after nfs had been idle for a while. I changed various settings on the router, including disabling STP and haven't seen the problem for a while, so I may have had a similar issue.
the STP problem only effects trying to connect directly after getting a link over ethernet, the switch internally disables the port for ~15 seconds after it comes online, and in this case, your trying to do dhcp or nfs right as it comes online
that would never effect an ipad, since it lacks ethernet
The iPad was connecting though a wireless bridge. I wonder if that makes it possible to fail.
STP would only cause an issue if the wireless bridge shut off the ethernet link when idle, which wouldn't make much sense, it would block traffic coming from the lan