How to create a custom thin client Knoppix boot CD with the Citrix ICA client

I was asked to create a bootable CD which would allow a few PCs in a special purpose lab to access our Citrix environment.

A few months ago I was asked to create a bootable CD which would allow a few PCs in a special purpose lab to access our Citrix environment. The hard drives in these particular PCs had failed, but were in working condition otherwise. We had talked about experimenting with thin clients, so this was a good opportunity to test the concept without actually purchasing real thin client hardware.

Our Citrix applications are delivered through our Web Portal, so all the bootable CD really needed was a web browser and the Citrix ICA client, although a few productivity packages wouldn't hurt! For this project I decided to use Knoppix. Knoppix is probably the most popular Live Linux CD at this time and rightly so; Knoppix works on all sorts of hardware, it includes everything you need to get going (in most cases), and is freely distributed. Of course due to licensing restrictions, the Citrix ICA client cannot be included with the default Knoppix distribution. However, through a process known as remastering, you can create your own custom Knoppix CD that includes the Citrix ICA client.

Knoppix is based off of Debian GNU/Linux. Debian’s package manager, APT (Advanced Packaging Tool), makes adding and removing packages for your custom Knoppix CD a simple task.  Software that is not prepackaged for Debian, such as the Citrix ICA client, can be installed with relative ease.

The following instructions are based on those found at the ‘Knoppix Remastering Howto.’  I have tried to streamline the process and have added information on installing the Citrix ICA client and customizing the user preferences. I have also created a few scripts to help automate the remastering process: one to setup the remastering directories and copy the required files, one to remove packages, and another to create the compress file system and ISO image. A compressed file containing all the scripts, as well as a safe list of packages to remove can be found at the link preceding the article. I would recommend running through the process manually a few times before using the scripts in order to get an understanding of the process. I have tested this process using Knoppix 3.8 through 4.02, but it should work on other versions as well.

To complete the process, you'll need a machine with approximately 4GB of free space on an EXT2 or EXT3 formatted partition and a connection to the Internet. I do all of my remastering from within VMware. I have a virtual machine with a minimal Red Hat installation that provides the EXT3 partition. VMware also makes it easy to test the custom Knoppix ISOs without burning them to a CD.  

Initial Setup

1. Boot from the Knoppix Live CD.

2. Open a root shell from the “K” menu:
K > KNOPPIX > Root Shell

3. Verify the network configuration.  By default, Knoppix uses DHCP to configure the network interface.
$ ifconfig
$ ping www.citrix.com

4. Use ‘fdisk’ to list the hard disk partitions.  For the purposes of this document I will use the partition /dev/sda1.
$ fdisk -l
Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device   Boot    Start      End      Blocks       Id    System
/dev/sda1   *         1      1498    12032653+  83      Linux
/dev/sda2          1499     1566      546210      5    Extended
/dev/sda5          1499     1566      546178+   82  Linux swap

5. Mount the partition
$ mount -rw /dev/sda1 /mnt/sda1

6. Create a work directory for Knoppix remastering process.
$ mkdir /mnt/sda1/knoppix.work

7. Create a swapfile.  (The swapfile is required when compressing the Knoppix image.)
$ cd /mnt/sda1/knoppix.work
$ dd if=/dev/zero of=swapfile bs=1M count=1024
$ mkswap swapfile
$ swapon swapfile

8. Make a source and master directory.  The source directory will be used to modify the Knoppix distribution files.  The master directory is where the Knoppix compressed file system image will be written to, and it will ultimately be used to create the bootable ISO image.
$ mkdir -p /mnt/sda1/knoppix.work/source/KNOPPIX
$ mkdir -p /mnt/sda1/knoppix.work/master/KNOPPIX

