KNOPPIX Terminal Server


From Knoppix Documentation Wiki
Revision as of 14:49, 16 October 2008 by Clinton (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Preamble

  • This page describes how to boot KNOPPIX 5.1.1 (outdated) from the network using Samba (as opposed to NFS).
  • The original author of this document, Rjent, moved his efforts to working on http://live.debian.net/ .
  • You are still welcome to contact him about the model however (please bare with him since he has a busy day job).

Model

The methodology for the hybrid environment uses a Common Internet File System (CIFS) to boot up KNOPPIX. The base work for this model utilizes existing resources and information from http://knoppix.manty.net

TFTP Server Setup

We start by configuring a TFTP server. It will serve the bootloader (PXELINUX) files which our client machines will load from the network and run even before starting the Linux/KNOPPIX kernel.

For this guide, we want our TFTP server to use /var/lib/tftpboot/ as the root directory. How you configure that depends on which tftp server you use (tftp-hpa, atftp, or other) and how you run it (inetd, xinetd, init daemon, ...).

For example, tftp-hpa can be started from inetd with this line in /etc/inetd.conf:

tftp           dgram   udp     wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

Samba Share Setup

Next we need to setup a Samba share which will host the KNOPPIX CD filesystem. The network client machines will access this share as if they were accessing the files from a regular KNOPPIX Live CD.

Samba provides the CIFS services out of the box. All we have to do is configure a share. An example smb.conf is listed below:

[global]
 netbios name = HYBRIDSERVER
 security = share
 guest account = nobody
[knoppix_share-5.1.1]
 comment = Knoppix 5.1.1 Boot Data
 path = /shares/knoppix-term-5.1.1
 read only = Yes
 guest ok = Yes

Note1: you need 'security = share' for (passwordless) guest access to work

Note2: you need to make sure that there exists a Unix user 'guest' on the server (in /etc/passwd)

Note3: After changes to smb.conf you will need to restart samba services.

DHCP Server Setup

After that, we setup a DHCP server. It will provide required values that allow the client to configure its network interface, and to download a bootfile.

Note: This guide will assume that your server machine has an IP of 192.168.12.253

Example entry in the dhcpd.conf file:

subnet 192.168.12.0 netmask 255.255.255.0 {
 range 192.168.12.251 192.168.12.252;
 option broadcast-address 192.168.12.255;
 filename "/pxelinux.0";
}

Note2: Make sure to use the subnet, netmask, broadcast-address and the IP range of your test network.

Note2: After changes to dhcpd.conf restart or reload dhcp services.

Setting Up Knoppix Boot files

Now it's time to populate the Samba and TFTP server shares with relevant files.

Start by downloading a KNOPPIX 4.0.2 (or newer) iso

Temporarily mount it (or burn it on a CD)

mount -o loop /iso/KNOPPIX_V5.1.1CD-2007-01-04-EN.iso /mnt/iso

Setup a Knoppix terminal pxeboot subdirectory

mkdir /var/lib/tftpboot/knoppix

Download miniroot.gz from http://knoppix.manty.net and put it in the just created directory

wget http://knoppix.manty.net/files/511/miniroot.gz -O /var/lib/tftpboot/knoppix/miniroot-5.1.1.gz

Copy the kernel from the Knoppix CD to the pxeboot subdirectory

cp /mnt/iso/boot/isolinux/linux /var/lib/tftpboot/knoppix/kernel-5.1.1

Copy the KNOPPIX folder from the KNOPPIX CD to a shared directory on the server

rsync -a --delete /mnt/iso/KNOPPIX/ /shares/knoppix-term-5.1.1/KNOPPIX

Cleanup the temporarily mounted directory

umount /mnt/iso

Configure PXELINUX

PXELINUX is a boot loader which actually loads the Linux/KNOPPIX kernel on the client machines and tell them where to find the root filesystem. Thus we configure PXELINUX with relevant information.

Add the following lines to your /var/lib/tftpboot/pxelinux.cfg/default file:

 LABEL Knoppix 5.1.1 CIFS
 KERNEL knoppix/kernel-5.1.1
 APPEND secure nfsdir=//192.168.12.253/knoppix_share-5.1.1 nodhcp lang=en ramdisk_size=100000 init=/etc/init apm=poweroff nomce vga=791 initrd=miniroot-5.1.1.gz quiet BOOT_IMAGE=knoppix

Note: the above APPEND line must appear as a single line in your pxelinux.cfg/default file

If you would like to have a text-only client terminal, then you can make a copy of the above text in the /var/lib/tftpboot/pxelinux.cfg/default file and just add "2" to the knoppix options:

 LABEL Knoppix 5.1.1 CIFS
 KERNEL knoppix/kernel-5.1.1
 APPEND secure nfsdir=//192.168.12.253/knoppix_share-5.1.1 nodhcp lang=en ramdisk_size=100000 init=/etc/init apm=poweroff nomce vga=791 initrd=miniroot-5.1.1.gz quiet 2 BOOT_IMAGE=knoppix

Configure Client Machines to boot from PXE

This is a crucial step. Unless your machines can actually boot from the network, none of the above is going to be of any use! Unfortunately, each and every BIOS has its own way of being configured for PXE booting and it's not feasible to document any of that here. If you do not have this working, a good start would be to read Dan Kegel's Remote Network Boot via PXE page.

Testing

After all the hard work, it is time to enjoy the fruits of your labor.

  • Connect a PXE enabled test machine to the 192.168.12.0 network
  • power it on
  • wait...
  • enjoy!

Customizing miniroot.gz

The Knoppix Terminal Server script (knoppix-terminalserver) creates a miniroot.gz to be used as the initial ramdisk file to boot up the PXE'd knoppix. Sometimes, it is necessary to modify this miniroot.gz to take into account your own customizations that will be required on the PXE'd knoppix.

If you just need a custom linuxrc, then just put your custom linuxrc script into /usr/share/knoppix-terminalserver/templates/miniroot/ and re-run the knoppix-terminalserver script so that it takes your customized linuxrc. That's it. You can skip reading the rest of this section.

If you need to make deeper changes in the knoppix terminal server miniroot.gz file, however, here's how:

  • Run the knoppix-terminalserver script so that it sets up knoppix terminal server.
  • Copy the miniroot.gz file from /tftpboot/ to some location where it can be edited. I usually choose a different computer for this (Gentoo!)
  • Unzip the miniroot.gz file
gunzip miniroot.gz
  • This will create a miniroot file from the miniroot.gz file.
  • Create a directory to loopback-mount this miniroot file
mkdir /mnt/minirootloop
  • Loopback-mount the unzipped miniroot file as an EXT2 filesystem
mount -o loop,rw -t ext2 miniroot /mnt/minirootloop/
  • This mounts the miniroot file as a loopback device and you can now cd into it if you wish.
cd /mnt/minirootloop
  • Make whatever changes you want in the /mnt/minirootloop/ directory
  • Unmount the /mnt/minirootloop loopback device (remember to cd out of /mnt/minirootloop before unmounting it)
umount /mnt/minirootloop
  • cd into the original directory where the miniroot file exists (where you first gunzipped it)
  • Create the new miniroot.gz file with the changes you made as follows:
dd if=./miniroot bs=9500k count=1 | gzip -9v > miniroot.gz
  • Copy your brand spanking new miniroot.gz into the /tftpboot directory of your knoppix terminal server
  • PXE boot a client computer
  • Watch your new miniroot customizations take effect.
  • Enjoy.


Updating

Updating the Knoppix Terminal server to newer versions of Knoppix is difficult, but theoretically doable. In general, you have to re-do the following steps:

  • repeat the #Samba Share Setup to create a share for storing the new Knoppix disk image
  • re-do the #Setting Up Knoppix Boot files step in new directories
    • this is where it gets hard. There is no updated miniroot available for CIFS network booting. Based on initial investigation, creating an updated miniroot for Knoppix 5.3.1 will be non-trivial. One could start this task by examining the differences between the vanilla 5.1.1 miniroot and the cifs 5.1.1 miniroot as follows:
cp /var/lib/tftpboot/knoppix/miniroot-5.1.1.gz /tmp/
gunzip /tmp/miniroot-5.1.1.gz
mkdir /mnt/cifs-miniroot
mount -o loop /tmp/miniroot-5.1.1 /mnt/cifs-miniroot
mkdir /mnt/knoppix-5.1.1-cd
mount -o loop KNOPPIX_V5.1.1CD-2007-01-04-EN.iso /mnt/knoppix-5.1.1-cd/
mkdir /mnt/vanilla-5.1.1-miniroot
cp /mnt/knoppix-5.1.1-cd/boot/isolinux/minirt.gz /tmp
gunzip /tmp/minirt.gz
mount -o loop /tmp/minirt /mnt/vanilla-5.1.1-miniroot
# remove irrelevant device files
rm -rf /mnt/{vanilla-5.1.1,cifs}-miniroot/dev
diff -qr /mnt/vanilla-5.1.1-miniroot /mnt/cifs-miniroot
diff: /mnt/vanilla-5.1.1-miniroot/bin: No such file or directory
diff: /mnt/cifs-miniroot/bin: No such file or directory
diff: /mnt/vanilla-5.1.1-miniroot/boot: No such file or directory
diff: /mnt/cifs-miniroot/boot: No such file or directory
Only in /mnt/vanilla-5.1.1-miniroot/etc: init
Only in /mnt/cifs-miniroot/etc: inittab.secure
diff: /mnt/vanilla-5.1.1-miniroot/etc/ld.so.conf: No such file or directory
diff: /mnt/cifs-miniroot/etc/ld.so.conf: No such file or directory
Files /mnt/vanilla-5.1.1-miniroot/etc/mtab and /mnt/cifs-miniroot/etc/mtab differ
Only in /mnt/cifs-miniroot/etc: nsswitch.conf
Only in /mnt/cifs-miniroot/etc: rpc
Only in /mnt/cifs-miniroot/etc: services
Only in /mnt/vanilla-5.1.1-miniroot/KNOPPIX: bin
Only in /mnt/vanilla-5.1.1-miniroot/KNOPPIX: boot
Only in /mnt/vanilla-5.1.1-miniroot/KNOPPIX: etc
Only in /mnt/vanilla-5.1.1-miniroot/KNOPPIX: lib
Only in /mnt/vanilla-5.1.1-miniroot/KNOPPIX: opt
Only in /mnt/vanilla-5.1.1-miniroot/KNOPPIX: sbin
Only in /mnt/vanilla-5.1.1-miniroot/KNOPPIX: usr
Only in /mnt/vanilla-5.1.1-miniroot/KNOPPIX: var
diff: /mnt/vanilla-5.1.1-miniroot/lib: No such file or directory
Files /mnt/vanilla-5.1.1-miniroot/linuxrc and /mnt/cifs-miniroot/linuxrc differ
Only in /mnt/vanilla-5.1.1-miniroot/media: fd0
Only in /mnt/vanilla-5.1.1-miniroot/media: hd
Only in /mnt/vanilla-5.1.1-miniroot/media: test
Only in /mnt/vanilla-5.1.1-miniroot/modules: a100u2w.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: advansys.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: aic7xxx.ko
Only in /mnt/cifs-miniroot/modules: aufs.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: BusLogic.ko
Only in /mnt/cifs-miniroot/modules: cloop.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: dc395x.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: dtc.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: eata.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: ehci-hcd.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: fdomain.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: ff-memless.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: gdth.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: ieee1394.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: initio.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: libusual.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: loop.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: mptbase.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: mptscsih.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: NCR53c406a.ko
Only in /mnt/cifs-miniroot/modules: net
Only in /mnt/vanilla-5.1.1-miniroot/modules: ohci1394.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: ohci-hcd.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: pas16.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: psi240i.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: sbp2.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: sym53c8xx.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: t128.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: tmscsim.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: u14-34f.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: uhci-hcd.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: ultrastor.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: usbcore.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: usbhid.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: usb-storage.ko
Only in /mnt/vanilla-5.1.1-miniroot/modules: wd7000.ko
diff: /mnt/vanilla-5.1.1-miniroot/opt: No such file or directory
diff: /mnt/cifs-miniroot/opt: No such file or directory
diff: /mnt/cifs-miniroot/sbin: No such file or directory
Only in /mnt/vanilla-5.1.1-miniroot/static: fusermount
Only in /mnt/cifs-miniroot/static: ifconfig
diff: /mnt/cifs-miniroot/static/init: No such file or directory
Files /mnt/vanilla-5.1.1-miniroot/static/insmod and /mnt/cifs-miniroot/static/insmod differ
Only in /mnt/cifs-miniroot/static: mount
Only in /mnt/cifs-miniroot/static: mount.cifs
Only in /mnt/vanilla-5.1.1-miniroot/static: ntfs-3g
Only in /mnt/cifs-miniroot/static: portmap
Only in /mnt/cifs-miniroot/static: pump
Only in /mnt/vanilla-5.1.1-miniroot/static: rmmod
diff: /mnt/cifs-miniroot/static/sh: No such file or directory
diff: /mnt/vanilla-5.1.1-miniroot/usr: No such file or directory
diff: /mnt/cifs-miniroot/usr: No such file or directory
Only in /mnt/cifs-miniroot: var

References