HOWTO_Diskless_X_terminal_with_read-only_root
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
Introduction
This HOWTO will show you how to make a diskless X terminal with splash and sound on a read-only root
It is intended for people who know a minimum about diskless boot and Gentoo
The steps will be as following :
- Install a few services on the server : dhcp, tftp, nfs and xdm
- Install the diskless in a directory of the server
Some notations :
- The diskless will be called : diskless
- The server : server
- The diskless will be installed in /diskless_gentoo on the server
The configurations given are just examples, you will have to modify them to fit your needs
Requirements
- The server must be powerful enought to run the applications of the diskless
- The diskless can have a very bad cpu , but it should have as much RAM as possible, because X uses a lot of ram
- The diskless must also have a PXE network card. If you don't have that , you will have to use a floppy to make your network card work in pxe
Server configuration
dhcp
First we install the dhcp server :
emerge dhcp
Then we configure it :
| File: /etc/dhcp/dhcpd.conf |
# Configuration file for ISCD dhcpd
ddns-update-style none;
default-lease-time 86400;
max-lease-time 604800;
use-host-decl-names on;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.90 192.168.0.99;
option domain-name "domain";
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.254;
option domain-name-servers 192.168.0.5;
}
group {
next-server server;
option root-path "server:/diskless_gentoo";
filename "/pxelinux.0";
host diskless1 {
hardware ethernet 00:01:02:03:04:05;
fixed-address diskless1.domain;
}
host diskless2 {
hardware ethernet 00:01:02:03:04:06;
fixed-address 192.168.0.101;
}
}
|
Note: You set a permanent ip address for every diskless terminal in fixed-address field, so you actually do not need the range command. It may be necessary only if you have also another computers in your net.
Note2: Actually the fixed-address must be set to ip address (or resolvable dns name), which is outside the above defined range. This is because the range command defines dynamic address' pool, and fixed-address is... fixed (not dynamic). :-)
If you used dns names, they must be known for your server's resolver. I.e. you may add them to your /etc/hosts:
| File: /etc/hosts |
192.168.0.100 diskless1.domain diskless1 192.168.0.101 diskless2.domain diskless2 |
And finally we start it :
rc-update add dhcp default /etc/init.d/dhcp start
tftp
Installation :
emerge atftp
Configuration :
| File: /etc/conf.d/atftp |
# Config file for tftp server TFTPD_ROOT="/diskless_gentoo/boot" TFTPD_OPTS="--daemon --user nobody --group nobody" |
Start :
rc-update add atftp default /etc/init.d/atftp start
nfs
Installation :
emerge nfs-utils
Configuration :
| File: /etc/exports |
/diskless_gentoo diskless.domain(ro,sync,no_root_squash) |
Start :
rc-update add nfs default /etc/init.d/nfs start
xorg
Installation :
emerge xorg-x11 emerge xdm
(it is no longer included in xorg and must be emerged separately)
Configuration :
Edit /etc/X11/xdm/Xaccess to add this line at the end to enable the diskless to login on xdm:
| File: /etc/X11/xdm/Xaccess |
diskless1.domain diskless2.domain # or ip address: 192.168.0.101 # wildcards are allowed: diskless*.domain |
Edit /etc/X11/xdm/Xservers to comment the last line (or xdm will start a X server on the server) :
| File: /etc/X11/xdm/Xservers |
#:0 local /usr/bin/X |
Edit /etc/X11/xdm/Xsetup_0 to comment the last line (prevents xdm from adding a console to the xdm login screen)
| File: /etc/X11/xdm/Xsetup_0 |
# xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail |
Edit /etc/X11/xdm/xdm-config to comment the last line
| File: /etc/X11/xdm/xdm-config |
! SECURITY: do not listen for XDMCP or Chooser requests ! Comment out this line if you want to manage X terminals with xdm !DisplayManager.requestPort: 0 |
Start xdm:
rc-update add xdm default /etc/init.d/xdm start
If you use gdm as desktop manager start gdmsetup and go the tab "Security" Make sure 'Enable XDMCP' is checked.
xfs
If you want you may use xfs to provide fonts to the diskless teminal:
emerge xfs
Edit /etc/X11/fs/config and comment the following line:
| File: /etc/X11/fs/config |
#no-listen = tcp |
Edit /etc/conf.d/xfs:
| File: /etc/conf.d/xfs |
XFS_PORT="7100" |
Start :
rc-update add xfs default /etc/init.d/xfs start
The server is now ready
Diskless installation
Now we will install the diskless and prepare it to run on read only
It looks a lot like a normal installation , with a few skipped steps
Base System
Preparation of the directory
mkdir /diskless_gentoo cd /diskless_gentoo
Stage3 tarball
wget ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/releases/x86/2005.1-r1/stages/i686/stage3-i686-2005.1-r1.tar.bz2 tar -xjf stage3*.tar.bz2 rm stage3*.tar.bz2
Portage tree
We actually already have portage on our server in /usr/portage, so we need only to bind it to /diskless_gentoo/usr/portage.
emerge --sync mkdir -p /diskless_gentoo/usr/portage mount --bind /usr/portage /diskless_root/usr/portage
We edit /diskless_gentoo/etc/make.conf to change the usual stuffs
| File: /diskless_gentoo/etc/make.conf |
# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example
CFLAGS="-Os -march=pentium2 -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
USE="-apm -arts -berkdb -curl -directfb -eds -fortran -gdbm -gif -gnome -gpm -gstreamer -gtk -gtk2 -ipv6 -java -kde -motif -mysql -nls -pam -perl -python -qt -samba -sdl -spell -tcltk -tcpd -usb -xml2"
USE="${USE} alsa font-server network nodrm nomotif nptl oggvorbis openal opengl oss threads"
GENTOO_MIRRORS="ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo"
|
If your /etc and /diskless_gentoo are within the same filesystem, you may consider invoking one or both of the following commands:
rm /diskless_gentoo/etc/hosts; ln /etc/hosts /diskless_gentoo/etc ln /etc/resolv.conf /diskless_gentoo/etc
Note: Hard links are necessary - soft links will not work with nfs! This way you will always have the same resolver configuration on the server and on the diskless client. I.e. whenever you edit your server's /etc/hosts, your client's config will be also updated automagically. Later you may consider also similar "wrapping" of other configuration files. Please be careful!
And we continue with the usual
mount -t proc none proc # if you omitted above mentioned hard linking: cp /etc/resolv.conf etc
Then we chroot
chroot /diskless_gentoo /bin/bash
From here we are in the diskless
env-update source /etc/profile ln -sf /usr/portage/profiles/default-linux/x86/2005.1 /etc/make.profile ln -sf /usr/share/zoneinfo/CET /etc/localtime
Kernel
Now the kernel
emerge gentoo-sources cd /usr/src/linux make menuconfig
note that if the server system has a 64 bit arch, (x86_64) and the clients are x86, you must set a 32bit chroot environment; see the Offical 32-bit Chroot HOWTO.
You will need to activate :
| Linux Kernel Configuration: DHCP |
Networking ---> Networking options ---> [*] IP: kernel level autoconfiguration [*] IP: DHCP support |
| Linux Kernel Configuration: NFS root |
File systems --->
Network File Systems --->
<*> NFS file system support
[*] Provide NFSv3 client support
[*] Root file system on NFS
|
| Linux Kernel Configuration: Initrd |
Device Drivers ---> Block devices ---> <*> RAM disk support [*] Initial RAM disk (initrd) support |
| Linux Kernel Configuration: Splash |
Device Drivers ---> Graphics support ---> <*> Support for frame buffer devices <*> VESA VGA graphics support [*] Support for the framebuffer splash |
Compilation :
make bzImage make modules modules_install cp arch/i386/boot/bzImage /boot/linux-2.6.14-gentoo-r2-1diskless cp System.map /boot/System.map-2.6.14-gentoo-r2-1diskless cp .config /boot/config-2.6.14-gentoo-r2-1diskless
Configuration
Now we need to configure the system
/etc/mtab need to be writeable but the root is read only , a trick is to use /proc/mounts which contains the same things as mtab
ln -s /proc/mounts /etc/mtab
In /etc/fstab we will define a few directories to mount in tmpfs to be able to write in them
| File: /etc/fstab |
server:/diskless_gentoo / nfs noauto,ro 0 0 proc /proc proc defaults 0 0 shm /dev/shm tmpfs nodev,nosuid,noexec 0 0 tmpfs /var/lib/init.d tmpfs rw 0 0 tmpfs /var/run tmpfs rw 0 0 tmpfs /var/log tmpfs rw 0 0 tmpfs /var/lock tmpfs rw 0 0 tmpfs /tmp tmpfs rw 0 0 tmpfs /var/lib/xkb tmpfs rw 0 0 |
Network :
In /etc/conf.d/hostname we set the hostname:
| File: /etc/conf.d/hostname |
HOSTNAME="diskless" |
Or you may try the hostname to be "dynamic" (so that every terminal had its own hostname).
| File: /etc/conf.d/hostname |
HOSTNAME="`dmesg|grep host=|sed -e 's/.*host=//' -e 's/,.*$//'`" [ -n "$HOSTNAME" ] || HOSTNAME="diskless" |
Note: The above script looks in dmesg, because the hostname was already sent to kernel by dhcp server. It is in my opinion extremely ugly. Does anyone have idea how to recognize the hostname? Maybe it is already somewhere in /proc or /sys and is waiting to be read by us? :-)
In /etc/conf.d/net we set the domain name
| File: /etc/conf.d/domainname |
dns_domain="domain" |
We may not use /etc/init.d/net.eth0, because the kernel have to configure networking itself during boot up. Just in case you may remove it:
rm /etc/init.d/net.eth0
SSHD :
We need to create the sshd keys, normaly sshd creates them at the first start, as the root is read-only, we need to create them before
ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N '' ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N '' ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
And we add it to the boot
rc-update add sshd default
Root password
passwd
Keymap (if needed)
nano /etc/conf.d/keymaps => KEYMAP="fr"
Splash
First we install the packages
emerge splash-themes-livecd
Then we create an initrd which will be used to display the splash image at the boot
splash_geninitramfs -v -g /boot/fbsplash-livecd -r 1280x1024 livecd-2005.1
PXE
To boot in pxe we will use pxelinux , part of the syslinux package
emerge syslinux cp /usr/lib/syslinux/pxelinux.0 /boot mkdir /boot/pxelinux.cfg
The file /boot/pxelinux.cfg/default contains the command line to pass to the kernel
| File: /boot/pxelinux.cfg/default |
DEFAULT /linux-2.6.14-gentoo-r2-1diskless APPEND ip=dhcp root=/dev/nfs ro nfsroot=IP_SERVER:/diskless_gentoo video=nvidiafb:ywrap,mtrr,1280x1024-32@60 splash=silent,fadein,theme:livecd-2005.1 initrd=/boot/fbsplash-livecd quiet CONSOLE=/dev/tty1 |
Replace IP_SERVER by the ip of your server
nvidiafb is for the nvidia cards , the generic driver is vesafb (see your kernel)
X
We install it
emerge xorg-x11
Configure it
nano /etc/X11/xorg.conf
(or any other way)
If you don't use xfs, configure static font paths:
| File: /etc/X11/xorg.conf |
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/bitstream-vera/"
EndSection
|
Or if you wish to use font server:
| File: /etc/X11/xorg.conf |
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "tcp/server:7100"
EndSection
|
And to finish we need to launch X at the boot, but in query mode not via a local xdm
| File: /etc/conf.d/local.start |
X -query server& |
Note: Above did not work for me! So I edited /etc/inittab instead, and everything works fine:
| File: /etc/inittab |
c7:2345:respawn:/usr/bin/X -query server |
Sound
We will use esd as it is the most implemented , nas could also be used
emerge esound
The default configuration is fine
rc-update add esound default
We will also need to set the volume at the boot
emerge aumix
| File: /etc/conf.d/local.start |
aumix -v75 -w75& |
Note : you might also want to add "export ESPEAKER=diskless" in the ~/.xsession of the user(s) who will use the diskless
Printer
If your terminal have parallel or serial port (or usb), you may want to connect a local printer. In order to use it, you need to:
- install your printer's drivers (foomatic?) - install and configure print server (cups?) - map terminal's printer to your server's printing deamon (cups?) - every time you print, you will need to manually select the apriopriate printer (unless you make it default)
Above is a little bit of work, but it is possible. Anyone have better idea? Anyone will make howto? :-)
The diskless root is now ready, boot the diskless and enjoy
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.
