I recently bought an Intel NUC (NUC5i3RYK to be precise). I have equipped it with 8 GB of RAM, but with no storage. My goal is to make the HTPC boot completely over the network using PXE. This should load Kodi (XBMC) and be able to access all shared files located on my file server.
Since I want the network boot and HTPC root filesystem separated from the rest of the network, so that it won’t interfere with my regular DHCP server, I have located them on an separate VLAN. It is also possible to put everything on the same VLAN if you would like to, but then you would need to configure the DHCP server you usually use to point to the TFTP server used for PXE boot.
The server needs to provide DHCP address and an TFTP server. It also provides the root system for the Linux installation on which Kodi runs. The root filesystem is mounted over NFS. The server itself runs FreeBSD. I will use dnsmasq to provide both DHCP and TFTP. I believe this is easier than running separate daemons for both services.
dns/dnsmasq from ports. Ensure that the system it is running on has a static IP address, and runs dnsmasq on boot, fixed by setting e.g:
ifconfig_xn0="inet 10.0.8.254 netmask 255.255.255.0"
Now we need to configure dnsmasq to provide both DHCP and TFTP services. I use the following configuration file:
# Accept DNS queries only from hosts whose address is on a local
# subnet, ie a subnet for which an interface exists on the server.
# This option only has effect if there are no --interface
# --except-interface, --listen-address or --auth-server options.
# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# Override the default route supplied by dnsmasq and send no default
# route at all. Note that this only works for the options sent by
# default (1, 3, 6, 12, 28) the same line will send a zero-length option
# for all other option numbers.
# Set the boot filename for netboot/PXE. You will only need
# this is you want to boot machines over the network and you will need
# a TFTP server; either dnsmasq's built in TFTP server or an
# external one. (See below for how to enable the TFTP server.)
# NFS mountpoint
# Enable dnsmasq's built-in TFTP server
# Set the root directory for files available via FTP.
As you can see,
/htpc will be used as the root of our PXE-served Linux installation.
I export the
/htpc directory over NFS using the following
/htpc -maproot=root -network 10.0.8.0 -mask 255.255.255.0
and enable the NFS server by appending this to
We must allow clients to mount the filesystem with root rights (the -maproot option fixes this).
Preparing the NFS root directory with a Linux installation
/htpc directory must be filled with some interesting contents to actually boot a system.
I want my HTPC to run Kodi, and I initially planned to use OpenELEC for simplicity. However, OpenELEC does not support the use of NFSv4 mounts, and since my file server is only configured to serve media over a kerberized NFSv4 mount, I had to abandon the idea of OpenELEC, and instead use my own setup. I based this on Arch Linux.
Following the guide for Diskless systems from the Arch wiki , we see that we must initialize the base system in our
/htpc directory. Since this directory is located on a FreeBSD system, it is a bit tricky to do just by following the instructions as written on the wiki. However, since my desktop uses Arch Linux, I solved this by mounting the NFS share on my desktop computer, and proceeded according to the instructions on the wiki after this:
# mount -t nfs -o hard,nolock server:/htpc /htpc
# pacstrap -d /htpc base mkinitcpio-nfs-utils nfs-utils
This prepares an Arch Linux installation in the
/htpc directory on the NFS server. The initramfs must be generated to support an NFS root. Ensure that
/htpc/etc/mkinitcpio.conf has the following lines:
MODULES="nfs e1000 e1000e"
HOOKS="base udev autodetect modconf block net filesystems keyboard fsck"
I used the module
e1000e to match my network card, otherwise the NFS root mount will fail. Adapt this to your own network adapter. If you want to try to boot in VirtualBox before actually booting on the NUC, you need
e1000. Then regenerate the initramfs by calling:
# arch-chroot /htpc mkinitcpio -p linux
I proceeded with setting the hostname, locale, timezone, etc. as usual in an Arch Linux installation. Check the Installation guide  on the wiki for this.
Next it is time to setup the bootloader. I will use PXELINUX. From my desktop system, I copied the PXELINUX files to the NFS mount.
# cp /usr/lib/syslinux/bios/pxelinux.0 /htpc/boot
# cp /usr/lib/syslinux/bios/ldlinux.c32 /htpc/boot
# mkdir /htpc/boot/pxelinux.cfg
I then proceed by creating the
/htpc/boot/pxelinux.cfg/default configuration file:
kernel vmlinuz-linux net.ifnames=0
append initrd=initramfs-linux.img quiet ip=:::::eth0:dhcp nfsroot=10.0.8.254:/htpc
The base system is now ready, and should be able to boot over PXE! The kernel parameter
net.ifnames=0 was added to avoid network device renaming on boot. This interfered with my NFS root and VLANs, you may not need it.
Further configuration of the Linux installation
You may skip this section if you have an ordinary system. It covers other stuff relevant for my own case, e.g. creating new interfaces for my other VLANs.
This contains some final steps required for my specific setup. Since I just mounted the root filesystem on a specific VLAN, I want to mount my ordinary file server from my default VLAN. This is done by creating a new network interface with the correct VLAN.
I use the following netctl configuration file for Arch Linux in
Description='Regular VLAN on interface eth0'
# The variable name is plural, but needs precisely one interface
and I then enabled the profile by using
# netctl enable regular0-vlan
To mount my NFS file server on boot I use the systemd automounter and include the following line in my fstab.
file.server.host:/media /mnt/media nfs4 users,noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,noatime,nfsvers=4,sec=krb5,soft 0 0
In addition, the usual NFS Client configuration from  is required.
Installation of Kodi and related stuff
We begin by installing the Intel graphics drivers.
# pacman -S xf86-video-intel mesa-libgl libva-intel-driver libva mesa xorg-xinit xorg-server udisks upower polkit
Now to the fun part, we want to install Kodi and have it to start automatically.
# pacman -S kodi unrar unzip libcec
kodi-standalone-service from the AUR. Enable and start the service with
# systemctl enable kodi.service
To be able to shutdown the computer from within Kodi, add the user to the
storage groups. If you want to use a HDMI-CEC adapter such as , you also need to add the kodi user to the groups
# gpasswd -a kodi power
# gpasswd -a kodi storage
# gpasswd -a kodi uucp
# gpasswd -a kodi lock
Reboot your NUC, and Kodi will start just as expected!