Network Boot - NFS

From OpenELEC
Jump to: navigation, search
20px   installation Network Boot - NFS


This guide shows how to boot openelec using pxe boot with system and storage mounted via nfs.

General setup

Download the image for your device.

  1. Create a readonly nfs export and place the "KERNEL" and "SYSTEM" files in to it. (Sancho: This step was unnecessary for me, the simple copy to the tftpboot directory was enough, no readonly NFS export is required)
  2. Create a read-write nfs export for storage.
  3. Create a file in pxelinux.cfg with the mac-address of your device (eg. 90-91-92-93-94-95).
  4. Edit this file and add:

       KERNEL openelec/KERNEL
       APPEND ip=dhcp boot=NFS= disk=NFS= overlay

...replacing IP address with the IP of NFS server and mountpoints on the server of course. Also, you don't need the "overlay" parameter if you only intend to use one system.

Now openelec should boot using tftp and nfs!

Ubuntu 12.04 LTS

Basically you can use the above mentioned steps when configuring this in Ubuntu. This part will elaborate on the information above in more detail.

First, we need to install the software that is required to make everything work. Considering you are a normal user, we will be using sudo throughout the process.

Installing the software

To enable your clients to boot from the network, install DHCP, TFTP and NFS:

# sudo aptitude install isc-dhcp-server tftpd-hpa nfs-kernel-server

Note that, in Ubuntu 12.04, ISC DHCP server is a transitional package for dhcp3-server.

Configure DHCP

After installing the software, you have to configure DHCP.

Edit the file in /etc/dhcp/dhcpd.conf. Here's a common configuration:

allow booting;
allow bootp;

ddns-update-style none;

default-lease-time 86400;
max-lease-time 86400;

subnet netmask
  option subnet-mask;
  option broadcast-address;
  option domain-name-servers,;
  option routers;

  filename "/pxelinux.0";

  host <name>
      hardware ethernet 00:0a:0b:0c:0d:0e;

If you want another range for clients using DHCP, modify your own configuration accordingly. If you want to assign a specific IP address to a client, modify the host section.

Next, edit the file /etc/default/isc-dhcp-server. This file contains the reference to the interface card that will be handling the DHCP requests:


Save your changes. Your DHCP server is now ready to go.

Configure NFS

First, create the directories in which you want to locate your storage (userdata) and boot files for tftp.

sudo mkdir /mnt/media/storage
sudo mkdir -m777 /mnt/tftpboot

Copy the KERNEL and SYSTEM files into the /mnt/tftpboot directory using

sudo cp KERNEL /mnt/tftpboot
sudo cp SYSTEM /mnt/tftpboot

Then add the following lines to your /etc/exports:

/mnt/tftpboot ,rw,async,no_subtree_check)

That's it for your exports.

Configure TFTP

First, you need to create some directories. I chose to serve my tftp from a different disk.
In the end, tftp will retrieve its bootfiles from this location.

sudo mkdir /mnt/tftpboot/pxelinux.cfg/
sudo cp -p /usr/lib/syslinux/pxelinux.0 /mnt/tftpboot/

At this time, you may also want to copy the KERNEL and SYSTEM files to /mnt/tftpboot/.

Now, insert the following lines into the tftpd-hpa file in /etc/default and save the file:


Next, create a file /mnt/tftpboot/pxelinux.cfg/default, insert the following lines and save the changes:


kernel /KERNEL
append ip=dhcp boot=NFS= disk=NFS=

Starting services

And that's it. There's nothing more to it to get it to work. Finally, start all services and you're ready to go.

sudo service isc-dhcp-server start
sudo service nfs-kernel-server start
sudo service tftpd-hpa start

Additional configuration: firewall

Make sure you enter the following rules into your firewall (e.g. ufw):

sudo ufw allow proto udp from to any port 69  (for tftp)
sudo ufw allow proto tcp from to any port 111 (for openelec)

Additional configuration: mountd

Normally, OpenElec will connect to XBMC through a different (random if you will) port every time you boot the system. With ufw active, everytime you do this, OpenElec will "hang" because there is no firewall rule. So in case you want Openelec to connect through a specific port, you need to modify the mountd options.

vi /etc/default/nfs-kernel-server

Then comment out RPCMOUNTDPOTS and insert the following line:

RPCMOUNTDOPTS="-p <port>"    # <port> is a random port, e.g. 13025.

Finally, add a rule for this port to your firewall configuration:

sudo ufw allow proto tcp from to any port 13025