Q: What is Thinux?
A: Thinux is a thin client system that resides on a Red Hat Linux server.
When a thin client requests to boot on LAN, the server will upload the
thin client linux system to the thin client. Ideal for lightweight
devices such as Point-of-Sales terminals, embedded devices, etc.
Q: What are the requirements?
A: DHCP server, PXE server, PXE client (i.e. motherboard + BIOS to support it)
on separate machines. Depending on which version Thinux was tested on, it
should work with Red Hat Linux servers. It was originally developed on a
Red Hat Linux 7.2 operating system. The PXE image was taken from syslinux
package from Red Hat Linux 9.0. Thinux was compiled with Red Hat Linux
package releases which are accessible and portable so they can be easily be
customised.
Q: How come Thinux does not load up?
A: Please understand the requirements and booting sequence of Thinux.
To understand it, the following checklist may give some clues to the point
of failure.
- PXE environment requires DHCP to give network information for the PXE
client. Start DHCP server on one machine:
e.g. /sbin/service dhcpd restart
- PXE environment also needs a PXE boot server to act as a bootloader
to load the kernel (register detected hardware, etc.) and the ramdisk
(root file system, kernel modules, programs, etc.) file. To distribute
these images to the PXE client, the TFTP service will be required.
Start PXE server on another machine:
e.g.
/sbin/service pxe restart
/sbin/chkconfig tftp on
/sbin/service xinetd restart
- Install Thinux on the PXE server: e.g. /bin/rpm -ivh thinux*.rpm
It will backup the existing TFTP linux-install directory and install
the PXE Linux bootloader image, its configuration, the Red Hat
Linux 7.2 kernel and the pre-packaged ramdisk image with SSH and X Windows
system support. The installation will also install a sample network service
to test networked windows system. To start its service:
e.g. /sbin/service thinuxd restart
- Reconfigure PXE client on another machine at BIOS with network boot
e.g. "Boot on LAN". Then save and exit.
- If the PXE client has detected the DHCP server, the PXE server, it will
load the Linux bootloader image. It should give you 2 options: Local;
Remote Install. Choose Remote Install.
- The PXE client should now request for the TFTP service to download
the kernel and the ramdisk image to its memory. It should load the
default configuration file of the PXE Linux bootloader which
overrides the kernel ramdisk size.
- Once the kernel and ramdisk have been loaded, one of the last thing
it does before mounting the root file system to the ram is decompressing
the ramdisk. Two things to check here:
1. The ramdisk size given by the PXE Linux bootloader has to be big enough to
store the ramdisk image but no larger than the actual ram size.
2. Make sure after the ramdisk image has been decompressed,
it will still fit the assigned ramdisk size.
- It will now attempt to mount the root filesystem. If it fails, please
check the error message. There are several ways which the root filesystem
will fail to mount:
Kernel should point to the right device to mount the root filesystem.
e.g. /usr/sbin/rdev vmlinuz
Ramdisk should be big enough to store the root filesystem, etc.
Ramdisk size assigned by the PXE Linux bootloader default configuration
should be large enough to store the decompressed ramdisk image but
no larger than the actual ram size.
- After the ramdisk has been mounted, the kernel code should now call
linuxrc from "/". It should be pointed to /sbin/init and /sbin/init should
be pointed to /bin/bash.
- /bin/bash should look for a file from ~/.bashrc and executes it.
It should call /etc/rc.d/rc.local to perform the following:
Mount the /proc filesystem: /bin/mount -t proc /proc /proc
Install the kernel module to support your network card:
e.g.
/sbin/insmod /lib/modules/2.4.7-10/kernel/drivers/net/e100.o
Set up the network: e.g. /sbin/ifconfig eth0 192.168.0.33
Run the SSH server: e.g. /usr/sbin/sshd -f /etc/ssh/sshd_config
Run the telnet server: e.g. /usr/sbin/in.telnetd -debug 23
Configure X Windows server:
e.g. /usr/X11R6/bin/X -configure; /bin/mv ./XF86Config.new /etc/X11
Start the X font server required by X Windows:
e.g. /usr/X11R6/bin/xfs -droppriv -daemon -configure /etc/X11/fs/config
Start X Windows and it will spawn an xterm X client.
- Once you see the graphical X Windows terminal with the bash prompt,
the Thinux has successfully booted. Now load the sample network windows
system on the PXE server:
/usr/bin/ssh -l thinux 192.168.0.123 "cd /opt/thinux/html/thinux;/usr/bin/appletviewer thinux.html"
Q: How do I customise Thinux?
A: Determine the requirements and test each of them with the following
guidelines.
- Mount the ramdisk image:
e.g. /bin/mount -o loop /tftpboot/X86PC/UNDI/linux-install/initrd.img /mnt/cdrom
- Configure /etc/rc.d/rc.local to customise your startup sequence.
e.g. NFS network file sharing mount, disable X Windows, etc.
- Install necessary executables, libraries and configuration files.
To find required library files: e.g. /usr/bin/ldd /usr/sbin/sshd
Run the required service on a fully installed Red Hat Linux server.
e.g.
/usr/sbin/lsof /usr/sbin/sshd
/usr/sbin/lsof -p <process_id_of_sshd>
It should tell you the files it uses at that point in time.
- If the disk runs out of space, read the /opt/thinux/src/thinux.bash script
and see how it formats the disk image using block counts in "/bin/dd".
Also increase the ramdisk size if necessary with the line
"append ramdisk_size=" in
/tftpboot/X86PC/UNDI/linux-install/pxelinux.cfg/default
- Unmount the ramdisk image: e.g. /bin/umount /mnt/cdrom
- Reboot the PXE client to test the ramdisk
- Execute the required service: e.g. /usr/sbin/sshd for SSH server
The errors usually state that some library files have been missing.
Have good knowledge of the requirements of the service e.g. SSH
requires PAM modules e.g. /lib/security/libpam_env.so to authenticate
user logins.
Install those libraries stated from the Red Hat Linux 7.2 distribution.
- The missing library files stated are usually soft links to
an actual library file. e.g. /bin/ls -alrt /lib/libpam.so.0
/bin/mkdir -p ${ROOTPATH}/usr/sbin
/bin/cp -a /usr/sbin/sshd ${ROOTPATH}/usr/sbin
/bin/cp -a /lib/libpam.so.0.75 ${ROOTPATH}/lib
/bin/ln -s /lib/libpam.so.0.75 ${ROOTPATH}/lib/libpam.so.0
- If error occurs without any feedback information, you can use strace to
give you some pointers to the point of failure.
/usr/bin/strace /usr/sbin/sshd 2>errors &
/bin/cat errors
- strace may show that it fails to find certain files. e.g. configuration
/bin/mkdir -p ${ROOTPATH}/etc/ssh
/bin/cp -a /etc/ssh/sshd_config ${ROOTPATH}/etc/ssh
/bin/cp -a /dev/urandom ${ROOTPATH}/dev/urandom
- If it has the service has log files, it may provide insights as to
why it failed to serve the service. e.g. /bin/cat /var/log/XFree86.0.log
- Path for binary shortcuts should be set so full path is not needed:
e.g. PATH=${PATH}:/usr/X11R6/bin
- Library paths should also be set so the executables can call its libraries:
e.g.
/bin/echo "/usr/X11R6/lib" >> /etc/ld.so.conf
/sbin/ldconfig