9. Copy the Knoppix file system to the source directory.
$ cp -Rpv /KNOPPIX/* /mnt/sda1/knoppix.work/source/KNOPPIX

10. Copy boot files to master directory.
$ cp -arv /cdrom/boot /mnt/sda1/knoppix.work/master/boot

11. (Optional)  Copy the default HTML page.  This is the Knoppix information page loaded at startup.
$ cp /cdrom/index.html /mnt/sda1/knoppix.work/master

12. Copy required files from /cdrom to the master directory. This copies everything but the compressed KNOPPIX file (the compressed file system).
$ cd /cdrom
$ find . -size -10000k -type f -exec cp -pv --parents '{}' \
/mnt/sda1/knoppix.work/master/ \;

13. Copy resolv.conf to the source directory.  (This is done to enable DNS resolution while working in the chrooted environment.)
$ cp /etc/dhcpc/resolv.conf \ /mnt/sda1/knoppix.work/source/KNOPPIX/etc/dhcpc/resolv.conf

14. Change root to the source/KNOPPIX directory.  This is the root of the file system that will be on the CD.  All changes that are made in the chrooted environment will be written to the compress KNOPPIX file. 
$ chroot /mnt/sda1/knoppix.work/source/KNOPPIX

Chrooted environment

1. Mount /proc.  This is required for networking support.  (The warning, "warning: can't open /etc/fstab: No such file or directory", is normal)
$ mount -t proc /proc proc

2. Test the network connectivity.
$ ping www.citrix.com

3. Update the package repository list.
$ apt-get update

4. Remove packages as needed.  For each package you plan on adding, you will need to remove another package to free up some space.  Take a look at the ‘remove.packages.txt’ file in the accompanying download for an example of packages to remove.

a. List the packages currently installed:
$ dpkg-query -l

b. Send a list of installed packages to a file:
$ dpkg-query -l | awk ‘{print $2}’ > /tmp/packages.txt

c. Remove individual packages:
$ apt-get remove --purge <package>

d. Remove a list of packages:
$ dpkg –P `cat /tmp/packages.txt`

Or, use the perl script included in the download:
$ perl remove_packages.pl /tmp/packages.txt

5. Remove orphaned packages.  These are packages that are no longer needed because there are no packages that are dependant on them.

a. List orphaned packages:
$ deborphan

b. Remove them all at once:
$ deborphan | xargs apt-get -y remove --purge

6. Install new packages

a. Install libmotif3 (needed for the ICA client)
$ apt-get install libmotif3

b. Search for packages by keyword:
$ apt-cache search <term>

c. Install individual packages:
$ apt-get install <package>

7. Clean up
$ apt-get clean

8. Install the Citrix ICA client

a. Download the Citrix ICA client for Linux from www.citrix.com and place it in /tmp.  (I usually download it to my FTP server so I can access it easily from the chrooted environment)

b. Change to the /tmp directory. (I like to work out of /tmp so I can just delete the files in there before creating the final image.)
$ cd /tmp

c. Extract Citrix ICA client:
$ tar xvzf linuxx86.tar.gz

d. Run ICA client installation script.  The defaults are fine, but be sure to select “yes” when prompted to integrate ICA client with the web browser.
$ ./setupwfc

9.  (Optional) If you have SSL certificates for your Citrix servers you will want to copy the certificates to /usr/lib/ICAClient/keystore/cacerts/.  (I found that I needed to rename *.cer to *.crt for the certificates to be recognized by the ICA client.)

10. Test the applications from within the chrooted environment. 

a. Set the display to that of the local X server.
$ export DISPLAY=localhost:0.0

b. You can then launch applications from the command line.  For example use the following command to launch Firefox (The ‘&’ tells the system to run Firefox in the background.  If you omit the ‘&’ the terminal will be ‘locked’ until Firefox is closed)
$ firefox &

11. When you have finished testing the applications unmout /proc.
$ umount /proc

12. Exit the chrooted environment pressing ‘ctrl + D’.

Customize the user settings (Optional)

1. Configure the user settings to your liking.  (Add/Remove desktop icons, modify the K menu, customize Firefox’s settings, printers, etc.)

2. Save the user settings by running the following command.  This will give you the option to save the user preferences to a floppy drive or the hard drive.  This will create a file, configs.tbz, containing the user preferences and a script, knoppix.sh, which is used to restore the preferences.
$ /usr/sbin/saveconfig

3. Copy configs.tbz and knoppix.sh to /mnt/sda1/knoppix.work/master/KNOPPIX/.  The knoppix.sh script will be launched during boot to restore the user preferences.

4. Copy a custom desktop background image to /mnt/sda1/knoppix.work/master/KNOPPIX/background.jpg.

5. Remove default HTML files, this will prevent the Konqueror web browser from being launched at startup.
$ rm -fv /mnt/sda1/knoppix.work/master/KNOPPIX/index*.html
$ rm -fv /mnt/sda1/knoppix.work/master/index*.html

Create compressed Knoppix file system and ISO image

1. Clean up /tmp within the source directory and remove any other files that you do not want on the CD.
$ rm -rfv /mnt/sda1/knoppix.work/source/KNOPPIX/tmp/*

2. Create the compressed file system image
$ mkisofs -R -U -V "KNOPPIX" -publisher "KNOPPIX” \
-hide-rr-moved -cache-inodes -no bak \
-pad /mnt/sda1/knoppix.work/source/KNOPPIX \
| nice -5 /usr/bin/create_compressed_fs \
- 65536 /mnt/sda1/knoppix.work/master/KNOPPIX/KNOPPIX

3. Update MD5 hashes (used for integrity checking)
$ cd /mnt/sda1/knoppix.work/master
$ find -type f -not -name md5sums -not -name boot.cat \
-not -name isolinux.bin \
-exec md5sum '{}' \; > KNOPPIX/md5sums

4. Create ISO (in this example the ISO file is written to /mnt/sda1/knoppix.work/knoppix.iso)
$ mkisofs -pad -l -r -J -v -V "KNOPPIX" -no-emul-boot \
-boot-load-size 4 -boot-info-table \
-b boot/isolinux/isolinux.bin \
-c boot/isolinux/boot.cat -hide-rr-moved \
-o /mnt/sda1/knoppix.work/knoppix.iso \ /mnt/sda1/knoppix.work/master

5. Test your new ISO image

Conclusion

I have just touched on the basics of customizing a Knoppix CD. If you use the PNAgent, you could save the PNAgent settings to the CD and launch the PNAgent at startup. You could also lock down the Knoppix CD so the only user accessible application is a web browser or the PNAgent--sort of a “kiosk” mode. If you have multiple PCs that support booting from the network, you could experiment with Knoppix’s built-in terminal server.  You boot one system from the CD and configure it as a terminal server, the other PCs then network boot from the terminal server. There are many different possibilities and the underlying system is very flexible.

So far the custom Knoppix CDs have worked out well for us. So well in fact that the lab manager has created several copies of the CD and runs it on almost all the PCs in the lab (including the PCs with good hard drives). He no longer has to worry about patching the local PC’s operating system or the applications. A custom Knoppix CD may not be a replacement for real thin client hardware, but in a small environment (or test environment), it can be used to bring aging PCs back to life as thin clients.

References

Knoppix Remastering Howto: http://www.knoppix.net/wiki/Knoppix_Remastering_Howto


knoppix_scripts.zip

Join the conversation

4 comments

Send me notifications when other members comment.

Please create a username to comment.

Very interesting. Give me to want to test this method.

Thanks
Cancel
http:
DC
Cancel

There are a lot auf bugs in the scripts and you need more information about the preconfig of knoppix. So you have to make write-access on harddisk configured on properties on harddisk. this is needed by copy of knoppix-files.

To compress file-image you have to do this one:

mkisofs -R -U -V "KNOPPIX" --publisher "KNOPPIX” \
-hide-rr-moved -cache-inodes -no-bak \
-pad /mnt/sda1/knoppix.work/source/KNOPPIX \
| nice -5 /usr/bin/create_compressed_fs \
- 65536 > /mnt/sda1/knoppix.work/master/KNOPPIX/KNOPPIX

Cancel

I have some small hard drives, like 400 meg drives, could I adapt your Custom Thin Client Knoppix Citrix ISO to a Hard Drive (sda1) instead?

J.

Cancel

-ADS BY GOOGLE

SearchVirtualDesktop

SearchEnterpriseDesktop

SearchServerVirtualization

SearchVMware

Close