Network Boot
PXE booting with SYSTEM and /storage mounted via NFS is supported on Generic x86_64 and Raspberry Pi devices. In the following writeup the server is Ubuntu 18.04 LTS.

Client (LibreELEC)

Download the image for your device.
  • Create a readonly nfs export and place KERNEL and SYSTEM files into it
  • Create a read-write nfs export for storage
  • Create pxelinux.cfg with the MAC address of your device, e.g. 90-91-92-93-94-95
  • Edit this file and add:
1
DEFAULT LibreELEC
2
PROMPT 0
3
4
LABEL LibreELEC
5
KERNEL libreelec/KERNEL
6
APPEND ip=dhcp boot=NFS=192.168.0.1:/mnt/store/libreelec disk=NFS=192.168.0.1:/mnt/store/libreelec/storage overlay
Copied!
Replace 192.168.0.1 with the NFS server IP address. The overlay parameter is not required if you only intend to boot one system. LibreELEC is now configured to boot using TFTP and NFS!

Server (Ubuntu)

In Ubuntu we need to install and configure DHCP, TFTP, and NFS services:
1
sudo apt install isc-dhcp-server tftpd-hpa nfs-kernel-server
Copied!

DHCP

Edit /etc/dhcp/dhcpd.conf and change the DHCP range if needed. Create entries in the host section for your client(s):
1
authoritative;
2
allow booting;
3
allow bootp;
4
5
ddns-update-style none;
6
7
default-lease-time 86400;
8
max-lease-time 86400;
9
10
subnet 192.168.0.0 netmask 255.255.255.0
11
{
12
option subnet-mask 255.255.255.0;
13
option broadcast-address 192.168.0.255;
14
option domain-name-servers 192.168.0.2, 192.168.0.1;
15
option routers 192.168.0.1;
16
17
range 192.168.0.10 192.168.0.200;
18
next-server 192.168.0.2;
19
filename "/pxelinux.0";
20
21
host <name>
22
{
23
hardware ethernet 00:0a:0b:0c:0d:0e;
24
fixed-address 192.168.0.5;
25
}
26
}
Copied!
Edit /etc/default/isc-dhcp-server to set the interface name handling DHCP requests:
1
INTERFACES="eth0"
Copied!

NFS

Create the directories that will contain your /storage userdata and TFTP boot files, e.g.
1
sudo mkdir /mnt/media/storage
2
sudo mkdir -m777 /mnt/tftpboot
Copied!
Copy the KERNEL and SYSTEM files into the /mnt/tftpboot directory:
1
sudo cp KERNEL /mnt/tftpboot
2
sudo cp SYSTEM /mnt/tftpboot
Copied!
Then add the following lines to the /etc/exports file:
1
/mnt/media/storage 192.168.0.2/255.255.255.0(no_root_squash,rw,async,no_subtree_check)
2
/mnt/tftpboot 192.168.0.2/255.255.255.0(no_root_squash,rw,async,no_subtree_check)
Copied!

TFTP

Create directories for the TFTP bootfiles. In this example they are served from a different disk:
1
sudo mkdir /mnt/tftpboot/pxelinux.cfg
2
sudo cp -p /usr/lib/syslinux/pxelinux.0 /mnt/tftpboot
Copied!
You may also want to copy the KERNEL and SYSTEM files to /mnt/tftpboot
Add the following lines to /etc/default/tftpd-hpa and save the file:
1
RUN_DAEMON="yes"
2
TFTP_USERNAME="tftp"
3
TFTP_DIRECTORY="/mnt/tftpboot"
4
TFTP_ADDRESS="0.0.0.0:69"
5
TFTP_OPTIONS="--secure"
Copied!
Create /mnt/tftpboot/pxelinux.cfg/default and insert the following:
1
DEFAULT LibreELEC
2
PROMPT 0
3
4
LABEL LibreELEC
5
kernel /KERNEL
6
append ip=dhcp boot=NFS=192.168.0.2:/mnt/tftpboot disk=NFS=192.168.0.2:/mnt/media/storage
Copied!

Firewall

If using the default Ubuntu firewall (UFW) add the following rules to allow ports for TFTP (69) and ONRPC (111):
1
sudo ufw allow proto udp from 192.168.0.0/24 to any port 69
2
sudo ufw allow proto tcp from 192.168.0.0/24 to any port 111
Copied!
Clients normally connect to the NFS server on random ports, so it the firewall is active "mountd" needs to be told to use a fixed port allowed through the firewall, or boot will hang.
Edit /etc/default/nfs-kernel-server and replace the current RPCMOUNTDOPTS line. In the example below 8765 is a randomly chosen port:
1
RPCMOUNTDOPTS="-p 8765"
Copied!
Create a matching firewall rule to allow the port:
1
sudo ufw allow proto tcp from 192.168.0.0/24 to any port 8765
Copied!

Services

And finally, start services:
1
sudo service isc-dhcp-server start
2
sudo service nfs-kernel-server start
3
sudo service tftpd-hpa start
Copied!
Last modified 1yr ago