Network boot with Debian
These are my notes on setting up diskless booting of a Via EDEN computer from an Ubuntu server. This should also work on a Debian server. The machines of relevance to this article are:
- DHCP Server (203.35.65.1) an existing server running an old copy of RedHat which is currently providing DHCP services to the existing local network
- Boot Server (203.35.65.33) A new machine running Kubuntu 5.10 “Hoary Hedgehog” which will contain the boot image and files
- Client – The Via EDEN box which has no hard disk
Setting up the EDEN box to network boot
You’ll need to go into the BIOS settings by pressing the DEL key when you see the Via splash screen.
1. Go into Advanced BIOS Features and change the First boot device setting to LAN.
2. Go into the Integrated Peripherals section and enable the Onboard Lan Boot ROM.
3. Save your changes and reboot. It won’t work yet because we haven’t set up the server but you should see it try and fail to network boot.
Setting up DHCP for network booting
Since there is already a DHCP system installed here, I need to work with that since I do not think it would be a good idea to have two DHCP servers on the same network. So we will begin by adding the following lines to /etc/dhcpd.conf – don’t forget to change the IP and MAC numbers to ones appropriate for your own network:
allow booting;
allow bootp;
group
{
next-server 203.35.65.33;
filename "pxelinux.0";
host stb00001;
{
hardware Ethernet 00:40:63:E1:F9:76;
fixed-address 203.35.65.232;
}
}
After modifying the file, restart the daemon. That should be all the changes I need to do on the RedHat box and I have not messed up normal DHCP operation for the other network users.
# service dhcpd restart
Setting up the boot environment
The Via box uses a network boot standard known as PXE. Debian has some packages to get a PXE boot going. Install the following packages:
# apt-get install syslinux tftpd-hpa nfs-user-server
Choose no when it asks if you want to launch tftpd from inetd.
Next set up the file /etc/default/tftpd-hpa to look like this:
#Defaults for tftpd-hpa RUN_DAEMON="yes" OPTIONS="-l -s /tftpboot"
Then set up a boot directory:
# mkdir /tftpboot # chmod 755 /tftpboot # cd /tftpboot # cp /usr/lib/syslinux/pxelinux.0 ./ # mkdir pxelinux.cfg
Next set up the PXE configuration file. The configuration file name must be the IP of the client in HEX. The hex letters must be in uppercase too!
So for our test box at 203.35.65.232, the file would be /tftpboot/pxelinux.cfg/CB2341E8. Apparently you can also call this file /tftpboot/pxelinux.cfg/default but I haven’t tried that. Here are the contents of the file:
# PXE Configuration file for the DVC set top box. # by Adam Pierce adam@commandsystems.com.au # Command Systems Pty. Ltd. Australia default dvc label dvc kernel dvc-kernel append ip=dhcp root=/dev/nfs rw nfsroot=203.35.65.29:/export/dvc/stbroot
At this point, you should be able to reboot the Via box and it should connect to the server and obtain its network settings. It should get as far as loading the OS and then fail with “Could not find kernel image”.
Set up the root file system
The operating system for the client will be stored in a directory on the server. Let’s create that directory now.
# mkdir /export # mkdir /export/dvc # mkdir /export/dvc/stbroot # mkdir /export/dvc/stb00001
Fill this new directory with your root file system. In my case, I intend to run multiple clients at some point in the future so I have created two subdirectories called stbroot and stb00001. These will be mounted read-only and read-write respectively. The stb00001 directory will contain folders such as /tmp and /home which the client will need to write to and I can have a separate directory for each client on the network.
The root file system for the client can now be placed in stbroot:
# cd /export/dvc/stbroot # tar zxvf MyRootFSWhichIPreparedEarlier.tar.gz
Set up the kernel
The client will need to load the kernel before it can mount the shared directories so the kernel will need to go in the tftpboot area. Just copy the kernel from your root file system (this is easy if you are using GRUB):
# cp /export/dvc/stbroot/boot/<name of kernel> /tftpboot/dvc-kernel
At this point, the client will be able to boot and load the kernel. You should see screenfuls of kernel messages and then it will say “Kernel panic: unable to mount root fs”.
Configure NFS
This is the final step before the client can be booted. The client will mount it’s drives over the network using NFS. Set this up in the /etc/exports file. It should look like this:
# /etc/exports: the access control list for filesystems which may be exported # to NFS clients. See exports(5). /export/dvc/stbroot 203.35.65.0/255.255.255.0(rw,no_root_squash) /export/dvc/stb00001 203.35.65.0/255.255.255.0(rw,no_root_squash)
Then finally you can restart the NFS daemon and you should be good to go.
# /etc/init.d/nfs-user-server restart
Note that I have not discussed how to set up the root file system for the client. That can be a topic for another day.
