Debian NFS Booting Thin Client

server:/srv# debootstrap --verbose --arch=<ARCH> --foreign --variant=minbase --include=linux-image-2.6-<SYSTEM>,initramfs-tools,net-tools,iproute,ifupdown,nfs-common,pump,dialog,nano lenny rootfs http://ftp.uk.debian.org/debian
[snipped building of 'rootfs']

Where '<ARCH>' is the architecture such as 'i386', 'sparc64', 'armel', etc and '<PROCESSOR>' is a suitable system taken from the Debian Kernel List such as '686'.

N.B. if the output of 'uname -m' on server matches what you want to use for '<ARCH>' then you can drop '--foreign'

server:/srv# chroot rootfs

I have no name!@server:/# ./debootstrap/debootstrap --verbose --second-stage
[snipped extracting and configuration of 'rootfs']
W: Failure while installing base packages.  This will be re-attempted up to five times.

I have no name!@server:/# ./debootstrap/debootstrap --verbose --second-stage
[snipped extracting and configuration of 'rootfs']
I: Configuring initramfs-tools...
I: Unpacking the base system...
I: Unpacking linux-image-2.6.26-2-686...
W: Failure while installing base packages.  This will be re-attempted up to five times.
I: Unpacking linux-image-2.6.26-2-686...
W: Failure while installing base packages.  This will be re-attempted up to five times.
I: Unpacking linux-image-2.6.26-2-686...
W: Failure while installing base packages.  This will be re-attempted up to five times.
I: Unpacking linux-image-2.6.26-2-686...
W: Failure while installing base packages.  This will be re-attempted up to five times.
I: Unpacking linux-image-2.6.26-2-686...
W: Failure while installing base packages.  This will be re-attempted up to five times.

[snipped editing of /etc/initramfs-tools/initramfs.conf]
I have no name!@server:/# grep -v '^\(#\|$\)' /etc/initramfs-tools/initramfs.conf
  MODULES=netboot
  BUSYBOX=y
  KEYMAP=n
  BOOT=nfs
  DEVICE=eth0
  NFSROOT=auto
I have no name!@server:/# echo '
# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = yes
relative_links = yes
do_bootloader = no 
do_bootfloppy = no
do_initrd = yes
link_in_boot = no' > /etc/kernel-img.conf

I have no name!@server:/# dpkg -a --configure
I have no name!@server:/# apt-get install linux-image-2.6.26-2-686
I have no name!@server:/# apt-get install dpkg --reinstall

I have no name!@server:/# apt-get clean
I have no name!@server:/# apt-get remove gcc-4.2-base
I have no name!@server:/# rm /var/lib/apt/lists/ftp.*
I have no name!@server:/# exit

server:/srv# echo hostname > rootfs/etc/hostname
server:/srv# rm rootfs/etc/resolv.conf
server:/srv# echo '
  deb http://ftp.MIRROR.debian.org/debian/ lenny main contrib non-free
  #deb-src http://ftp.<MIRROR>.debian.org/debian/ lenny main contrib non-free
  
  deb http://security.debian.org/ lenny/updates main contrib non-free
  #deb-src http://security.debian.org/ lenny/updates main contrib non-free
  
  deb http://volatile.debian.org/debian-volatile lenny/volatile main
  #deb-src http://volatile.debian.org/debian-volatile lenny/volatile main
' > rootfs/etc/apt/sources.list
server:/srv# echo '
  DPkg::Pre-Invoke {"mount -o remount,exec /tmp";};
  DPkg::Post-Invoke {"mount -o remount /tmp";};
' > rootfs/etc/apt/apt.conf.d/07tmpexec
server:/srv# echo '
  # /etc/fstab: static file system information.
  #
  # <file system> <mount point>   <type>  <options>                       <d><p>
  tmpfs           /tmp            tmpfs   nodev,nosuid,noexec,size=32M     0  0
  tmpfs           /var/tmp        tmpfs   nodev,nosuid,noexec,size=8M      0  0
  varrun          /var/run        tmpfs   nodev,nosuid,noexec,size=512k    0  0
  varlock         /var/lock       tmpfs   nodev,nosuid,noexec,size=96k     0  0   
  
  tmpfs           /var/log        tmpfs   nodev,nosuid,noexec,size=1M      0  0
' > rootfs/etc/fstab

Now copy the /boot/vmlinuz

LABEL test
  MENU LABEL TEST
  KERNEL /nfs-booter/vmlinuz
  # although normally we would have 'ip=::::diskless:eth0:dhcp', the lease will
  # last long enough for the NFS root mount to kick in and then get 'pump' to
  # deal with the DHCP lease renewing from the /etc/network/interfaces file
  # the result is that it saves us one of the three DHCP discoveries that we
  # would otherwise be doing (PXE, initramfs, pump)
  #
  # 'udp' as there seems to be a racy pump+nfsroot issue occasionaly
  # 'pci=nomsi' as Dull FX160's are shitty and the tg3 gets upset
  #
  IPAPPEND 1
  APPEND initrd=/nfs-booter/initrd.img root=/dev/nfs vga=extended nfsroot=1.2.3.4:/srv/rootfs,udp ro console=tty6 printk.time=0 pci=nomsi

rm /etc/udev/rules.d/*-persistent-*.rules

cd /etc
rm mtab
ln -s /proc/mounts mtab

www: debian-thinclient (last edited 2010-05-10 10:29:02 by alex)