Debian Diskless Terminals Howto

This mini-howto explains how to quickly setup computers to work as X-terminals: boot from the network using dhcp+pxe, then start a local X server to connect on a remote host that will manage the session and run everything.

Installing packages on the server

You'll need a nfs server, a dhcp server, a tftp server and pxelinux.

Assuming everything will be on the same server:

# apt-get install syslinux nfs-kernel-server tftpd-hpa

Setting up the chroot

Create the chroot with debootstrap:

# cd /opt
# mkdir nfsroot
# debootstrap -v testing /opt/nfsroot http://ftp.debian.org/main

Now configure the minimalistic chroot:

# cp /etc/resolv.conf /opt/nfsroot/etc/
# chroot /opt/nfsroot
# apt-get update

Install a debian kernel and useful tools in the chroot

# apt-get install vim less procps passwd dhcp3-client nfsbooted
                  module-init-tools net-tools

Setup nfsbooted

Copy the content of /etc/nfsbooted/fstab into /etc/fstab

cat /etc/nfsbooted/fstab >> /etc/fstab

Edit it to suit your needs.

Add an entry to /etc/fstab to mount the / filesystem readonly so that nfsbooted's mountfix script can fix permissions at startup:

/   /.nfsroot none bind,ro 0 0

Create the .nfsroot dir

mkdir /.nfsroot

Configure inittab to start an xchooser

replace a tty entry in /etc/inittab by

1:2345:respawn:/sbin/getty 38400 tty1 -n -l /root/xchooser

where /root/xchooser is a small script that runs X in -indirect mode on the XDMCP server:

#!/bin/sh

while true; do
    X -layout `hostname` -indirect xdmserver.mydomain
    dialog --yesno "shutdown `hostname` ?" 5 23
    if [ $? = 0 ] ; then break; fi
done
shutdown -h now
sleep 5

Xorg configuration

Install xorg:

# apt-get install xserver-xorg xfonts-base

Configure xorg:

XXX TODO

Configure pxelinux and the kernel

tftpd comes configured to provide files from /var/lib/tftpboot on the server:

# cd /var/lib/tftpboot
# # symlink won't work if you keep the default -s option from tftpd :
# cp /usr/lib/syslinux/pxelinux.0 .
# mkdir pxelinux.cfg

Create a pxelinux configuration : edit /var/lib/tftpboot/pxelinux.cfg/default:

LABEL netboot
      kernel vmlinuz
      append rw ip=all

and go read nfsroot.txt in kernel sources for more info about the parameters that could be usefully passed to the kernel.