BBB - mounting rootfs from NFS

Hello All,

I’m trying to mount root FS from my host PC’s (Ubuntu) on BBB. After referring to various online references I was able to get to a point where BBB can detect my NFS share and goes all the way till Angstrom logo. When I try to log-in I get kernel panic.

Attached is log captured using UART.
Any help would be greatly appreciated.

Thanks,
Mahee

U-Boot 2013.04-dirty (Jul 10 2013 - 14:02:53)

I2C: ready
DRAM: 512 MiB
WARNING: Caches not enabled
NAND: No NAND device found!!!
0 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - readenv() failed, using default environment

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Peripheral mode controller at 47401000 using PIO, IRQ 0
musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Host mode controller at 47401800 using PIO, IRQ 0
Net: not set. Validating first E-fuse MAC
cpsw, usb_ether
Hit any key to stop autoboot: 0
U-Boot# setenv ipaddr 192.168.1.200
U-Boot# setenv serverip 192.168.1.111
U-Boot# tftpboot 0x80200000 uImage-BBB
link up on port 0, speed 100, full duplex
Using cpsw device
TFTP from server 192.168.1.111; our IP address is 192.168.1.200
Filename ‘uImage-BBB’.
Load address: 0x80200000
Loading: #################################################################

I am not familiar with how it is done on Ubuntu, but with Debian you need to allow connections to the NFS server. It seems the server is not responding because you do not have this setup correctly. However, as I said I am not too familiar with Ubuntu in this respect, so it is possible I am wrong.

So with Debian . . .

  1. Install the NFS server and related packages.
  2. sudo nano /etc/hosts.allow and add a line similar to ALL: LOCAL at the end of the file.
  3. sudo nano /etc/exports and add a proper and existing export.

Example:
/home/username/rootfs xxx.xxx.xxx.xxx(rw,sync,no_root_squash,no_subtree_check)
Where username is the normal user you’re logged into, and xxx.xxx.xxx.xxx is the static
ipaddress you’re going to assign to your Beaglebone Black.
4) sudo exportfs -a
5) sudo nano /etc/default/services and add NFS=1 to the file ( This step may or may not be
depreciated ).
6) sudo service nfs-kernel-server start
7) sudo exportfs

Step 7 should give you a print out of all active / correct exports if everything was done correctly.

Again, all the above are necessary steps for setting up a “proper” export on Debian Wheezy. But all of the above are needed for an NFS share to be accessible outside of the server. I am almost 100% sure these steps verbatim will not work on Ubuntu, but there will be similar steps needed to achieve the same goal. Assuming exportfs is an actual NFS tool on Ubuntu, you most certainly can simply start by issuing the command on step 7 to test before going through the whole setup above.

Ah sorry I forgot to mention that you will need to make sure your uEnv.txt file is setup properly for NFS root as well. But as far as I can tell from the above output this seems to be the case already.

Also, I wrote an article on NFS root on my blog site, and talked with someoen who tested it with various distro’s. This person told me that Angstrom, Fedora, and Ubuntu all had issues with these procedures. As I mentioned above the exact steps I listed above will probably not work, but serve as a rough guide as to what needs to be done. I suspect Angstrom uses a different services daemon ( system -v type init daemon ) which is the cause. SO you’ll need to do some reading, and get a good understanding of the Angstrom distro in this aspect.

I am not familiar with how it is done on Ubuntu, but with Debian you need to allow connections to the NFS server. It seems the server is not responding because you do not have this setup correctly. However, as I said I am not too familiar with Ubuntu in this respect, so it is possible I am wrong.

So with Debian . . .

  1. Install the NFS server and related packages.
  2. sudo nano /etc/hosts.allow and add a line similar to ALL: LOCAL at the end of the file.
  3. sudo nano /etc/exports and add a proper and existing export.

Example:
/home/username/rootfs xxx.xxx.xxx.xxx(rw,sync,no_root_squash,no_subtree_check)
Where username is the normal user you’re logged into, and xxx.xxx.xxx.xxx is the static
ipaddress you’re going to assign to your Beaglebone Black.
4) sudo exportfs -a
5) sudo nano /etc/default/services and add NFS=1 to the file ( This step may or may not be
depreciated ).
6) sudo service nfs-kernel-server start
7) sudo exportfs

Step 7 should give you a print out of all active / correct exports if everything was done correctly.

Again, all the above are necessary steps for setting up a “proper” export on Debian Wheezy. But all of the above are needed for an NFS share to be accessible outside of the server. I am almost 100% sure these steps verbatim will not work on Ubuntu, but there will be similar steps needed to achieve the same goal. Assuming exportfs is an actual NFS tool on Ubuntu, you most certainly can simply start by issuing the command on step 7 to test before going through the whole setup above.

I can confirm that Ubuntu 13.10 uses the same setup.

Regards,
John

FWIW, my uEnv.txt is below (I don’t know how much of its formatting will survive google groups).

uenvcmd=run findfdt; if test $board_name = A335BNLT; then setenv mmcdev 1; mmc dev ${mmcdev}; if mmc rescan; then setenv mmc1 1; else setenv mmc1 0; fi; fi; setenv mmcdev 0; mmc dev ${mmcdev}; if mmc rescan; then setenv mmc0 1; else setenv mmc0 0; fi; if run loadtftp; then run nfsboot; fi;
mmcroot=/dev/mmcblk0p2 rw
ipaddr=192.168.1.17
serverip=192.168.1.20
loadtftp=tftpboot ${loadaddr} public/zImage; tftpboot ${fdtaddr} public/am335x-boneblack.dtb
nfsargs=setenv bootargs console=ttyO0,115200n8 ${optargs} root=/dev/nfs rw nfsroot=192.168.1.20:/rootfs,vers=4 ip=dhcp
autooff=setenv autoload no
nfsboot=echo booting via TFTP and NFS …; run autooff; run nfsargs; bootz ${loadaddr} - ${fdtaddr}
loadfdt=ext4load mmc ${mmcdev}:2 ${fdtaddr} /boot/dtbs/${fdtfile}
loaduimage=if ext4load mmc 0:2 ${loadaddr} /boot/zImage; then setenv mmcdev 0; else setenv mmcdev 1; if test $mmc0 = 1; then setenv mmcroot /dev/mmcblk1p2 rw; fi; ext4load mmc 1:2 ${loadaddr} /boot/zImage; fi;
#optargs=quiet nomodeset capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
#optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-SPIDEV0,BB-SPI1CLK

That’s with the BBB as 192.168.1.17, and the server as 192.168.1.20. The server is running NFS and TFTP servers (and an NTP server, come to that).
You really need to use a serial/FTDI converter on tty0 while testing - it’s the only way to find out what’s going on.

Will

Thanks William, John & Will.

I made a clean install of my VM and started from scratch.
Instead of using Angstrom I used Ubuntu and now I’m able to use my rootfs from NFS server.

I’m still not sure what went wrong with Angstrom for now I’m happy for Ubuntu, will visit Angstrom again in a week or so.
I will update my sequence on web in a day or so.

Mahee