Running X from Red Hat
for Display on Debian Thin Client
OVERVIEW
When I started this weekend I had an old clunky '94 486. It's only redeeming features were its PCI slots and the high 133 MHz clock rating. I would have gladly handed it over to the first one to ask.
My only spare drive was small, slow and loud. Incredibly this project has transformed it into a very enjoyable machine with reasonable speed, many times more useful than before.
This document will cover the steps required to use an old (slow) computer to display `X' (Graphical Interface) while utilizing an existing fast system for processing as well as to provide the file system (NFS mounted) for the slower computer. This is a great way to get some mileage from an old computer. This is not a new idea, in fact most of my work was derived from two main sources as well as the Linux Terminal Project (www.linuxterminal.org) The main flow comes from "Making an X Terminal from a PC" by Patrick Swieskowski
(http://linuxgazette.com/issue68/swieskowski.html) and an extension paper by Dr. Alan W. Irwin
(ftp://astroftp.phys.uvic.ca/pub/irwin/X-terminal/X-terminal.mem). You may also want to visit the Linux Terminal Server Project (http://www.ltsp.org).
The machines in this example are behind a very restrictive firewall. Do not use X over any untrusted network , like the Internet, unless it is tunneled inside something like SSH. Every user and every machine on the network must be fully trusted as non-encrypted X transmissions are available to anyone.
This document will attempt to provide a complete process for using a Red Hat Linux system as the main server, Debian as the embedded system and an old 486 as the target display. The fast system is called Nova, and the old one is Bandit.
Nova: AMD 650 MHz, 448 MB ram, ATA100 drive, 100 Mb ethernet, running Red Hat 7.1 kernel 2.4.2-2 with KDE-2 as the desktop environment. IP 192.168.1.50
Bandit: 486 with an AMD 133 MHz overdrive chip, floppy drive, 10 Mb ethernet connection. The machine was unusable with any kind of GUI when running a locally installed OS. At the beginning of the project it had 72 MB ram and a 10 Mb ethernet connection, but it doesn't need that much ram and I found a half duplex 100 Mb card, so as we move along we will update the card. IP 192.168.1.18 and the MAC (hardware address) 00:a0:cc:5c:3c:a0 which you will need later. There is no hard drive or CD-ROM required/desired.
Bandit was a functioning dumb terminal server I was fiddling with so I knew that the display, serial and ethernet worked. You should test the system prior to this project because you are sure to run into problems, knowing the hardware is functional is very important for your sanity.
I will refer to the systems by name throughout this paper so remember Nova is fast and Bandit is the X-Terminal display. You will need to use your own system names, IP's, MAC addresses and directory choices.
Fast Start
Here are the basic steps that we will need to do:
- Create a directory on nova called /usr/xterminal (to install / file system)
- Download and unpack Debian into /usr/xterminal
- Copy /etc/resolv.conf and /etc/hosts to /usr/xterminal/etc/
- Edit hosts and new fstab files in /usr/xterminal/etc/
- chroot into /usr/xterminal and d/l, install and configure Xfree86
- Download a kernel of your choice to use to boot Bandit
- Compile the kernel, copy the image to a boot disk
- Tell the boot disk to boot over NFS
- Set up DHCP, NFS, XDM on Nova. (several files to tweak, see below)
- Start XDM, DHCP and NFS on Nova
- Boot Bandit and test logon, then X after the console and network are all ok
- Put XDM into inittab in /etc on Nova
What could possibly go wrong :-O
Communication Sequence
- Bandit boots from floppy which broadcasts for an IP address (DHCP sequence...)
- Nova sends Bandit DHCP info including location of Bandits root file system.
- Bandit sends out a request to mount nova:/usr/xterminal, Nova acknowledges.
- Bandit now runs from Debian inside Red Hat on Nova via the NFS mounted root file system.
- Bandit starts an X display which is served from Nova, and has its client side server running from the NFS mount on Nova.
My terminology of X Servers and Clients is probably not technically correct, but the environment/apps/login etc are run under Red Hat and the part that deals with displaying and interacting runs from within the Debian root (on Nova).
Detailed Install
Installation Section 1
Debian Root FS Install:
- get hardware information on Bandit including NIC, MAC Address, video card specs, monitor specs, mouse and com port. This should be a basic machine, no sound or hard drives etc.
- log into Nova and become root "su \"
- create a directory to house the terminals root file system "cd /usr;mkdir xterminal"
- quit root (paranoia is good)
- download the Debian base install. (mine was base2_2.tgz). I used:
http://http.us.debian.org/debian/dists/stable/main/disks-i386/current/
- become root "su -"
- edit hosts file to include bandit, if necessary.
- cd to /usr/xterminal
- move base2_2.tgz into /usr/xterminal and then unpack. "tar xzvf base2_2.tgz"
- copy resolv.conf and hosts files "cp /etc/resolv.conf /etc/hosts ./etc/"
- check if /etc/xterminal/etc/hosts lists a machine name for 127.0.0.1
if "127.0.0.1 localhost.localdomain localhost" it's ok.
but if "127.0.0.1 localhost.localdomain nova" then CHANGE IT !
change to "127.0.0.1 localhost.localdomain bandit"
- create a fstab file "vi ./etc/fstab" and add two lines:
192.168.1.50:/usr/xterminal /nfs defaults 0 0
proc /proc proc defaults 0 0
- create a hostname file on Bandit by doing this:
echo bandit >/usr/xterminal/etc/hostname
- you can add entries to /etc/hosts.allow & /etc/hosts.deny for added security:
hosts.deny file:
ALL: ALL
hosts.allow file:
ALL: 192.168.1.0/255.255.255.0
- make /usr/xterminal root file system "chroot /usr/xterminal bash \login"
- use Debian utilities to get and install:
updates with: "apt-get update"
then XFree86 with: "apt-get install xserver-svga xfonts-100dpi xfonts-base"
*find your video driver name at (link may wrap the line in this doc)
http://packages.debian.org/cgi-bin/search_packages.pl?keywords=xserver&searchon=names&subword=1&version=stable&release=all
- X will bring up a configuration script. Enter information matching Bandit. Do not probe the video and at the end, do NOT test the
configuration (last option).
- check for and if present remove the file /sbin/unconfigured.sh
- exit from the chroot (root jail) "exit" (leaving you as root on Nova).
- quit root "exit", you are back to a regular user.
Installation Section 2
Create the Bootable Floppy Disk
- download a new kernel to compile for the diskless station (Bandit). I am using
linux-2.4.4.tar.gz
(first run failed on 2.2.19 but it turns out it was compiled wrong).
go to ftp://www.kernel.org/pub/linux/kernel/
- become root "su -"
- go to /usr/xterminal/usr/src, move the new kernel there
- extract "tar xzvf linux-2.4.4.tar.gz" (it will create /usr/xterminal/usr/src/linux)
- I always link it to make experiments easier to work with. Two steps:
- move the linux src "mv linux linux-2.4.4"
- link to it"ln -s ./linux-2.4.4 linux"
- enter the linux dir and compile a new kernel. This is the part that I had some problems with as far as what I needed and what I didn't. I may have ended up with a few extras so you may want to experiment a bit.
The basic compiling consists of three steps, only the first requires user input. If you need more information on compiling, I have a page that's lacking in details but will help you walk thru the steps (http://nesbitt.yi.org/rhat/kernel.shtml). Also, Linux Documentation Project (http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html) is a great start for any info on Linux.
- Here are a few of the options I included in the kernel:
- NO experimental options
- NO module support
- dhcp
- bootp, but probably not needed
- nfs support (not server)
- nfs based root file system
- ramdisk, not sure if needed
- network card to match Bandit
- IP Multicast, don't see why but I included it (broadcast should be fine)
- kernel level autoconfig
- automounter, again probably not needed
- the basic sequence is "make config;make dep;make bzImage"
- copy the new image to a floppy disk "dd if=arch/i386/boot/bzImage of=/dev/fd0"
- you must still be in "/usr/xterminal/usr/src/linux" as root.
- the next steps tell the boot disk it will boot over NFS:
- create a temporary device "mknod /dev/boot255 c 0 255"
- apply it to the disk "rdev /dev/fd0 /dev/boot255"
- remove the temp device "rm /dev/boot255"
- you can take the new boot disk out. It is ready to boot Bandit.
Installation Section 3
Setting up the Server and X Services
- this is done as root "su -"
- DHCP server:
- check if it is installed "chkconfig --list|grep dhcp", install the dhcpd server via Red Hat RPM if needed.
- create the lease holding file "touch /var/lib/dhcp/dhcpd.leases"
(see notes below under Section 6, Tips and Tricks)
- create or edit /etc/dhcpd.conf to read:
- run dhcp startup script "/etc/init.d/dhcpd start"
if it does not indicate "OK" then try "/usr/sbin/dhcpd" to see error messages.
- NFS server:
- check if it's installed "chkconfig --list|grep nfs", install the nfs server via Red Hat RPM if needed.
- create or edit /etc/exports to include the line:
"/usr/xterminal 192.168.1.18(rw,no_root_squash)" (no quotes)
- run nfs startup script "/etc/init.d/nfs start"
- if it does not indicate "OK"
then try "/usr/sbin/exportfs" to see error messages (see the man exportfs for simple arguments).
- XDM service:
- Red Hat 7.1 was using a version of Display Manager other than XDM that seemed to be set to local host only or something, I couldn't get a
login screen anyway. I changed it for the XFree86 XDM. You should find it at "/usr/bin/X11/xdm".
- edit the file /etc/X11/xdm/Xaccess. Here is a wide open sample, the only uncommented line in the file is:
* #any host can get a login window
- with no X sessions running, start XDM "xdm". That should display a logon screen on Nova's monitor on console 7 (alt - F7). Use ctrl-alt-F1 to return to the console.
Installation Section 4
Finally Booting Bandit
- boot Bandit with the boot disk made earlier. Watch for errors.
- login to Bandit as root (no password, so run "passwd" to set one!)
- check network with ifconfig. Try pinging an outside URL.
- run "X -probeonly" checks video and posts any errors encountered.
- log into Nova's X server run "X -query 192.168.1.50"
- if you have display problems use "ctrl-alt-BACKSPACE" to exit.
- you will want to use a non-root acct existing on Nova
- that should put you at a KDE desktop and ready to work.
- after exiting KDE, use "ctrl-alt-BACKSPACE" to kill get a prompt back.
Installation Section 5
Final Touches
- add dhcp, and nfs to startup scripts
"chkconfig --level 345 dhcpd on"
"chkconfig --level 345 nfs on"
- add entry into inittab for XDM startup
I am not using one, but just append the file to be something like this:
x:5:respawn:/usr/X11R6/bin/xdm
- After everything was working, I decided to try a 10/100 Tulip ethernet card.
- I installed the 10/100 card and tried booting, although it failed I was able to confirm the MAC address from info on the screen. I edited /etc/dhcp.conf.
- Then I found that there was kernel support for it after tracking down the chip set, I ran "grep -i tulip /usr/xterminal/usr/src/linux/drivers/net/tulip"
- I just quickly recompiled to remove my NE2000 and add the Tulip card.
- after building and boot with the new boot disk, it all worked again.
- To set Bandit to get an X login at boot-up, add this line to the end of /usr/xterminal/etc/inittab:
X:123456:respawn:/usr/bin/X11/X -query 192.168.1.50
then run "telinit q" to force a re-read of the inittab file.
- reboot Bandit with the floppy, in a minute you should be prompted to log into X.
That should be it. Enjoy!
Other Considerations and Options
- services can be on different systems (root fs, Xserver, dhcp)
- multiple X servers within Bandit (debian) for user/terminal scripts.
- with a 10 Mb connection I was not too happy with the performance.
- use a bootable NIC to eliminate the need for a floppy. Truly Thin!
- this would be a breeze for a small army of identical X-Terminal PCs.
Tips and Tricks
- used deep laptop (see note under DHCP above) as my test to get dhcp running, eliminating some unknowns as all error messages at boot seem to be based around problems with NFS.
- don't confuse dhcpcd and dhcpd files (c in dhcpcd is the client not the server)
- you must create a file "/var/lib/dhcp/dhcpd.leases", but the documents I used indicated a "/var/state/dhcp/dhcpd.leases".
- I had to add an alias for the default mouse "ln -s /dev/ttyS0 /dev/mouse".
- I compiles a few different kernels before I got the right combination.It is best to thin the kernel down as much as possible as it really doesn't do much more than I/O network and video support.
Next Step
XDM communicates using UDP for it's transport layer, that is why it is a problem sending it over SSH,
although separate applications and windows can be tunneled inside SSH for a secure connection. Anyway, UDP would lend itself to sending streaming audio to the X-terminal PC.
That may make a good next step project, learn about redirecting audio I/O.
original document created by Pete Nesbitt, August 2001