Diskless Frontends:

After beeing using MythTV for several years, I'm now desided to change my setup from ArchLinux to Debian, for trying to get a more stabil system.

One of my big thoughts is using electricity, so trying to make my MBE use more CPU-power (It's allmost not using anything CPU or RAM) so though this might be an idea.
My idea was to make all my frontends diskless only running on a LTSP setup. But the a challange is to have both 32 and 64bit system in network boot. So starting out with these settings on my MasterBackEnd to make everything runs smoothly.
Maindirectory in this setup:

Diskless setup:
/diskless                                       - Maindirectory for netbootimages
/diskless/stuen                             - Machine for Livingroom
/diskless/koekken                         - Machine for kitchen
/diskless/unger                            - Machine for the kids
/diskless/sove                              - Machine for the bedroom

TFTP server:
/srv/tftp                                       - Maindiirectory for bootimage

These dir needs to be made for getting the sources for installing everything to diskless frontends. Now we should get all the packages etc to make our network images for each machine in the network.Starting with the different packages needed on the masterbackend:

apt-get install tftpd-hpa debootstrap nfs-kernel-serve


Getting the packages for the network machines:

#  For getting the 64bit system:

debootstrap squeeze --arch x86_64 /diskless/stuen

 

# For getting the 32bit system
debootstrap squeeze --arch i386 /diskless/koekken
debootstrap squeeze --arch i386 /diskless/unger
debootstrap squeeze --arch i386 /diskless/sove

This will automaticly get all the packages, and will take looong time.But we need to edit some files files before going further - /etc/network/interface andd /etc/hostname

# /etc/network/interfaces:

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp

 

# and put in the name for the client hostname in /etc/hostname
koekken

 

But afterwards we'll chroot into the machines and install kernels and create a bootimage! To do that - you need these commands:

# Changing chroot
chroot /diskless/stuen
# Installing the packages needing:
apt-get install linux-image partimage build-essential git  

This will install a new kernel for the machine.  This means it'll create a initrd.img and vmlinuz which are files needed for booting on network. But now we copy the files for boot on the PXE.

cd /srv/tftp/
wget http://ftp.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/pxelinux.0
mkdir pxelinux.cfg
cp /client1/vmlinux ./
cp /client1/initrc.img ./
nano pxelinux.cfg/default

And for the 64bit systems default file should look like this:

DISPLAY boot.txt
F1 f1.txt

DEFAULT linux

LABEL linux64
kernel vmlinuz64
append initrd=initrd64.img ip=dhcp ramdisk_size=14332 root=/dev/nfs nfsroot=172.16.20.10:/diskless/stuen rw --
PROMPT 0
TIIMEOUT 0

And for the 32bit system:

DISPLAY boot.txt
F1 f1.txt

DEFAULT linux

LABEL linux
kernel vmlinuz
append initrd=initrd.img ip=dhcp ramdisk_size=14332 root=/dev/nfs nfsroot=172.16.20.10:/diskless/koekken rw --
PROMPT 0
TIIMEOUT 0

NOTICE: look at the end of the boot line which is quite important when you have more than 1machine, you'll need to make this rigth and be sure of it! Bit now we need to change the bootimage - to actually have nfs-module enabled and booting on the network!

cd /srv/tftp
mkdir test/
cd test/
gzip -dc ../initrd.img | cpio -id

nano conf/initramfs.conf
# change sure these settings are set

MODULES=netboot
BOOT=nfs

# repack the image:
find ./ | cpio -H newc -o > ../initrd.img
cd ../
gzip initrd.img
mv initrd.img.gz initrd.img

Remember to give your bootimages different names depending on which machine you're booting on. Now we shall look on our DHCP-server running somewhere in our setup (in my system - on my Soekris Router ) In /etc/dhcp/dhcpd.conf we should make these changes to make it run smoothly:

subnet 172.16.20.0 netmask 255.255.255.0 {
range 172.16.20.200 172.16.20.254;
option broadcast-address 172.16.20.255;
filename "pxelinux.0";
next-server 172.16.20.10;
option routers 172.16.20.1;
option domain-name "pbj-design.dk";
}

which are the setting that tells the machine where to find its bootimage. Last part is setting up the NFS export and it should look like this:

/diskless               172.16.20.0/255.255.0.0(sync,no_subtree_check,fsid=0,rw)
/diskless/stuen         172.16.20.0/255.255.0.0(rw,no_subtree_check,async,no_root_squash)
/diskless/koekken       172.16.20.0/255.255.0.0(rw,no_subtree_check,async,no_root_squash)
/diskless/unger         172.16.20.0/255.255.0.0(rw,no_subtree_check,async,no_root_squash)
/diskless/sove          172.16.20.0/255.255.0.0(rw,no_subtree_check,async,no_root_squash)

And afterwards restart the NFS-server service.

Now you have a machine that'll boot from the network and actually have all files on the MasterBackEnd!

Afterwards I found out that there's some extra thing when running a NFS-diskless system, so on all clients I've added this to /etc/rc.local

# Setting the time on the client
ntpdate 172.16.20.10
sleep 5
# Mounting all drives
mount -a

This will make sure the time is right according to the MBE, and also the mounted drives. Now you're ready to install your applications(in my case MythTV) - and this is the time its installed on Debian instead of ArchLinux. So boot up your machine and start the mythtv installation. You'll need to start with adding the Debian Multimedia repos to your apt-sources. Afterwards you'll be able to install the packages needed for at stable Mythtv setup:

apt-get install mythtv mythmusic python-mythtv mythtv-common mythtv-themes mythtv-frontend
mythtv-plugins nuvexport openssh-server automake autoconf ntpdate

This will install the default packages for Mythtv - and you're ready to go - you can allso use the git version but then you'll need to make som more changes!