Booting a diskless workstation involves several steps. Understanding what is happening along the way will make it much easier to solve problems, should they arise.
There are four basic services required to boot an LTSP workstation. They are:
DHCP
TFTP
NFS
SSH
Load the linux kernel into the memory of the workstation. This can be done several different ways, including:
Bootrom (Etherboot,PXE)
Floppy
Harddisk
CD-ROM
USB Memeory Device
Each of the above booting methods will be explained later in this chapter.
Once the kernel has been loaded into memory, it will begin executing.
The kernel will initialize the entire system and all of the peripherals that it recognizes.
This is where the fun really begins. During the kernel loading process, an initramfs image will also be loaded into memory.
Normally, when the kernel is finished booting, it will launch the new task launcher upstart, which will handle starting up a server or workstation. But, in this case, we've instructed the kernel to load a small shell script instead. This shell script is called /init, and lives in the root of the initramfs.
The /init script begins by mounting /proc and /sys, starts udev to discover and initialize hardware, especially the network card, which is needed for every aspect of the boot from here on.
A small DHCP client called ipconfig will then be run, to make another query from the DHCP server. This separate user-space query gets information supplied in the dhcpd.conf file, like the nfs root server, default gateway, and other important parameters.
When ipconfig gets a reply from the server, the information it receives is used to configure the ethernet interface, and determine the server to nfs mount the root from.
Upto this point, the root filesystem has been a ram disk. Now, the /init script will mount a new root filesystem via NFS. The directory that is exported from the server is typically /opt/ltsp/i386. It can't just mount the new filesystem as /. It must first mount it as /root. Then, it will do a run-init, which will swap the current root filesystem for a new filesystem. When it completes, the NFS filesystem will be mounted on /.
Once the mounting of the new root filesystem is complete, we are done with the /init shell script and we need to invoke the real /sbin/init program.
Init will read the /etc/inittab file and begin setting up the workstation environment.
One of the first items in the inittab file is the rc.sysinit command that will be run while the workstation is in the 'sysinit' state.
The rc.sysinit script will create a 1mb ramdisk to contain all of the things that need to be written to or modified in any way.
The ramdisk will be mounted as the
/tmp
directory. Any files that need to be written will actually
exist in the /tmp
directory, and there are symbolic links pointing to these files.
The /proc filesystem
is mounted.
The lts.conf file will be parsed, and
all of the parameters in that file that pertain to this
workstation will be set as environment variables for the
rc.sysinit script to use.
If the workstation is configured to swap over NFS, the
/var/opt/ltsp/swapfiles directory will
be mounted as /tmp/swapfiles. Then, if there isn't a
swapfile for this workstation yet, it will be created
automatically. The size of the swapfile is configured
in the lts.conf file.
The swapfile will then be enabled, using the swapon command.
The loopback network interface is configured. This is the networking interface that has 127.0.0.1 as its IP address.
If Local apps is enabled, then the /home directory will be mounted, so that the apps can access the users home directories.
Several directories are created in the
/tmp filesystem for
holding some of the transient files that are needed while
the system is running. Directories such as:
/tmp/compiled
/tmp/var
/tmp/var/run
/tmp/var/log
/tmp/var/lock
/tmp/var/lock/subsys
will all be created.
The /tmp/syslog.conf file will be created.
This file will contain information telling the
syslogd daemon which host on the network
to send the logging information to. The syslog host is
specified in the lts.conf file. There
is a symbolic
link called /etc/syslog.conf that points
to the /tmp/syslog.conf file.
The syslogd daemon is started, using the config file created in the previous step.
Once the rc.sysinit script is finished, control returns back to the /sbin/init program, which will change the runlevel from sysinit to 5.
This will cause any of the entries in the
/etc/inittab file to be executed.
By default, there are entries in inittab to run
the /etc/screen_session script on tty1,
tty2 and tty3. That means that you can run 3 sessions
at a time, and the type of session is controlled by
the SCREEN_01,
SCREEN_02 and
SCREEN_03 entries
in lts.conf.
More entries can be setup in inittab
for more sessions, if desired.
If SCREEN_01 is set to a value of startx, then the /etc/screen.d/startx script will be executed, which will launch the X Windows System, giving you a graphical user interface.
In the lts.conf file, there is a parameter called XSERVER. If this parameter is missing, or set to "auto", then an automatic detection of the video card will be attempted. If the card is PCI or AGP, then it will get the PCI Vendor and Device id, and do a lookup in the /etc/vidlist file.
If the card is supported by Xorg 6.7, the pci_scan routine will return the name of the driver module. If it is only supported by XFree86 3.3.6, pci_scan will return the name of the X server to use. The startx script can tell the difference because the older 3.3.6 server names start with 'XF86_', whereas the newer Xorg X sesrver modules are typically lowercase names, like ati or trident.
If Xorg is used, then the
/etc/build_x4_cfg script will be called to
build an XF86Config file. If XFree86 3.3.6 is used,
then /etc/build_x3_cfg will be called to
build the XF86Config file. These files are placed in the
/tmp directory. Which, if you'll remember,
is a ramdisk, seen only by the workstation.
The XF86Config file will be built, based on entries in the /etc/lts.conf file.
Once the XF86Config file has been built, then the startx script will launch the X server with that new config file.
The X server will send an XDMCP query to the LTSP server, which will offer a login dialog.
At this point, the user can log in. They'll get a session on the server.
This confuses alot of people at first. They are sitting at a workstation, but they are running a session on the server. All commands they run, will be run on the server, but the output will be displayed on the workstation.
Getting the Linux kernel into the workstations memory can be accomplished in a variety of ways.
Boot ROM
Local media
Etherboot
Etherboot is a very popular open-source bootrom project. It contains drivers for many common network cards, and works very well with LTSP.
Linux kernels must be tagged with the mknbi-linux, which will prepare the kernel for network booting, by prefixing the kernel with some additional code, and appending the initrd to the end of the kernel.
The kernels that are supplied with LTSP are already tagged, and ready to boot with Etherboot.
Etherboot can also be written to a floppy, which works great for testing.
PXE
Part of the 'Wired for Management' specification from the late 1990's included a specification for a bootrom technology known as the Pre-boot Execution Environment commonly abreviated as PXE.
A PXE bootrom can load at most a 32 kilo-byte file. A Linux kernel is quite a bit larger than that. Therefore, we setup PXE to load a 2nd stage boot-loader called pxelinux. pxelinux is small enough to be loaded, and it knows how to load much larger files, such as a Linux kernel.
MBA
Managed Boot Agent (MBA) is a bootrom from a company named emBoot. emBoot used to be the Lanworks division of 3Com. MBA is really four bootroms in one. It will handle PXE, TCP/IP, RPL and Netware.
The MBA implementation of PXE works very well. You can use it with pxelinux to boot a Linux kernel.
The TCP/IP method can be used, but the kernel must first be prepared with a utility called imggen.
Netboot
Netboot, like Etherboot, is a free software project that provides boot ROM images. The difference is that Netboot is a wrapper around the NDIS driver or packet drivers that the manufacturer ships with the card.
Floppy disk
There are 2 ways to boot a LTSP workstation with a floppy. One way is to load Etherboot in the boot sector of the floppy. Then, it will act just like a bootrom. The boot code will be executed, the network card will be initialized, and the kernel will be loaded from the network server.
You can also write the kernel and initrd to the floppy, and boot that way. However, it is actually faster to load the kernel over the network.
Hard disk
The hard disk can be used with LILO or GRUB, to load the Linux kernel and initrd. OR, you can load the Etherboot bootrom image from the harddisk, and it will act like a bootrom.
CD-ROM
A bootable CD-ROM can be loaded either with a Linux kernel, or an Etherboot image.
USB Memory device
Just like a CD-ROM, Floppy disk and Hard disk, you can use a USB Memory device to boot either an Etherboot module, or a complete Linux kernel and initrd image.