Pub - Live Linux Cds Building and Customizing Bootables PDF
Pub - Live Linux Cds Building and Customizing Bootables PDF
®
NEGUS LIVE LINUX SERIES
Christopher Negus
ISBN 0-13-243274-9
Text printed in the United States on recycled paper at R.R. Donnelley and Sons in Crawfordsville, Indiana.
First printing, November 2006
Library of Congress Cataloging-in-Publication Data
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
vii
viii Contents
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
This page intentionally left blank
Acknowledgments
I’d like to acknowledge the work of the thousands of free and open-source software
developers around the world who have built, tested, tweaked, and published their
software so that everyone can use it freely. Because of their efforts, you and I have
literally thousands of unique software packages to choose from as we build the live
CDs described in this book.
Thanks to Debra Williams Cauley for encouraging me to do this book and
start the Negus Live Linux Series with Prentice Hall. Her work has helped me pro-
duce the kinds of Linux books I want to write, while still getting me to do them
within the time constraints of the publishing world. Others from Prentice Hall who
have helped me through this project include Songlin Qiu (development editor),
Krista Hansing (copy editor), and Christy Hackerd (project editor).
Direct help in writing and technical editing has come from several sources. Joe
“Zonker” Brockmeier came through in a pinch and wrote the Firewall and Cluster
live CD chapters. Jasper Hartline, a key developer on the Fedora Kadischi live CD
team, tech-edited the entire book. Chris Ginelloni, lead developer of the Gentoo
installer (Catalyst), reviewed the chapter on building a Gentoo live CD (with the lat-
est Catalyst software just recently completed). John Kennedy came in to provide
last-minute technical review assistance.
Finally, I’d like to thank my family for helping me stay at it for the many months
it takes to write a book.
xvii
This page intentionally left blank
About the Author
Christopher Negus has been one of the world’s leading writers of Linux books for
nearly a decade. His Red Hat Linux Bible series has sold more than a quarter-
million copies worldwide. Chris also authored or coauthored the books Linux Bible
(2005 and 2006 editions), Linux Toys, Linux Toys II, and Linux Troubleshooting
Bible for Wiley Publishing.
Before becoming a full-time author, Chris Negus worked on UNIX operating
system development teams at AT&T Bell Labs, UNIX System Labs, and Novell in
the 1980s and 1990s. In particular, Chris worked in the areas of UNIX system
administration and networking.
Live Linux CDs is Chris’s first book in the Negus Live Linux Series with Prentice
Hall. This book reflects Chris’s dedication to getting powerful, free software up and
running quickly and securely. Chris is helping Prentice Hall develop other books in
the series, which you can expect to follow in the near future.
When not working on computer books, Chris likes to spend time with his fam-
ily: Sheree, Seth, and Caleb. Chris also enjoys playing soccer, singing opera (when
nobody can hear him), and making things out of old computers.
xix
This page intentionally left blank
Introduction
1
2 Live Linux CDs
Part I
Beginning with Bootable
Live Linuxes
5
This page intentionally left blank
CHAPTER 1
Starting Up with
Live Linux CDs
Creating live Linux CDs involves more than just boot files and compression tech-
niques. It’s about letting loose your own creativity to make available at all times the
exact set of toys and tools you love to use. It’s about creating and displaying your
presentation, music, video, and image content exactly as you want it.
This book is about live CDs that are built from Linux system technology and
that draw on a pool of thousands of open-source software components available
today. In this book, you learn how to find, use, customize, and remaster live Linux
CDs—and even build them from scratch.
The DVD that comes with this book contains a handful of live Linux CDs that
you can use separately from a single boot prompt. It also contains many of the soft-
ware tools you need to create anything from a lightweight desktop system that would
run from a 50MB bootable business-card CD to a multigigabyte DVD containing a
dizzying array of desktop, server, and system-administration software.
This book starts with novice tricks for running live Linuxes included with the
book’s DVD and takes you to guru skills, where you build, customize, and remaster
specialized live Linux distributions. When you are finished, you end up with the
perfect bootable Linux system for your own use, or even your own Linux distribu-
tion to share with the world.
7
8 Live Linux CDs
With a live CD, you no longer have to be tied to a desktop or even a laptop com-
puter to do your computer work or play. Instead, you can carry an entire operating
system, important applications, and even your data (music, documents, video,
images, and spreadsheets) on a single CD, DVD, or USB flash drive (about the size
of a pack of gum). Your whole computer system can go where you go and run on
almost any PC that’s handy.
The explosion of high-quality open-source software and the popularity of the
Linux operating system have created a fertile landscape for live Linux CDs. As a
result, you can find dozens of Linux-based live CDs that are available for you to
download and use freely. There are also powerful tools for customizing live CDs or
building your own remastered (or from-scratch) live CDs.
In recent years, live Linux development has seen a lot of action, resulting in
some sophisticated tools and solid base systems to build from. Low-cost, high-
capacity media, such as USB flash memory, CDs, and DVDs, make the concept
inexpensive for anyone to create a live Linux distribution. Also, unlike proprietary
software, you have great freedom to copy, adapt, and customize most open-source
software, without cost.
understand issues such as swap space, file system types, and whether a sepa-
rate, small /boot partition is needed.
■ Hardware configuration—During the install process, you might be asked
to configure your video card, monitor, network card, or other hardware. Some
Linux systems are better than others at detecting and automatically configur-
ing your hardware; most ask you to provide some level of information to con-
figure hardware during the installation process.
A live Linux CD such as Knoppix is designed to start up without prompting you
for any information. It doesn’t care if Windows consumes your hard disk because it
doesn’t need to touch your hard disk to run. It is designed particularly to detect and
configure (at least, to a workable minimum configuration) your video card, network
hardware, sound card, and other available hardware. If any of those features isn’t
working, you have an opportunity to pass options at the boot screen to have the live
CD enable or disable selected features.
With a booted live CD acting as the proof that Linux will run on your PC, mov-
ing to a permanent install is a less daunting prospect. In fact, Knoppix includes the
tools you need to resize your disk partitions and further configure hardware (such as
printers, TV cards, and other hardware). You can write down the drivers and config-
uration information from your Knoppix system and use that information to reconfig-
ure Linux if problems arise when you later permanently install Linux.
To try out a live CD that offers a GNOME desktop, you can get the GNOME ver-
sion of Knoppix called Gnoppix (www.gnoppix.org). Another live CD that offers the
GNOME interface is the GNOME LiveCD, which comes directly from the GNOME
project (http://live.gnome.org).
For a more lightweight desktop system (fitting on a medium of less than 50MB),
try Damn Small Linux (www.damnsmalllinux.org). Other live CDs in the lightweight
desktop category include Puppy Linux (www.puppyos.com) and Feather Linux
(http://featherlinux.berlios.de). These mini desktop live CDs usually work better on
older machines that have a smaller amount of RAM and slower CPU.
studio in a GNU/Linux live CD.” Software on this live CD can be used for video
production (using Kino, Cinelerra, or LiVES), audio production (Audacity and
ReZound), 3D modeling (Blender), and image manipulation (GIMP).
Dynebolic can be used as a pervasive desktop. With a feature called a “Nest,”
you store data and settings on a hard disk or USB flash drive, yet you run the oper-
ating system from CD. The desktop is represented by the WindowMaker window
manager instead of GNOME or KDE, to keep the system requirements for running
Dynebolic lower. Figure 1-4 shows the Dynebolic desktop.
security live CDs offer no graphical interface but still make hundreds of Linux com-
mands available to use (while consuming only a few megabytes of disk space).
Knoppix-STD (http://s-t-d.org) contains hundreds of applications for tracking
down problems and repairing systems and networks. It contains forensics tools such
as autopsy and sluthkit. It also includes honeypots (such as honeyd) for catching
intruders and a range of network-monitoring and sniffing utilities (such as ethereal
and tcpdump). Vulnerability-assessment tools include nessus, nmap, and several
CGI scanners.
■ Access hard disks—A live Linux system doesn’t need to access your hard
drive. However, sometimes you will want to use the data on your hard drives
to perhaps play music, open a document, or view images using your favorite
Linux application. Or you might want to save data that you gather or create
from your live CD to a more permanent hard disk.
Some bootable Linux systems provide icons right on the desktop representing
all the hard-disk partitions on your computer. Accessing data on those parti-
tions is often as simple as opening those icons. Writing to those partitions
often requires a special request (to prevent you from writing to hard-disk
partitions unintentionally).
■ Access the CD drive—Because the operating system is, by default, run-
ning from your boot medium (CD or DVD), if you then want to play a music
CD or a video file from DVD, you can’t just eject the medium from its drive.
If you have two CD drives you can use one for the live CD and one for the
content you want to play.
If you have only one CD/DVD drive, however, a way around this problem is
the same technique used to improve performance. With enough available
memory, run the live Linux from RAM; you can eject the bootable medium
|to insert the CD or DVD you want to play. Some specialty movie player
live CDs are, by design, stripped down to the minimum you need to play
multimedia content, so they automatically load into RAM and let you eject
the CD.
■ Access networks—Most bootable Linux systems are configured to automat-
ically detect the availability of a DHCP server on most supported wired Eth-
ernet cards. This immediately provides you with a working Internet or other
network connection. Tools for configuring static IP addresses or connecting
with wireless cards are also available with many bootable Linux systems.
■ Add applications—You might have an almost-perfect live CD but find that
it lacks an application or two that you want. Some live Linux systems enable
you to install applications to a running, live Linux system (usually with
downloadable packages that are preconfigured for the particular live Linux
distribution you are using).
■ Save custom features—With a read-only medium, such as a CD-ROM,
you might be able to change your desktop background, write a document, or
save some Web bookmarks. But as soon as you reboot (by default), all that
stuff just goes away. As already mentioned, you can access the local hard
disk or network for saving data, but you might want to keep custom settings
and applications with your live Linux so that every time you reboot the CD,
those settings just reappear.
CHAPTER 1 Starting Up with Live Linux CDs 21
Some live Linux systems include features for gathering your custom settings,
saving them somewhere (such as a hard disk, USB flash drive or floppy), and
having them restored the next time you reboot. They might do this by back-
ing up all the files in your home directory and your /opt directory into a sin-
gle file (called a tarball), storing it somewhere (such as a floppy or disk on
the network), and restoring it when you reboot.
■ Install to hard disk—Even though most bootable Linux systems weren’t
made to be installed on hard disk, some people love their bootable Linux so
much that they want to add it permanently to disk. Some live Linux distribu-
tions offer a feature for installing to hard disk. (Keep in mind, however, that
many live CDs are made for temporary use and may not offer the level of
security you would like on a permanent desktop system, unless you do some
extra configuration.)
■ Install to USB flash drive—If you love your live Linux on a CD, you might
love it more on a flash drive. After booting your live Linux from a USB flash
drive, you can modify your data and add more as you go along.
You can do a lot to customize an existing live Linux. However, you can do even
more by putting together your own live Linux that includes exactly the components
you want. After you have played with the live CDs out there, you might want to cre-
ate one yourself.
Although the Catalyst tools represent the greatest prospect for building and
tuning a live CD to your exact specifications, they take a long time to run
and require more expertise to make corrections when something goes wrong.
For that reason, descriptions for building Gentoo live CDs in Chapter 8,
“Building a Basic Gentoo Live CD,” start with a remastering approach before
getting into how to use Catalyst to build a live CD.
If you decide that just saving a few settings and some data (customization)
doesn’t meet your needs, you must have (or develop) some expertise in using Linux
systems from the command line. You cannot remaster or build a live Linux CD from
scratch entirely from a graphical environment (at least, so far); you must work as the
root user from the command line, in most cases.
What you will find as you dig in, however, is that Linux is an extraordinarily
rich environment for creating your live CD. Linux is the natural platform for cus-
tom, bootable operating systems because of these characteristics:
■ Small core—A minimal kernel and a few applications can run in only a few
megabytes of memory. So your live CD can be tuned to run efficiently from
the live CD or even loaded completely into memory (making it blazing fast
to use).
■ Building-block nature—Unlike developers of some proprietary operating
systems, most open-source developers strive to interoperate with existing
components created by other people. This gives you the choice to piece
together components that best suit your needs. For example, you can include
any of several boot loaders (ISOLINUX, GRUB, or LILO) to start your live
CD, or choose a desktop that is either full-featured (such as GNOME or
KDE) or lightweight (such as Fluxbox or WindowMaker).
■ Vast amount of available software—You can draw on literally thousands
of open-source software projects for your live CD. By starting with an estab-
lished Linux distribution (such as Debian, Fedora, and Gentoo, as were cho-
sen for this book) you begin with versions of those software projects that have
been packaged and tested for these particular Linux environments. For you,
it’s usually more like just making a shopping list of software packages than it
is like having to make every piece of software work yourself.
If you are already familiar with Debian (including Knoppix), Fedora Core
(including Red Hat Enterprise Linux or CentOS systems), Slackware (including
SLAX) or Gentoo, you might most naturally want to begin by building a live CD that
is based on that distribution.
24 Live Linux CDs
NOTE
If you are a Slackware enthusiast, there are several SLAX live CDs
(www.slax.org) you can try out. You can easily customize a running SLAX
live CD by adding software modules (www.slax.org/modules.php).
That process is described in Chapter 9, “Customizing a Secure Live Linux
CD,” for customizing the SLAX-based BackTrack security live CD.
Despite the fact that Fedora Core comes with no guarantees (then again, what
Linux system does?), Fedora Core is developed and maintained primarily by world-
class software developers employed by Red Hat. In fact, most of what is developed
in Fedora Core (which is released every 6 to 9 months) finds its way into Red Hat
Enterprise Linux (scheduled to release approximately every 18 months). So Red
Hat, Inc., has a vested interest in making Fedora Core a good distribution.
Fedora and Red Hat Enterprise Linux are among the last major Linux distribu-
tions to offer a live CD. The effort started in earnest with the Google 2005 Summer
of Code Project by Darko Ilic. Darko created Kadischi, a set of tools for producing
live CDs using Fedora software repositories and the anaconda installer.
In the past year, lead developers from Red Hat Inc. have begun picking up
development of Kadischi-related tools. Most significantly, some of the features pre-
viously built into the kadischi command are now being incorporated directly into
the Fedora anaconda installer. In effect, producing a live CD is becoming more like
doing a regular Fedora installation to hard disk.
By relying on the anaconda installer, kadischi gives you access to a lot of the
different installation features in Fedora when you produce a live CD. Therefore, you
not only get the software packages you want, but you also can choose your language,
keyboard, network configuration, time zone, and other configuration settings. Kadis-
chi usually launches the anaconda installer to produce a live CD in one of two ways:
■ Graphical installer—When you launch the kadischi command, you must
identify the location of your Fedora software repository and the name of the
resulting ISO image. Then, by default, anaconda runs in a window on the
desktop. You step through the screens as you would during a normal hard
disk. When anaconda is done, kadischi cleans up unnecessary files, com-
presses the file system, and produces the ISO image.
Figure 1-9 shows a kadischi command line that starts the process of produc-
ing the live CD (upper right corner in the Terminal window). The anaconda
installer screens, to step through the install process, appear in a separate
window.
■ Kickstart install—If you are going to run kadischi multiple times to get
your live CD just right (which is normally what happens), the better approach
is to create a kickstart file that includes settings that are passed to the ana-
conda installer.
Information you add to your kickstart file allows anaconda to bypass graphi-
cal installer screens. In fact, the normal way to use a kickstart file is to have
it include all information to complete the install so you can bypass the graph-
ical installer altogether.
28 Live Linux CDs
Using the %packages section of the kickstart, you can indicate exactly which
packages and package sets you want to install to your live CD. Simply adding
and removing packages from the list lets you adjust the size and feature set
of your live CD. Then, after each change, simply run kadischi again to build
a new ISO image.
At the end of the kickstart file, you can add commands that are run when
anaconda is done (%post section). This is where you can make final modifi-
cations to your live CD system, such as add a user or copy data files you want
to be on the live CD.
FIGURE 1-9 From the Fedora desktop, run kadischi to create a live CD with
anaconda.
To get the best performance, you can copy the whole Fedora Core distribution to
your hard disk. After that, you can add any RPM packages you want from Fedora
Extras repositories or from third-party repositories, such as rpm.livna.org or
atrpms.org. When adding new packages and package groups to the comps.xml file
that anaconda uses, anaconda lets you select those packages for installation. As
long as you include all dependent packages with the ones you want to add, ana-
conda will install those dependent packages as well.
CHAPTER 1 Starting Up with Live Linux CDs 29
The packaging system for Gentoo is called Portage and is based on the BSD
ports system. Software management is done from the listing of more than 10,000
packages that make up what is referred to as the portage tree. Using the portage tree
and the emerge command, you can launch commands that request that selected soft-
ware packages be download, compiled, and installed, while resolving any software
dependencies along the way. (Be careful, though, because a single emerge command
can result in hours of downloading and compiling.)
■ Ubuntu Live CD—You can order or download an Ubuntu live CD that dou-
bles as an install CD from the Ubuntu Web site (www.ubuntu.com/download).
■ Gentoo Live CD—Currently, the Gentoo Linux project offers only an x86
live CD. However, tools being developed in Gentoo’s Catalyst project will
eventually allow live CDs to be created for other architectures as well. You
can find out how to get the Gentoo LiveCD from the “Where to Get Gentoo
Linux” page (www.gentoo.org/main/en/where.xml).
■ Mandriva Live CD—The Mandriva Linux (formerly Mandrake) distribution
produces a live CD version called Mandriva Move. You can find it from the
Mandriva download page (www.mandriva.com/en/downloads). The Mandriva
project is also developing a new live CD called Mandriva One. That CD, cur-
rently in beta testing, combines a live desktop CD and a Mandriva installer.
Although several major Linux distributions don’t offer official live CDs, trying
out a live CD created from one of those distributions is a good way to get a sense of
how it will work after it is installed. The Debian/GNU FAQ recommends using
Knoppix as a way to try Debian features. For Fedora, Red Hat Enterprise Linux, or
related distributions, I suggest keeping an eye on the Fedora-livecd-list mailing
list, where they are getting very close to developing an official live CD. (In the
meantime, you can try making one yourself from the descriptions in Chapter 7.)
are the Package Manager window (for installing packages from software reposito-
ries) and the Package Updater window (for updating existing packages).
NOTE
Keep in mind that, even though different software distributions use the
same packaging tools, each draw on software repositories that are specific
to that distribution. These days, distributions such as Fedora and Debian
are set up automatically to draw on software repositories that match distri-
bution and version. So everything should just work.
FIGURE 1-11 Use labels and jewel case covers from live CD proj-
ects or create your own.
SUMMARY
Whether you want to just boot up and use a live CD or build your own, this chapter
presents the concepts that are covered in this book. As a user, you can find out dif-
ferent methods of booting and using a live CD. As someone who wants to build a
live CD, you can learn about ways in which you can create a custom live CD.
This chapter presented some opportunities you will face as you choose the
Linux distribution you will build from, the approach you want to take in building it
(remastered or from scratch), and the components you want to include in it.
Some different, existing types of live CDs were described. Those types include
live CDs oriented toward desktop systems, security/rescue, gaming, multimedia
players, and others. You can build those types of live CDs as well, or you can start
with one of them and remaster it to suit your needs.
The next chapter is meant for you to get your hands on some live CDs. Using the
DVD that is included with this book, Chapter 2 describes many of the ways in
which you can boot, use, and configure your live CDs to get the most out of them.
It also provides a survey of features in each of the live CDs included on this
book’s DVD.
CHAPTER 2
The DVD included with this book contains more than ten Linux live CD distribu-
tions. By trying out these different distributions, you can start drawing on the
wealth of open-source software that is available today. You can also get a sense of
the applications and decisions that went into making these different live CDs, so
you’ll have a head start when you create or customize one of your own.
Among the mix of live CDs on this book’s DVD are CDs meant for general desk-
top use, gaming, multimedia, and security/recovery. This chapter describes special
features of each of those live CDs, as well as some of the applications that come
with them. If you don’t have a DVD drive available, later sections describe where
you can download or purchase the CD versions of those live CDs.
37
38 Live Linux CDs
■ File saves—Because the root file system (/) of the live CD often resides on
the live CD or other read-only medium, you can’t directly add files to that file
system or modify files from that file system. As a result, for example, you
could not install new software or change settings in files located in directo-
ries on the live CD.
Live CD developers have taken a few different approaches with that issue.
On Fedora live CDs, you simply can’t install new software or otherwise add
new files to directories in read-only file systems. Directories that need to be
read/write (such as /tmp and /home directories) are mounted on a writeable
file system that is mounted from system memory. In other words, you are just
saving your data to temporary, transient work space.
On Knoppix live CDs, using the Unionfs file system, a read/write file system
is overlaid on the read-only file system. That way, files that you save to the
/bin directory, for example, appear to be in the /bin directory, even though
they actually reside on a different physical file system. That writeable file
system would, as with Fedora live CDs, be saved in RAM.
■ Changes you make—Unless you make some other arrangements, all the
files you add and settings you change during a live CD session disappear
when you reboot the computer. For any live CD, you can save files during a
live CD session by either opening write access to a hard-disk partition or
inserting your own writeable medium (such as a USB flash drive).
In some cases, however, just saving files isn’t good enough. For example, you
might want to save installed software, your desktop background, or other data
that has to be in a particular location in the file system to be used automati-
cally. In that case, you need a live CD that supports the capability to put data
back where it belongs the next time you reboot. In Knoppix, that feature is
referred to as a persistent desktop; in Dynebolic, the same feature is called
a Nest.
■ Hard-disk access—Most live CDs are designed to prevent unintentional
changes to the hard-disk partitions on the computer. For that reason, those
partitions are usually not mounted when the live CD boots up. If a desktop
feature is available to let you choose to mount those partitions, it typically
does so in read-only mode, by default.
Exceptions to this rule exist, however. By default, the Puppy Linux live CD
(www.puppylinux.org) creates a file system, represented by a single 256MB
file, on a hard-disk partition in which the data you create is saved. It does
this without asking if it’s okay. By default, that file (called PUP001) remains
on the hard disk after the reboot, so all your settings return the next time you
reboot your live CD on that computer.
CHAPTER 2 Playing with Live Linux CDs 39
The bottom line is that, although most Linux live CDs don’t write to the hard
disk at all by default, at least one (and probably more) does. Be careful about
what data you are saving, and be sure to clean up the saved data before you
leave the machine.
■ CD/DVD drive access—If you have only one drive for booting the DVD
that comes with this book (or Knoppix CD you’ve obtained otherwise), you
can’t just pop it out to insert another CD or DVD to play music or video.
Because Knoppix is running from that drive, removing it would be like
removing your hard disk from an installed computer system.
If you want to be able to use the CD/DVD drive from Knoppix, you can either
copy the image to hard disk or run it entirely from memory (provided that you
have enough memory available to do so). Procedures for running Knoppix
from RAM are included in the “Getting a Live CD Working Just Right” sec-
tion later in this chapter.
Using the DVD that comes with this book, you can boot several different Linux
live CDs that have been consolidated on the DVD. Features for booting and using
those live CDs are covered in this chapter and in Appendix A, “On the DVD.”
Chapter 3, “Customizing a Live CD,” covers ways of customizing a live CD (without
remastering) and saving those customized settings and applications (using persist-
ent desktops).
2. Type one of the following from the boot prompt to boot the live CD you want
to try:
■ knoppix—To boot the Knoppix live CD; this is the default live CD booted
from the DVD, so pressing Enter will work as well
■ gentoo—To boot a Gentoo live CD
■ slax—To boot a SLAX live CD
■ backtrack—To boot the BackTrack security live CD
■ llgp—To boot the Live Linux Game Project live CD
■ dsl—To boot the Damn Small Linux live CD
Other live CDs that can be started from the boot prompt are noted on the boot
screen and described in Appendix A.
3. Wait as the live CD you selected boots up. In most cases, you are presented
with either a running desktop interface or a login prompt.
Instead of booting directly to one of the live CDs directly from the boot prompt,
in many cases you have the option to copy a complete ISO image representing a live
CD and burn that image to a blank CD. Refer to Appendix A for information on
which ISO images are available on the DVD and how to burn those images to CD.
If you have never tried out a live CD before, I recommend you try Knoppix.
Information on using Knoppix is contained in the following sections. To get the full
effect (Knoppix boot screen and complete boot options), you can burn the Knoppix
ISO image to a separate CD to try it out.
NOTE
If you want to try Knoppix on a computer that doesn’t have a DVD drive,
there are two ways to go about that. You can copy the ISO image from the
DVD (on a machine with a DVD drive) and burn it to CD (as described in
Appendix A). Alternatively, you can download or purchase an ISO image of
Knoppix, as described at www.knoppix.net/get.php.
Touring Knoppix
With the computer in front of you and the DVD inserted into the DVD drive, follow
this procedure to tour the Knoppix desktop features:
■ With the DVD inserted, reboot your computer.
■ When the boot screen appears, press Enter. When Knoppix finishes booting
and detecting your hardware, the Knoppix desktop should appear as shown
in Figure 2-1.
In many ways, Knoppix looks like any other desktop system based on the K
Desktop Environment (KDE). If you want to find out more about KDE and the fea-
tures it contains, refer to the KDE Web site (www.kde.org).
Many of the features that Knoppix adds to the KDE desktop make it easy to
overcome those issues that make a live CD different from an installed Linux system.
In particular, it displays icons representing hard-disk partitions and other storage
devices. It also has a Knoppix icon on the desktop panel that provides access to
special configuration features, in case Knoppix doesn’t detect and configure every
piece of hardware as you would like.
42 Live Linux CDs
FIGURE 2-1 Knoppix adds special features to a KDE desktop that make it use-
ful for a live CD.
Hard-Disk Partitions
During boot-up, Knoppix checks your hard disks and adds an icon representing
each hard-disk partition it encounters to your desktop. None of those hard-disk par-
titions is mounted by default. To mount one and open its contents in a file manager,
simply select the icon. It will open with read/write permission.
Knoppix offers support for many different file system types. So whether the
computer you are running Knoppix on has Linux, Microsoft Windows, BSD, or
another operating system type installed, there is a good chance that you will be able
to mount its file systems from Linux.
One feature that Knoppix includes that some Linux systems do not is support
for the NTFS file system type. Because NTFS is the file system type most often used
with Microsoft Windows XP, Knoppix can be very useful for playing, displaying, or
otherwise using the data from your Windows XP computer.
Knoppix makes it easy to mount and unmount file systems for your disks and
other storage media by adding information about each of your partitions to the
/etc/fstab file. Knoppix mounts each partition to directories under the /media
directory. Each directory is named based on the device type (IDE or SCSI) and the
partition number. For example, the first partition (1) on the first IDE hard disk (hda)
is named hda1. It is mounted on the /media/hda1 directory (with a link to /mnt/hda1
for backward compatibility).
For SCSI hard disks, the mount point begins with sd. For example, the first par-
tition on the first SCSI disk on your computer is mounted on the /media/sda1 direc-
tory. Because USB flash memory drives are mounted as a SCSI device, with no SCSI
hard drives, a USB drive would be mounted on /media/sda1.
Panel Buttons
To the right of the KDE and Knoppix menu buttons on the Knoppix KDE desktop
are buttons for launching several popular applications. These applications include
(from left to right) a window list menu, a desktop-access button (to minimize every-
thing on the desktop), a home button (to open the /home/knoppix directory in Kon-
queror), Konsole (shell Terminal), Konqueror (file manager and Web browser),
Firefox (Web browser), and Open Office (OpenOffice.org Writer).
You can move, remove, or add panel buttons. Right-click an icon and then
select Move, Remove, or Configure the application associated with that panel but-
ton. To add a new application button to the panel, right-click on the panel (to se the
panel menu), and select to add an applet (small application that runs on the panel)
or an application (which you can select from the KDE menu that appears).
FIGURE 2-2
Move between workspaces using
the Desktop Pager.
46 Live Linux CDs
Hover the mouse over applications in the taskbar to see the task’s name and
which workspace it is in. The taskbar can also interact with the Desktop Pager. You
can drag and drop an application from the taskbar to any workspace on which you
want it to appear. To have an application appear on every workspace, right-click the
application in the taskbar and then select To Desktop q All Desktops.
System Tray
Small icons representing applets appear in the right side of the KDE Knoppix desk-
top panel in what is called the system tray. Applets provide another means of con-
veniently changing system settings on a KDE Knoppix desktop.
Applets that appear on the Knoppix KDE desktop include the KDE Keyboard
Tool, Screen Size applet, and KMIX applet. You can configure your keyboard,
screen resolution, and refresh rate, and adjust the volume on your audio channels.
Select the Panel menu and choose Add Applet to Panel to see a list of available
applets. You can add such applets as Konqueror Browser bookmarks, a puzzle game,
Klipper (a cut-and-paste utility), network folders, a printer menu, a quick file
browser, a control center menu, the weather report, and wireless network
information.
The Shell
As do most Linux distributions, Knoppix uses bash as its default shell. When you
select the Terminal icon on the KDE panel, Konsole is the default terminal window
used.
When you open the Konsole window, your user ID is the same as the user run-
ning the desktop: knoppix. The home directory is /home/knoppix. Standard Linux
system permissions apply when it comes to read/write/execute permissions for the
Knoppix user. The Knoppix user can change files in /home/knoppix and /tmp, but
not in /etc or /bin, for example.
48 Live Linux CDs
To allow the Knoppix user to use root permission when necessary, you can use
the sudo command. The /etc/sudoers file is configured to allow the Knoppix user
to run any command as though it were the root user. For example, to edit the
/etc/hosts file and change its contents using vi, you could type the following:
# sudo vi /etc/hosts
Because sudo is configured to let you run any command as the Knoppix user,
without typing a password, you can simply begin editing the file. If you want to run
a longer session, as the root user, you could type something like sudo su - to start
a shell session as the root user.
If you know your way around the KDE desktop, understanding how to use live
CDs other than Knoppix that provide a KDE desktop mostly means getting used to
the different tools that the CD puts together for you to use. The following sections
provide brief tours of other live CDs.
NOTE
See Appendix A for information on which gaming live CDs are included on
the DVD that comes with this book.
Most basic games created originally for Linux or other UNIX-like platforms will
run on most any X desktop environment. Some older UNIX games run from the
shell. If you are happy with the occasional board game, card game, and simple
shooting game, there will be no problem finding stuff to keep you amused on most
Linux desktops.
Although some exceptions exist, most commercial video games were made to
run on other platforms. Though things are improving, Linux users are still not seen
CHAPTER 2 Playing with Live Linux CDs 49
as a major computer gaming market. So the bad news is that you need to use a gam-
ing console (Playstation, Xbox, and so on) to play most of the latest commercial
games or run Windows games in some sort of emulator or applications-compatibility
mode, to use them in Linux. And in most of those cases, you won’t be able to redis-
tribute the games on a live CD.
The good news, however, is that there have been some fun older commercial
games released into the public domain. Add to that the fact that a lot of open-source
developers think it’s fun to write their own gaming console emulators, and you end
up with the possibility of a whole new world of games being available to play with
on a live CD (or add to your own).
These games include Beneath a Steel Sky and Flight of the Amazon Queen,
which are available on the Knoppix Games CD for you to try.
■ Other gaming emulators—A variety of other game hardware emulators
are also available on Linux gaming CDs, such as Knoppix Games. Few of
these emulators come with any games, but if you have legal game ROMs for
older Atari, Commodore, or Apple hardware, you can try them with emulators
you select from the Emulators list on the K menu.
Besides gaming consoles, emulators and application-compatibility software
projects are available to run games intended for computer operating systems.
WINE (http://winehq.org) and Bochs (http://bochs.sourceforge.net) can be used
to run applications created for PC-compatible (x86) hardware. DOSBox (http://
dosbox.sourceforge.net) can run a rage of DOS and Windows applications, but it is
particularly developed to run older DOS games that won’t run on more modern PCs.
NOTE
A popular way of playing Windows games in Linux is to use a commercial
product called Cedega from Transgaming Technologies (www.transgam-
ing.com). Previously called WineX (because it was originally based on
WINE), Cedega implements a version Win32 API in Linux. It then supports
many Windows multimedia APIs (such DirectX, Direct3D, DirectInput, and
DirectSound) that are critical to Windows gaming. It then specifically tests
those games that are wanted by their customers so the games will run well
in Linux.
Although all the gaming emulators just mentioned are covered under the GPL
and, therefore, can be freely distributed, the major issue is finding games that run
on those platforms that can be freely distributed as well. Again, the issues of getting
games you can play legally and even, in some cases, redistribute freely, are dis-
cussed in Chapter 11.
The other limiting factors related to gaming have to do with your video hard-
ware. Games that demand 3D acceleration usually work best with NVIDIA or ATI
cards. Although open-source drivers are available for NVIDIA and ATI cards, pro-
prietary Linux drivers available from NVIDIA and ATI simply work better for
gamers.
CD, which you can get from the Games Knoppix site: http://games-knoppix.unix-
ag.uni-kl.de. This section describes the Games Knoppix CD.
Because Knoppix Games is a remastered version of Knoppix, once you can get
around on Knoppix, most of what is different here are the games themselves. To get
started, just open the Games list from the K menu. Figure 2-3 shows an example of
the Knoppix Games screen displaying the games Beneath a Steel Sky (upper right)
and Flight of the Amazon Queen (middle), along with a list of games displayed in the
Konqueror window (type programs:/Games/ in the location box to see this list):
FIGURE 2-3 Beneath a Steel Sky and Flight of the Amazon Queen were com-
mercial games that are now free.
NOTE
Intel recently announced that it will release drivers for its video cards in
open source. Although Intel video interfaces are not considered to be as
good as NVIDIA and ATI cards, Intel’s announcement is expected to result
in much-improved gaming with open source drivers and could encourage
NVIDIA and ATI to release their drivers in open source as well.
52 Live Linux CDs
Most of the games described here are covered under the GNU Public License
(GPL) or similar license and can be freely distributed. You might be free to use
some games that run in Linux, covered under other licenses; on the other hand, you
might be free to use on your own live CD, but not on one that that is redistributed.
For example, demos of some commercial games might fall into this category. You
may need permission from the company making the game to redistribute the demo
(and that request will likely fall on deaf ears).
You can try a variety of games from the Knoppix Games CD. Some games repre-
sent good examples of those that were developed from scratch to be free and those
that began as commercial games that were available as freeware. There also were
many games created as clones of popular board games and card games. The follow-
ing sections contain examples of traditional free games, previous commercial
games that are now free, and clones of popular board and card games.
FIGURE 2-4 Explore dungeons, acquire treasure, and fight monsters in Falcon’s
Eye (NetHack).
In character-based versions of the game, every item in the dungeons is repre-
sented by a symbol. The at sign (@) is you, stairs go up (<) or down (>), and items
such as a wand (/), ring (=), scroll (?), or a potion (!) might just be lying around to
54 Live Linux CDs
pick up. In Falcon’s Eye, however, you can move the mouse over an item to see a
description of it. You can also right-click an object or location to act on it or move
to it.
Because these NetHack games are based on the same underlying engine, you
can use the same keyboard commands in any of these games. Table 2-1 shows a list
of keyboard commands and resulting actions from the NetHack help page.
Playing with NetHack connects you to some of the first adventure-type games
played on UNIX systems. For more detailed descriptions of options and game play,
refer to the Guidebook for NetHack (www.nethack.org/v343/Guidebook.html).
I Displays selected parts of your ^ Asks for the type of a trap you
inventory, as in I* (lists all gems found earlier.
in inventory), Iu (lists all unpaid
items), Ix (lists all used-up
items that are on your shopping
bill), and I$ (counts money).
o Opens a door. ) Tells what weapon you are
wielding.
O Reviews current options and [ Tells what armor you are wearing.
possibly changes them.
p Pays your shopping bill. = Tells what rings you are wearing.
Figure 2-5 shows a screen shot from Beneath a Steel Sky, where Robert Foster
needs to get into the store room to find the putty he needs to short-circuit the con-
trol panel:
FIGURE 2-5 Help Robert Foster escape from Union City and
find the secrets of his past.
It can be very time-consuming to figure out how to progress with this game. To
help you get started, here are the first few steps you can try: Locate the metal bar
and take it (right-click). Pry open the fire escape door. After the officer checks the
door, go down the stairs to the room to your right.
Find something in the trash to use as Joey’s (your robot’s) body and drop the cir-
cuit board on it. Try to start the transport robot. When it doesn’t start, go in the room
to the right and ask Hobbins questions until he tells you what’s wrong with the
transport robot. Go back to the room to the left and ask Joey to fix the transport
robot. When the transport begins bringing barrels to the lift, jump down the hole
when the lift is down.
Next, try the lock on the door out of the furnace room. When you can’t open it,
have Joey open the door. When Officer Reich comes in and gets shot by Linc, go
over and take his ID card and sunglasses. Exit the furnace room and try to figure
out how to get an elevator to take you down. You’re on your way.
If you find the game difficult after a while (which you probably will), you can
find lots of walkthroughs of the game on the Internet. An example of a walkthrough
is located at http://home.alo.com/gametown/beneath.html. Otherwise, just search
for the terms walkthrough and Beneath a Steel Sky.
58 Live Linux CDs
minimal operating system that includes only the software needed to access and play
multimedia content, MoviX projects can run on low-end computers with minimal
amounts of memory.
The MoviX2 multimedia player is the most versatile of the MoviX projects. The
main focus of MoviX2 is a simple X Window system display and the mplayer multi-
media player. Because of its size, MoviX2 can fit on a mini-CD, 64MB USB pen
drive, or other small bootable medium. When it’s running, you can play video,
music, or digital images from CD, DVD, hard disk, or various network interfaces.
A key element of any multimedia live CD is its capability to properly detect and
configure your video card configuration. MoviX2 offers several boot options that let
you take best advantage of your video hardware. For example, MoviX2 includes
proprietary NVIDIA drivers that you can select (at the boot prompt) to use instead
of the open-source NVIDIA drivers. Likewise, you can set your monitor frequency
manually (also at the boot prompt), if that is not being properly detected.
The following procedure steps you through some of the features of MoviX2:
1. Burn the MoviX2 ISO image to CD, as described in Appendix A.
2. Insert the MoviX2 live CD into your computer and reboot.
3. When you see the MoviX2 boot screen, you can either simply press Enter or
type any of the following boot labels, depending on your situation:
■ MoviX2—This is the default label.
■ NVidia—If you have an NVIDIA video card, you can try this label to use
4. Eject the CD. Now you can use the drive to insert a CD or DVD containing
the content you want to play.
5. Right-click the desktop to see a modified Mplayer menu. Then select Switch
to MoviX. The MoviX main page appears, as shown in Figure 2-6.
FIGURE 2-6 Play video, audio, or slide shows from the MoviX main page.
Here are some of the things you can do from the MoviX main page:
■ Play video—Press F9 to start the Mplayer media player graphical user
interface. Right-click the desktop and select Open q Play File. You can
then browse your computer to find any supported video to play. You can
check your CD or DVD (/cdrom0), your hard-disk partitions (mounted on
/discs), and any remote-mounted file systems (mounted on /mnt).
■ Play music—Insert a music CD into the drive. Select Play q
NOTE
MoviX2 cannot play commercial movie DVDs as it is delivered. If you can
obtain the libdvdcss library and add it to the /usr/lib directory on the
Movix2 CD, you can use MoviX2 to play commercial DVDs. See Chapter 12
for a deeper discussion on why the library to decode commercial DVD
movies is not always included with Linux distributions.
62 Live Linux CDs
If you want to adjust your audio, press Alt+F2 to display the alsamixer audio
mixer. To access a shell, press Alt+F3.
Most sound cards that the ALSA project supports work with MoviX2. If your
card doesn’t work, you can try loading the OSS sound module (enter the OSS=y boot
option). For ISA sound cards, you might need the DETECT=all boot option for it to
work properly. See the ALSA project (www.alsa-project.org) for further suggestions.
Touring Dynebolic
The following is a quick tour of the Dynebolic live CD on the DVD that comes with
this book. To get the official ISO image of Dynebolic, follow the download link from
the Dynebolic home page (www.dynebolic.org).
1. Burn the Dynebolic image to CD, as described in Appendix A.
2. Insert the Dynebolic image into your CD drive and reboot.
3. Either check boot options (press F2 or F3 to see boot options) or just press
Enter. Dynebolic should boot to a desktop similar to the one shown in
Figure 2-7:
4. Check out the Dynebolic desktop. You should note a few features about the
desktop:
■ Storage devices—The panel in the upper-right corner of the screen rep-
resents storage devices. Use the house icon at the top of the panel to open
the home directory (/home) in a file manager (the XFE, X File Explorer).
You can use XFE to explore your file system.
CHAPTER 2 Playing with Live Linux CDs 63
FIGURE 2-7 Create and manage multimedia content from the Dynebolic desktop.
For ease of use, an icon represents each hard-disk partition on the com-
puter. Those partitions are automatically mounted with read-write permis-
sion on the /vol directory, so all you have to do is open the icon for the
partition you want to access files and directories from there.
If you have a USB flash memory drive inserted into a USB port, you can
select the USB icon on the bottom of the upper-right panel. The first USB
device should be mounted on /rem/usb and opened by the XFE file man-
ager, for you to access.
■ System monitor—The GNU Krell Monitor is anchored to the lower-right
corner of the screen. By default, it is set to display date/time, CPU usage,
disk activity, network (Ethernet) activity, and memory usage. Select any of
those items to see additional details or configuration information.
■ Dynebolic menu—Right-click the desktop to see the menu of available
applications. Choose from a selection of video, audio, and image-editing
and playing applications. The Files menu offers ways of accessing local
folders (XFE), remote folders (XFSamba and LinNeighborhood), encrypted
storage (Gringotts), and CD burning (gCombust). Some examples of appli-
cations to try are described later.
64 Live Linux CDs
5. Do basic configuration. Select the Getting Started tab if you need to config-
ure certain features. For example, you can change the language, reconfigure
your Ethernet connection (Network), set up a dial-up connection (Modem),
configure printing (Printer), or change video settings (Screen). You can also
set up a Nest feature from the Getting Started screen (described later).
6. Set up Nest. If you are ready to start using Dynebolic and you want to be
able to keep the data you work on, you should consider setting up a type
of persistent desktop that Dynebolic refers to as a Nest. The Nest feature
lets you store the files you store with Dynebolic on a hard-disk partition or
USB drive.
To create a Nest, select the Getting Started tab on the Welcome to Dyne:bolic
window. Then select Nest. Choose either the Nest on Hard Disk or Nest on
USB Key option (if you have a USB key inserted). Choose the amount of stor-
age space you want to consume for your Nest on the disk partition or USB
drive, and select OK.
A file called dynebol.nst is created on the USB drive or hard-disk partition
you selected. Reboot Dynebolic. During the boot process, Dynebolic should
find the dynebol.nst file you saved and ask if you want to use it as your
Nest. Either type Y or wait for it to time out; Dynebolic boots with your nest
now available to be able to save files permanently in your /home, /etc, /var,
and /tmp directories as you use Dynebolic.
Trying Multimedia Applications in Dynebolic
The collection of open-source multimedia tools available in Dynebolic will keep
you busy for quite a while. The following list covers some of the things you can do
with Dynebolic and the applications you can use to do those things:
■ Play video—Mplayer and Xine are among the most popular open-source
multimedia players. Both can play video from a variety of popular formats,
such as MPEG (1, 2, and 4), DivX, Windows Media Video, motion JPEG,
Sorenson SVQ1/SVQ3, and others. Supported audio formats include MP3,
Ogg Vorbis, DivX audio, Real Media, and others. In Dynebolic, Mplayer is
not compiled to use graphical controls (gmplayer), so you need to launch it
from the command line. To see features that Xine and Mplayer support, refer
to their Web pages (http://xinehq.de/index.php/features and http://mplay-
erhq.hu/info.html, respectively).
■ Record and edit video—Dynebolic includes the Kino digital video
recorder and editor and the Avidemux video cutter for working with video. It
also includes powerful command-line recording tools, including mencoder,
ffmpeg, and nuvrec.
CHAPTER 2 Playing with Live Linux CDs 65
Using BackTrack
The approach to BackTrack’s design reflects the kind of features you might expect
from a live CD that is brought in to check or repair a broken system or network.
Here are some examples:
■ Boot messages—Normally when you boot a live CD, messages stream by so
quickly that you can miss something important. BackTrack offers a debug
mode (type slax debug at the boot prompt) to open a shell at several points
during the boot process. If something is wrong, you can correct it from the
shell. If everything is okay, you press Ctrl+D to continue to boot.
When control is handed to the init process, services are started up. If certain
features fail, BackTrack tells you what to turn off from the boot prompt. For
example, if BackTrack fails when starting PCMCIA services, the message on
the screen tells you to type slax nopcmcia the next time you boot. The same
applies if Hotplug fails (slax nohotplug).
■ Boots to a text prompt—BackTrack boots to a text prompt, assuming that
you might not have an available (or working) graphics card. However, six vir-
tual terminals are available (Ctrl+Alt+F1, Ctrl+Alt+F2, and so on).
■ Mounting file systems—BackTrack assumes that you want total access to
your system when you are booting from a security live CD. Every partition
that can be mounted from a storage medium is detected and mounted with
read-write permission turned on. For example, partitions from the first hard
disk (/dev/hda1, /dev/hda2, and so on) are mounted on the /mnt directory
(/mnt/hda1, /mnt/hda2, and so on.). Likewise, USB flash drive partitions
(which are viewed as SCSI devices) are mounted on /mnt/sda1, /mnt/sda2,
and so on.
CHAPTER 2 Playing with Live Linux CDs 67
and click the Scan button. NmapFE displays a list of ports that respond to
the scan (implying that a service is available on that port), as well an indica-
tion of the number of ports that appear to be closed. It also indicates the type
of operating system running on that computer.
■ Sniffers—A network sniffer, such as Ethereal, can monitor an Ethernet port
on your computer to watch all traffic received on that port. Open Ethereal
(select BackTrack q Sniffers q Ethereal), select Capture q Interfaces, and
then click the Capture button for the local interface you want to scan. After a
few minutes, select Stop to see a list of packets received on the interface.
The output from Ethereal shows you the packets sent and received over that
interface. You should see such things as DNS queries, BROWSE packets
from Windows shares, available printer announcements, and (if you are Web
browsing) lots of HTTP GETs. You can sort the data in various ways (by time,
source, destination, protocol, and so on) or select Filter to filter by protocol
type, IP address, or other attributes.
■ Forensic tools—Select BackTrack q Forensic Tools to choose from a vari-
ety of applications for analyzing systems after a suspected attack. A typical
way to do forensics on a hard-disk partition is to back it up to an image file
(select Acquiring Tools and then use a tool such as AIR or the dd command
to create an image file).
The Autopsy Forensic Browser (www.sleuthkit.org/autopsy) provides a graph-
ical interface for investigating problems on UNIX and Linux systems using a
set of Sleuth Kit tools. To start Autopsy in a browser, from Forensic Tools,
select Analysis q Autopsy. You can use Autopsy to run a variety of tests on
that image, such as File Analysis or Keyword Search, as shown in Figure 2-9.
If you find in the course of using BackTrack that you need more information
about problems you encounter, open the Firefox Web browser from the BackTrack
panel. In the Bookmarks toolbar you can find links to locations that provide informa-
tion on security problems. These include links to Milw0rm.com (to look up exploits
by platform, port, or other identifier), Metasploit.com (for penetration testing infor-
mation), Securityfocus.com (for a wide range of security information), and Packet
Storm (http://packetstormsecurity.org, for security tools, exploits, and advisories).
Before you get to boot options, if when you try to boot a live CD, DVD, or USB drive,
your computer ignores it completely and boots straight to hard disk, you might need to
change the system BIOS. As the system is first booting, go to the BIOS screen (by press-
ing a function key, the Del key, or another key as instructed on the screen). From the
BIOS, look for an option that lets you change the boot order so that your CD, DVD, or
USB drive comes before your hard disk. Save the changes and continue to boot.
If you see the live CD or DVD splash screen or boot prompt, you can proceed.
From the boot line prompt for any live Linux CD, you can pass options to the kernel
that tell it how to handle certain types of hardware, or possibly to ignore certain
hardware as you boot up.
The first thing to warn you about is that you have to be quick. From a boot
screen, you typically have only a few seconds to pause the boot process before it
continues on to boot the default system. From an Isolinux boot screen, typing any
letter keeps the boot process from proceeding. From a GRUB boot screen, use the
arrow keys to move to the CD image you want to boot, and press the letter e to be
able to add options to the selected kernel line.
Different live CDs might have different boot options. You enter boot options by
entering the label (such as knoppix or linux), followed by one or more options. For
example, to run Knoppix using US English language and the fluxbox desktop, you
type the following at the boot prompt:
boot: knoppix lang=en desktop=fluxbox
70 Live Linux CDs
Although knoppix is the default label to use as the boot prompt, Knoppix has other
labels available. The expert label lets you interactively configure hardware during
boot-up. The debug label results in more messages when Knoppix boots. The failsafe
label boots with almost no hardware detection. Several other frame buffer labels set
the video display to different resolutions: fb800×600, fb1024×768, and fb1280×1024.
Table 2-2 contains a list of boot options that are available with Knoppix. Most of
these options are listed in the knoppix-cheatcodes.txt file on any Knoppix CD.
Many of them also appear when you press F2 and F3 and the Knoppix boot prompt.
Other boot options that are not listed here can be used to provide special fea-
tures for running Knoppix. They include options for having a persistent desktop,
saving configuration settings, and running Knoppix from RAM or hard disk. Chap-
ter 3 covers the options you can enter to create and use a persistent desktop.
The feature for running a Knoppix live CD entirely from RAM requires a sim-
ple boot options called toram. If you have at least 1GB of RAM available, you can
run your Knoppix live CD from RAM by typing the following at the boot prompt:
boot: knoppix toram
Booting Knoppix with the toram option can take longer to boot because the
entire image must be loaded into RAM. However, performance of the live CD
should then be much improved over running from the CD or DVD. Also, you can
then pop out the CD or DVD and use the drive for other purposes.
SUMMARY
Because live Linux CDs are made to run from read-only media, running a live
Linux CD has some differences from running Linux from a hard disk. Developers of
live Linux CDs have gotten around problems such as slower performance by allow-
ing the system to run from RAM. They have gotten around the read-only issue by
allowing you to save data to memory. Also, by implementing features such as
persistent desktops and nests, the data you save doesn’t just disappear when
you reboot.
This chapter featured several different types of live CD. Knoppix is featured as
the most popular desktop live CD. Games Knoppix contains a large number of
games. BackTrack contains a slew of security-related applications. Exploring how
these and other live CDs work should give you ideas about building your own live
Linux CDs.
CHAPTER 2 Playing with Live Linux CDs 71
Customizing a Live CD
If you find that you love your live Linux CD, you’ll probably want to use it more than
once. The problem is that as soon as you reboot the live CD, you lose all your cus-
tom settings, data, and added applications. The solution is to find a way to save the
data you have changed or added during a live CD session so that it is available the
next time you reboot that live CD.
Remastering (modifying and remaking an existing CD) and starting from
scratch (essentially doing a fresh Linux install that results in a new ISO image) are
two ways to get exactly what you want on your live CD. However, those approaches
require some time and a fair amount of Linux expertise (see Chapters 6, “Building
a Custom Knoppix Live CD,” through 8, “Building a Basic Gentoo Live CD”). Also,
if you are working with a read-only medium, you can’t add software to it as you go
along.
Different live CDs offer different approaches to letting you save your custom
settings, data files, and applications so they can be used the next time you reboot
the live CD. Using those features requires little or no special expertise. And by hav-
ing your data returned to the same places in the file system (such as /home or /etc),
your settings can be automatically used to keep your desktop’s look and feel or
incorporate the system settings you need (network addresses, printers, exported file
systems, and so on).
This chapter begins by covering some great ways of customizing your live CD
systems. Some of these features are ones you can do on most any Linux system
(such as change the desktop look and feel); others offer features that work well on a
live CD (such as setting up the live CD to run in kiosk mode).
Next, the chapter tells you how to set up your live CD so that your data can be
saved and reused from a USB flash memory drive, hard-disk partition, floppy disk,
73
74 Live Linux CDs
CUSTOMIZING A LIVE CD
This section gives you ideas on how to customize your live CD. These techniques
for changing the look, feel, and content of a live CD (without the pain of remaster-
ing) let you really make a live CD your own. Knoppix provides two primary ways of
saving your custom settings: persistent desktop and backup archive. Before you
start configuring the settings you want to save, you should be aware of how these
two approaches differ:
■ Persistent desktop—With this approach, you set up a writeable file-system
image that is stored on a writeable USB flash memory drive or a hard disk.
You should set this up before making customizations because you need to
reboot for this feature to take effect. After that, all custom settings are stored
in that file-system image as they are made.
■ Backup archive—With this approach, when you have your settings and
files the way you want them, you can back them up to a compressed archive
(in bzip2 and tar formats) that is stored on any writeable medium (hard disk,
USB flash drive, or zip drive) you choose. With this approach, you can save
only files in your home directory and settings in the /etc directory. However,
you can save this archive after you make your settings because it backs them
up to a single file.
Refer to the “Keeping Your Customized Files and Settings” section later in this
chapter to learn ways of saving your customizations. That section describes both the
persistent desktop and backup archive approaches.
For several reasons, this section focuses on KDE as the desktop environment to
demonstrate customization techniques. One reason for using KDE is that it is the
default desktop environment for Knoppix. Another is that it is loaded with bells and
CHAPTER 3 Customizing a Live CD 75
When Knoppix boots up, open the KDE Control Center. To do that from the K
menu, select Control Center. Figure 3-1 shows an example of the KDE Control Cen-
ter, with the Appearance & Themes section selected.
FIGURE 3-1 Change KDE desktop settings through the Control Center.
76 Live Linux CDs
You can customize the screen saver to include your own content in several
ways. For example, under Banners & Pictures, you can choose Flag and then
Setup to have any text and bitmapped image you enter wave like a flag.
Select Slide Show to have a folder of images rotated as your screen saver,
using different effects.
Figure 3-2 shows a custom KDE desktop to be used on a live CD that goes with
the LinuxToys.net Web site.
FIGURE 3-2 Add backgrounds, icons, and colors to a customized KDE desktop
on your live CD.
78 Live Linux CDs
To give you some ideas of how you might customize your own KDE desktop
theme, for this example, I made a background that includes logos from my personal
Web site, LinuxToys.net. I chose Kids icons, to go with the fun theme, and red and
black colors from the icon to use behind the background image, for window title
bars, and for link colors. With the logo displayed, I just selected the eyedropper to
choose colors from the logo to use in different locations.
As a screen saver, I created a directory of images that represent inexpensive
projects to build with Linux. I used a Slide Show screen saver to rotate those images
every minute. With KDE, you could also set up the background to show a slide
show, if you like.
If you can’t make the theme you want, you can download tons of whole themes
or individual elements from the KDE-look.org site (www.kde-look.org). These items
are free for you to download. Although you are encouraged to register to participate
in the site, registration isn’t required for downloading themes and elements. If you
have questions about developing themes, refer to the Themes Dev KDE Wiki
(http://wiki.kde.org/tiki-index.php?page_ref_id=18).
FIGURE 3-3 Add custom applications by creating a submenu on the KDE menu.
Autostarting Applications
When KDE first starts up, it launches applications that are included in the
/home/knoppix/.kde/Autostart directory. By default, the only file in that directory
is the showindex.desktop file. Its contents cause the Konqueror window to open,
displaying the Knoppix Info page. Here’s what the contents of showindex.desktop
look like:
[Desktop Entry]
Name=KNOPPIX
# Exec=kfmclient openProfile webbrowsing /cdrom/index.html
Exec=konqueror —geometry 850x600x85x70 file:/cdrom/index.html
Type=Application
Icon=html
Terminal=0
By removing that file, you can prevent the initial Knoppix Info page from start-
ing. To open your own Web page, replace file:/cdrom/index.html with a file you
choose. Or replace the whole address with a Web site (http://www.example.com).
The .desktop file is the same format used to launch applications from the KDE
desktop. If you want to see more examples of .desktop files, refer to the
/usr/share/applications directory on the Knoppix live CD.
For example, files in the /etc/sysconfig directory contain settings used when
Knoppix boots up. The desktop file indicates which desktop environment/window
manager to use. To change your desktop from KDE to fluxbox, change the first line
of /etc/sysconfig/desktop to read DESKTOP=”fluxbox”.
The /etc/sysconfig/knoppix file contains a consolidation of settings relating
to your display, keyboard, language, and other features. The xserver file identifies
your X server (Xorg or XFree86) and X module (such as vesa). The sound file iden-
tifies your sound driver.
Any system-wide configuration you do to set up printers, network connections,
Windows file sharing (samba), Linux file sharing (NFS), or other features that end
up in the /etc directory can be saved with the persistent desktop.
NOTE
The Kiosk Admin Tool is not included on the Knoppix 5 CD included on the
DVD that comes with this book. To try out this feature as described here,
you can use the Knoppix 5 DVD that you can get in several different ways
from the Knoppix.net Web site (www.knoppix.net/get.php).
NOTE
Some of the settings you select in the Kiosk Admin Tool will be overridden
by settings in the /etc/skel directory and by features launched by Knoppix-
specific scripts.
The following procedure takes you through some features of the Kiosk Admin
Tool and suggests some results you might be looking for:
1. Assign a password to the root user. Open a shell and type the following:
$ sudo passwd root
Enter new UNIX password: ********
Retype new UNIX password: ********
2. Select System q Kiosk Admin Tool (to launch the kiosktool command). The
Kiosk Admin Tool window opens on the desktop.
3. From the Add New Profile screen, assign a name, short description, profile
owner (the root user), and directory for this profile. Then select Add. You are
prompted for the root password.
4. Type the root password and click OK.
5. Back at the main menu, with the new profile highlighted, select Setup Pro-
file. The window displays icons representing the components you can lock
down for the profile.
6. Select the component you want to change. A list of items for that component
is displayed. Select the check box next to an item to restrict access to the
component by the user. Figure 3-4 shows an example of the Kiosk Admin
Tool window.
Here are examples of some components you might want to change:
■ General—Items under this heading prevent users from getting access to
features outside of the restricted application you are running. For exam-
ple, you can prevent access to the shell, the window manager context
menu (Alt+F3), the run command box (Alt+F2), the capability to start
another X session, the logout option, and the lock screen option.
If multiple people are using the same login from the desktop, you might
want to disable input line history so a user can’t see what other users have
done before. Also, you can keep all tasks that require root access from
being included on menus available to the user assigned to this profile.
CHAPTER 3 Customizing a Live CD 83
FIGURE 3-4 Configure and lock down KDE components with the Kiosk
Admin Tool.
able to many applications. For example, you can disable File q Save to
prevent someone from saving any displayed information.
■ Desktop sharing—Desktop sharing is off by default. You can enable it
and add invitations if you want others on the network to be able to access
your desktop. Then you can lock down those settings.
■ File associations—You can change which applications are run by default
when different types of content (audio file, image, video file, and so on) are
encountered.
7. When you are finished setting up the profile, select Finished to return to the
main menu.
8. With the profile highlighted, select Assign Profiles.
9. From the Assign Profiles screen, assign the profile to either an individual
user or a group. By assigning the profile to the knoppix user, you ensure that
the settings for the policy will be in use the next time you restart the live CD
(provided that you save the settings using the persistent desktop feature).
10. When you are finished, select File q Quit.
Because you have created a root password in this procedure, you can lock down
other aspects of the knoppix user. For example, you should comment out the line in
the sudoers file that gives knoppix complete access to the running Knoppix sys-
tems. After you comment it out, it should read as follows:
# knoppix ALL=NOPASSWD: ALL
To have the settings you just made be used the next time you reboot, you can
create a persistent Knoppix disk image. Later, when you restart the live CD using
the persistent desktop, as described later in this chapter, you need to indicate that
you want to overwrite stored system configuration files for the Kiosk Admin Tool
features to take effect.
start up the Firefox Web browser in kiosk mode and display a selected Web page
(which you can indicate using a url option from the boot prompt).
Setting up Knoppix to boot to a kiosk desktop is a great way to set up a dedi-
cated Web browser or a presentation with HTML content. You can either use this
feature in tandem with the Kiosk Admin Tool described in the previous section or
combine the kiosk desktop with a window manager other than what you get with the
KDE desktop. This procedure describes how to set up Knoppix to run as a kiosk
Web browser:
1. If you want to change the window manager used for the kiosk, set up a
persistent desktop as described in the “Setting Up a Persistent Desktop”
section.
2. Set the window manager you want to use. Because you will identify kiosk as
the desktop, if you don’t want to use KDE as the underlying desktop environ-
ment; you need to make an additional setting. For example, as described ear-
lier in this chapter, to use fluxbox as the window manager, you can change
the first line of /etc/sysconfig/desktop to read DESKTOP=”fluxbox”.
3. Open the Firefox Web browser (from an icon on the desktop) and change any
setting you want. For example, you can change the default colors, fonts, or
menu bars that are displayed.
4. Save your settings. This happens automatically with a persistent desktop, but
you must do it explicitly (as described in the next section) if you want to back
up the settings to an archive. (If you want to have the data files in your home
directory saved, you have to indicate explicitly that you want to save them.)
5. Reboot your computer, leaving the Knoppix medium in the drive and the
medium holding your saved settings (such as a USB flash drive) still con-
nected to the computer.
6. At the Knoppix boot prompt, indicate that you want to start Knoppix in kiosk
mode and to scan for the persistent desktop. That command line might look
like this, for example:
boot: knoppix desktop=kiosk url=http://knoppix.net home=scan
After the knoppix tag, the desktop option is set to kiosk. The url option indi-
cates the address of the HTML page you want to display when the Web
browser comes up in kiosk mode. Use the home=scan option if you need to
reinstate your settings.
When your desktop boots up, a single application (your Firefox Web browser)
should appear on the desktop. No other applications, panels, or icons should appear
on the desktop. You should be able to begin browsing from that window. However,
this feature alone doesn’t lock down your desktop (for example, you can still press
86 Live Linux CDs
Ctrl+Alt+F2 to get a virtual terminal). So you need to use other features to lock
down your desktop, as described earlier.
FIGURE 3-5
Open ports in your firewall to
allow access to Web, login, and
other services.
2. Select Mode and click OK. By default, Easy is selected (allowing only outgo-
ing connections from your machine).
3. Select Expert and click OK.
4. Select External Devices and click OK. Select the network interface that faces
your network (that is, where you want to offer your services). Typically, this is
eth0 or eth1 for a wired Ethernet card. However, it might be ppp for a dial-up
or ippp for an ISDN connection.
5. Select Open Ports and click OK. Select the names that represent the services
you want to make available to the network. For the server examples that fol-
low, you need to open ports to allow access to a Web server (www and/or
https) and secure login shell (ssh).
6. Select Firewall Active. Then select Start Firewall now and click OK.
7. Select Save Configuration and click OK. Click OK again when you are
warned that you need a persistent desktop (because you should have already
set one up before you started this procedure).
8. Select Cancel to close the Knoppix Firewall Tool.
9. To start the firewall immediately, open a shell and type the following:
# sudo /etc/init.d/firewall start
10. To set up the firewall to start each time you reboot your live CD, type the
following:
# sudo ln -s /etc/init.d/firewall /etc/rc5.d/S15firewall
# sudo ln -s /etc/init.d/firewall /etc/rc0.d/K15firewall
# sudo ln -s /etc/init.d/firewall /etc/rc1.d/K15firewall
# sudo ln -s /etc/init.d/firewall /etc/rc6.d/K15firewall
88 Live Linux CDs
The command just shown adds the firewall script to the /etc/rc5.d direc-
tory in a way that it will be run when the system boots up to the default run
level (5). The other lines cause the firewall to shut down in run levels 0 (off),
1 (single user), and 6 (reboot). The firewall is now in place to proceed to set-
ting up your services.
The settings you just entered in the previous procedure result in settings being
stored in the /etc/sysconfig/firewall file. If you are handy with iptables and you
need to add any special rules that are not available from the Knoppix Firewall Tool,
you can add iptables rules to the /etc/sysconfig/firewall.iptables file.
When prompted, type yes to verify the authenticity of the host. Then enter the
knoppix password you set for the live CD system previously. You can now start
using the live CD from the computer on your network you just logged in from.
The following procedure tells how to set up a thttps Web server from your Knop-
pix live CD in a way that requires very little configuration change. It assumes that
you have already configured your firewall to allow https (port 443) and/or www (port
80) access to your server. To begin, boot up Knoppix in a way that incorporates a
persistent desktop, as described in the next section:
1. To start the thttpd Web server immediately, type the following command:
# sudo /etc/init.d/thttpd start
2. To start the thttpd Web server so it starts up every time you reboot Knoppix,
type the following:
# sudo ln -s /etc/init.d/thttpd /etc/rc5.d/S20thttpd
# sudo ln -s /etc/init.d/thttpd /etc/rc0.d/K20thttpd
# sudo ln -s /etc/init.d/thttpd /etc/rc1.d/K20thttpd
# sudo ln -s /etc/init.d/thttpd /etc/rc6.d/K20thttpd
The command just shown creates a link from the thttpd start-up script to the
/etc/rc5.d directory in such a way that the thttpd server will run when
Knoppix boots to the default run level (5). The other links stop the thttpd
service when you move to a lower run level, including shutdown (0), single
user (1), and reboot (6).
3. Assuming that your network interface is already up and running, determine
the address of your network interface as follows:
# /sbin/ifconfig | grep "inet addr"
inet addr:10.0.0.205 Bcast:10.0.0.255 Mask:255.255.255.0
inet addr:127.0.0.1 Mask:255.255.255.0
In this example, the IP address of the eth0 network interface is 10.0.0.205
(the loopback interface is 127.0.0.1, but this is not the number we are look-
ing for here).
4. From a Web browser on your network, check that the Web server is working
by displaying the index.html page. Do this by typing the following in the
Web browser’s location box:
http://10.0.0.205/index.html
Strictly speaking, index.html doesn’t have to be typed in for this to work.
You should see the sample “Welcome to Your New Home in Cyberspace”
page. If you do, this shows that the server is working and available on your
network.
5. Next, replace the index.html file in the /var/www directory with your own
index.html file, along with any other HTML content that is accessible from
your Web server. Because the root user owns the directory, you need to use
the sudo command to write to it from the shell as the knoppix user.
90 Live Linux CDs
For example, to copy an index.html file from your USB flash memory drive,
you might type the following:
# sudo cp /mnt/sda1/index.html /var/www/
6. Because you set up this server using the Knoppix persistent desktop feature,
to have your content served up when you reboot, you simply have to identify
the location of your persistent desktop at the boot prompt. (Using your per-
sistent desktop image is described in the “Booting with Customized Files and
Settings” section.)
The procedure you just completed uses all the default settings for the thttpd
daemon. To change the default settings, edit the /etc/thttpd/thttpd.conf file. For
example, if you would rather add your HTML content to another location, change
the value of dir=/var/www in the thttpd.conf file to reflect the directory you want
to use. You can also change the default port number (currently, 80), the user run-
ning the thttpd daemon (www-data), the log file used (/var/log/thttpd.log), and
the location of any CGI scripts you want to use (/var/www/cgi-bin, by default).
The thttpd server daemon also has many command-line options available (type
man thttpd). One special feature the thttpd server daemon has is the capability to
do URL traffic-based throttling. Throttle settings can be made in the
/etc/thttpd/throttle.conf file.
NOTE
For some reason, the /var/run/thttpd.pid file was not being consistently
removed when I restarted Knoppix. When that happened, the thttpd serv-
ice refused to start because it believed the service was already up. If this
happens to you, type the following before rebooting:
# sudo rm /var/run/thttpd.pid
If you want to add other servers to your computer, I recommend checking the
/etc/init.d directory for other available services. Most network services repre-
sented by start-up scripts in that directory can be easily started and linked to differ-
ent run directories (to be set to start more permanently) in the same ways that were
done in this procedure. Look for configuration file for those services in the /etc
directory.
CHAPTER 3 Customizing a Live CD 91
You select how much disk space you want to have available, and Knoppix creates
an image file (knoppix.img file) of that size that is formatted as an ext2 file system.
The image file created for your persistent desktop holds the changes you make
throughout the live CD’s entire file system. The next time you reboot your live CD,
you tell Knoppix where to find that image (or have Knoppix scan for it), and its con-
tents are merged back together with the live CD contents.
The following procedure steps you through the process of creating and reusing
a persistent desktop in Knoppix. After that are descriptions of how other live CDs
handle similar features.
1. Insert the USB memory device, zip disk, or other writeable drive. Alterna-
tively, you can use a hard drive on your computer to store the Knoppix image
(of course, it won’t be portable then).
2. Boot Knoppix; then press Enter to boot to the Knoppix desktop.
3. From the KNOPPIX menu in the panel (represented by a penguin icon),
select Configure q Create a Persistent KNOPPIX Disk Image. You are
asked whether you want to create a persistent home directory.
4. Select Yes. You will see a list of devices representing the storage partitions
available on your computer, along with the partition type and the space avail-
able on each. Figure 3-6 shows an example of the window listing available
storage partitions.
FIGURE 3-6
Select the disk parti-
tion for storing your
persistent desktop.
Notice in Figure 3-6 that the first IDE hard drive has two writeable partitions
(hda1 and hda2). A second IDE hard drive has three (hdb1, hdb3, and hdb5).
The USB memory stick has two VFAT partitions (sda1 and sda2). If you have
a SCSI hard drive, it might be listed as /dev/sda instead.
CHAPTER 3 Customizing a Live CD 93
5. Select the partition you want to contain your persistent desktop (check that
there is enough available space on the device to hold your persistent desk-
top) and click OK. You are asked if you want to encrypt your persistent desk-
top using AES 256 encryption (requiring a password of at least 20
characters).
NOTE
The Advanced Encryption Standard (AES) is an encryption algorithm the
U.S. government approved in 2001 for securing nonclassified data. In
2003, AES was approved for protecting U.S. classified information.
AES256, which you can use to protect your persistent desktop in Knoppix,
is the version of AES that uses 256-bit keys.
6. Select Yes if you want to use AES256 (requiring you to enter a long password
and then re-enter that password each time you reboot the live CD to access
your persistent desktop) or No if you don’t want to use a password. You are
asked how large you want to make your persistent desktop.
7. Type a number (in megabytes) to indicate the size of your persistent desktop
and select OK. This results in a file of the size you indicate (called
knoppix.img) being placed on the disk partition or USB drive. That image
file will be used to hold all data you store on the file system as you use
Knoppix. It takes a few moments to create the image file. If you selected to
use an encrypted password, you are prompted to enter that password.
8. Type at least a 20-character password, verify it, and select OK to protect your
saved persistent desktop. A message appears letting you know that the image
was successfully created.
At this point, the knoppix.img file exists but is not yet in use. For that to hap-
pen, you need to reboot. Before you do, however, two tips relate to your persistent
desktop:
■ Leaving images around—If you don’t password-protect your persistent
desktop image, it is essentially unprotected. Knoppix creates the image with
the knoppix user as the owner and permissions open (rwxrwxrwx). If you
leave your USB memory stick lying around or forget to remove knoppix.img
from the hard disk of the person’s computer you are working on, other people
will have access to your personal settings and data.
94 Live Linux CDs
settings that are stored in your home directory (such as those KPPP
created).
■ Graphics subsystem settings—Select this to save settings related to
your video card and monitor that your X display server (XF86Config) uses.
■ Other system configuration—Select this to save other system-
configuration files in the /etc directory. These might include files for
storing printer, scanner, sound, or password settings.
You are asked where you want to store your configuration settings.
4. Choose the location where you want to store your configuration settings and
click OK. If you selected to save to floppy disk, you are asked to insert a
floppy disk.
5. Insert a floppy disk and select OK. The archive is created. When it is fin-
ished, a pop-up tells you that the configuration is complete.
At this point, you should have custom settings saved on your floppy disk or
other medium. The knoppix.sh file is the script that is executed to restore the files
from the compressed archive (configs.tbz file). Here are some suggestions on how
you might want to modify those two files:
■ knoppix.sh—Instead of just using the knoppix.sh file that is created during
this procedure, you can modify that script or create one of your own. Having
your own knoppix.sh file is another way you can customize your live CD
without remastering the KNOPPIX/KNOPPIX file that contains the read-only
Knoppix file system from the CD. That script can copy or change the files
contained in your live CD’s file system as you like.
■ configs.tbz—All the files from /etc and from your home directory that you
selected to store are combined into a single archive file (a tar file) that is
then compressed using the bzip2 utility. So you can manipulate the contents
of that file as you would any tar archive. Because the knoppix.sh script
expects the file in configs.tbz to contain full paths, you need to add and
remove files from that archive using full path names.
To change the contents of your configs.tbz file, you can start by copying the
file to a temporary directory, unzipping it, and then adding and removing
files as you please. Here is an example of how to do that. It starts by assum-
ing that your configs.tbz file is on /mnt/sda1 and that you have enough
space in your /tmp directory to edit this file. You can do this:
$ cp /mnt/sda1/configs.tbz /tmp
$ cd /tmp
$ bunzip2 configs.tbz
96 Live Linux CDs
Now, with the archive unzipped to the file configs.tar, here are a few com-
mands for adding and removing files from your archive. The —list option to
tar lists the contents of the tar archive. The —delete option is used here to
remove the file /etc/X11/XF86Config from the archive. The -r option is
used to add the file /home/knoppix/index.html to the archive (with -P indi-
cating to keep the leading /). After that, the archive is zipped up again and
returned to its original location.
$ tar —list —file=configs.tar |less
$ tar —delete —remove-files —file configs.tar /etc/X11/XF86Config
$ tar -r —file=configs.tar -P /home/knoppix/index.html
$ bzip2 configs.tar ; sudo cp configs.tar.bz2 /mnt/sda1/configs.tbz
At this point, the modified configs.tgz file is ready to be reused the next
time you reboot Knoppix.
Whether or not you change knoppix.sh or configs.tbz, to restore your setting
the next time you reboot, you simply have to add an option to the boot line when you
start your live CD. Available options are described in the next section.
across reboots. The following sections describe how you can use several different
live CDs to save your data.
FIGURE 3-7 Backup files and settings using the DSL Backup/Restore tool.
CHAPTER 3 Customizing a Live CD 99
To see what files and directories will be backed up using this procedure, open
the file /home/dsl/.filetool.lst in any text editor. You can add and delete files as
you like from this file.
To restore your saved applications, you can use the mydsl option. For example,
if your applications are on the first partition of your USB drive (sda1), you could
type the following at the boot prompt:
boot: dsl mydsl=sda1
100 Live Linux CDs
Of course, you can add multiple boot options with DSL, as you can with any live
CD. For example, to restore your backup archive and applications from sda1 and
have DSL run entirely from memory, you can type the following from the boot
prompt:
boot: dsl restore=sda1 mydsl=sda1 toram
FIGURE 3-8 Dynebolic lets you create a Nest to save your settings.
To enable your Nest, you need to reboot Dynebolic. When it comes up, it looks
for the nest file, named dynebol.nst. It is actually a writeable ext2 file system
CHAPTER 3 Customizing a Live CD 101
image mounted in loopback. All files saved to /etc, /home, /tmp, and /var while
Dynebolic is running are written to this image.
NOTE
Because Puppy Linux creates and uses a file system image on an available
disk partition without telling you, it is important to first know that it is
there. Then it is important to remove that image if you are using Puppy
Linux on someone else’s computer. Later versions of Puppy Linux might
handle this issue differently.
Another interesting feature available for Puppy Linux is the multisession live
DVD feature. Making use of a special version of Puppy Linux and burning it to a
DVD using the growisofs command, the session can remain open to allow further
files to be written to the DVD. You can read about how this feature works on the
Puppy Multi-Session Live CD page (www.puppylinux.com/multi-puppy.htm).
to boot from one of those ports. This section describes how to create a bootable
Linux live USB flash drive using Damn Small Linux (DSL). Configuring DSL in this
way requires no special knowledge of Linux.
The procedure for adding DSL so it can boot from a USB flash drive (which is
referred to as a “Pendrive”) can be done with just a few easy clicks from the DSL
desktop. All you need to get started are as follows:
■ A USB flash drive—Because DSL is only about 50MB total size, the mini-
mum size USB drive you need is 64MB. However, if you plan to add any
data, at least 128MB is recommended. I use a 1GB drive, which allows me to
keep music, documents, and some extra applications on the drive.
■ Damn Small Linux—You can use the version of DSL that is included on
the DVD that comes with this book. You can burn the DSL ISO image from
that DVD and boot it to start this procedure (or simply boot DSL directly
from the DVD).
With DSL booted and your USB flash drive handy, run the procedure that fol-
lows to install DSL on a USB flash drive:
1. Determine the device name of your USB flash drive. This is very important
because this procedure erases the contents of that drive. Type fdisk -l to
see the available storage devices (hard disks, USB flash drives, Zip drives,
and so on). USB flash drives appear as SCSI devices. So, if you have no other
SCSI hard drives or other devices on your computer, your USB flash drive
will probably be available from /dev/sda.
2. From the DSL desktop, select Apps q Tools q Install to USB Pendrive.
3. Select either For USB-ZIP Pendrive or For USB-HDD Pendrive. Which type
of selection you use should depend on where you expect the USB drive to
be run:
■ Any machine—Some older PCs only include BIOSs that can boot from
USB drives that use the older USB-ZIP specification. To boot in this way,
the partition that is booted on the USB drive must be smaller than is
allowed for USB-HDD specification. As a result, if you select USB-ZIP,
DSL creates a small boot partition and assigns the rest of the space on the
USB flash drive to a second partition.
The USB-ZIP procedure creates a boot loader using Syslinux instead of
Isolinux. The Syslinux bootloader basically emulates a floppy boot, while
Isolinux emulates an El Torito live CD boot. Because most PCs can boot a
floppy disk image, installing DSL as a USB-ZIP install results in a USB
flash drive that can boot on both older and newer PCs.
CHAPTER 3 Customizing a Live CD 103
■ Newer PCs—Most newer PCs will let you select the USB-HDD boot type.
When you select USB-HDD Pendrive install from DSL, only one partition
is created on the USB flash drive. Older PCs might not be able to boot this
type of device.
The USB Pendrive Installation screen appears, displaying information
about the installation you are about to perform.
4. If you are ready to proceed with installation, type y and press Enter. You are
asked whether you want to display your USB storage device information log.
5. Type Y to view information about your USB storage device. (When I ran this,
the device from my USB drive, sda, appeared in green.) You are asked if this
is an installation or upgrade.
6. Type i to begin an installation. You are asked for the target device name.
7. Type the device name representing the USB device and press Enter (sda is
the most common if you have not other SCSI devices). You are asked where
you want to get the DSL image.
8. Type L to get the DSL image from the live CD. Alternatively, you could
choose F (for file) or W (for Web) to get the image from a local file or from a
location on the Web. You are asked whether you want to add any boot time
options.
9. Add any options you like. For example, you might want to have services start
ups, such as printing (lpd), FTP service (ftp), or NFS (nfs).
10. Choose a language (such as cs, da, de, es, fr, nl, it, pl, ru, sk), if you are
selecting a language/keyboard other than Linux. Press Enter to just accept
English. You receive your final warning that everything on the device you
entered will be destroyed.
11. If you are sure that you have that right device name and that it is okay to
erase it, type y and press Enter. The USB flash drive will be repartitioned
(into either one or two partitiond). Then, in the case of USB-ZIP, boot files
will be placed on the first partition (/dev/sda1) and all other files will go on
the second partition (/dev/sda2). When the install is complete, you are asked
to press Enter.
12. Press Enter. Your USB flash drive should now be configured.
The USB flash drive should now be ready to boot on an available PC. Insert the
USB flash drive into a USB port on an available PC and reboot. If DSL doesn’t boot
(the PC bypasses the USB flash drive and starts your normal boot from hard disk or
CD), reboot again and run Setup before you see the boot prompt to change BIOS
settings. From the selection that lets you set the boot order, be sure that the USB
104 Live Linux CDs
drive (USB-HDD or USB-ZIP) appears in the boot order before any other drive (CD
or hard disk) that might boot.
If you want to add data or applications to your DSL USB flash drive, the larger
amount of space from the flash drive is available from these directories: /home, /opt,
/tmp, and /var. I recommend you use one of those locations to add content to your
USB flash drive.
SUMMARY
By their nature, live Linux CDs usually are run from a read-only CD or DVD, so
making and saving custom settings and data that you create during live CD sessions
has always been an issue. By including popular desktop environments (such as
KDE) and many configurable features (printers, network interfaces, and servers, for
example), you have no shortage of ways to customize a running live CD system.
Live CD developers have come up with innovative ways to keep the settings and
files you create during a live CD session. The first solutions focused on backing up
changed files to a compressed archive file. When the CD was rebooted, those files
could then be restored to where they were needed. A more recent solution is to cre-
ate a persistent desktop that relies on a writeable disk image stored on a local hard
disk or USB flash memory drive.
With persistent desktop images, changes are immediately applied to the write-
able medium. When you reboot, the files are still available from their same loca-
tions, without having to back them up. Combining a writeable file system image
with a UnionFS file system means that the persistent desktop doesn’t have to be
restricted to the /home and /etc directories. Files throughout the entire file system
can be can be changed and then merged with files from file systems mounted from
read-only live CDs and DVDs.
Examples of customizing and saving customizations associated with a live CD
in this chapter were done using Knoppix. However, because many other live CDs
are based on Knoppix, these techniques work with other CDs as well. Later, the
chapter also described techniques for customizing settings, files, and even applica-
tions for live CDs such as Damn Small Linux, Dynebolic, and Puppy Linux.
LIVE LINUX CDS
Part II
Creating a Custom
Bootable Linux
105
This page intentionally left blank
CHAPTER 4
From the moment you turn on your computer to the time when the operating system
and services are up and running from your live CD, a lot of activities take place. As
someone who wants to create and use live CDs, you can mold nearly every aspect of
that process.
By learning how live Linux CDs work, you enter some of the magical areas of
how BIOSes and boot loaders operate before Linux even starts up. Seemingly no
less magic, however, are special live CD scripts (such as linuxrc) that enable the
features needed to set up the environment in which the live CD will run.
Following along with the process of how a live CD boots up takes you on the
road to creating your own live CD. To get beyond point-and-click customizing
described to this point in the book, however, you must bring some knowledge of
Linux with you. In other words, the book covers special live CD file systems (such
as Squashfs and UnionFS) but expects you to already know how to mount, list, and
get around file systems in Linux.
NOTE
Although I won’t discourage you from trying the projects described in this
book, if you are not familiar with Linux, you should at least get hold of a
good reference book on the subject. In particular, you should become
familiar with the shell and common shell commands.
107
108 Live Linux CDs
live CDs) start up a script that prepares the operating system to run. In
Knoppix, that script is called linuxrc and is located in the root directory of
the live CD.
■ Init process (SystemV init)—By the time the live CD hands off control to
the init process, most setup that is specific to a live CD has already been
accomplished. Services that the init process start up provide system serv-
ices (such as the system log facility) and network services (such as Web, FTP,
or remote login services).
■ Desktop—If the live CD includes a desktop system, that desktop can be set
to launch automatically when the live CD boots up. Getting the desktop
working typically requires the live CD to properly detect the available video
hardware (or guess at some good default settings) and configure the X display
server (using an X.org or XFree86 X server).
Figure 4-1 illustrates the boot process for a Knoppix live CD. Aside from some
of the particular scripts that Knoppix uses during the boot process, the boot process
is similar on most live Linux CDs.
Turn on switch
ON BIOS
(Set to boot CD)
OFF
PC init
(Start Linux services)
xsession
other
linux (boot kernel) services
minirt.gz (unpack)
Memory
linuxrc
File (Set up file system,
Systems load drivers)
Knoppix desktop
FIGURE 4-1 Nearly every aspect of a live CD boot process can be customized
(from boot-up to desktop display).
110 Live Linux CDs
If an inserted live CD is bypassed during the boot process, you should check
the boot order to make sure that it appears in the boot list before the medium
(probably the hard disk) that actually booted. Also, other media that you
might want to boot from (such as a USB device or Zip drive) likely will not be
in the default boot order list; you must change the boot order to boot from
those devices.
In most cases, a PC’s BIOS is set so that simply inserting a live Linux CD into a
computer’s CD drive and rebooting cause the boot information on the CD to be
found and booted. However, with some computers (especially older ones), the boot
order doesn’t include the CD drive before the hard disk. A more likely problem with
older computers, however, is that a computer’s BIOS doesn’t include less popular
boot devices (such as a USB drive or Zip drive) in its boot priority order.
In other cases, BIOS is supposed to be capable of booting from a particular
drive, but some bug in the BIOS prevents that from happening. In those cases, you
might try to track down an updated BIOS for your computer.
message that tells you which key to press to go into Setup (such as the F2 function
key or the Delete key) and press that key. At this point, you should enter a BIOS
setup utility.
The BIOS setup utility should tell you some things about your computer that
will help you boot a live CD. It also should give you the opportunity to change some
of those settings. Here are some items to look for:
■ Boot order—This is the most likely feature you will need to change in your
BIOS to use your live CD. Because many BIOS setup utilities are different,
you need to look for and select a heading that reads something like Boot.
Under the Boot heading, you should see a listing of boot devices, shown in
priority order. Some PCs will let you simply select floppy, CD, and hard
drives; others enable you to boot from a variety of devices. Figure 4-2 shows
an example of a boot priority order for the BIOS on an IBM Thinkpad.
FIGURE 4-2 Some BIOS setups let you choose from a variety of boot devices.
Follow the instructions to make sure that the device you want to boot from
appears in the boot order before another device (in particular, your first hard
112 Live Linux CDs
disk) is booted. Notice in this example that the first USB floppy disk drive
(FDD) is checked for boot media. Then regular (legacy) floppy drives are
checked, followed by a regular ATAPI CD drive and a USB CD driver.
As noted on this screen, you might need to enable support for USB devices
before you can boot from a USB floppy, CD, or flash drive. You should also
note that entries for booting from USB flash drives typically do not appear
before hard disks in the boot order, by default.
■ Total memory—By checking the amount of available RAM, you can see
whether enough memory is available to meet the minimal required memory to
run the live CD you are choosing. This also tells you whether you can use the
toram boot option (with live CDs such Knoppix and Damn Small Linux) to
load the entire live CD image to RAM and run it from there.
■ BIOS version—Usually on the first setup page, you will see information
about the version of BIOS being used. If you are unable to select the device
you want to boot, or if you believe that your live CD won’t boot because of a
bug in the BIOS, you can see whether an update for your BIOS is available.
Start looking for BIOS updates at the Web site for the manufacturer of your
motherboard. Although most BIOSes are based on those that come from only
a handful of BIOS vendors (Phoenix Technologies, Award Software Interna-
tional, and so on), because the manufacturers often adapt the BIOS they get
from one of those companies, the original BIOS vendor typically won’t have
the updated BIOSes available.
NOTE
Updating your BIOS is dangerous. If you try to update (flash) your BIOS
and you are using the wrong BIOS, or if an error occurs, you can render
your motherboard useless. Therefore, if you decide to update your BIOS (as
described in the following paragraphs), you do so at your own risk.
BIOS updates for older computers are usually offered as files that create floppy-
disk images that you can download directly from the motherboard manufacturer’s
Web site. Often you can just click on one of these files from a Windows desktop to
automatically write a boot floppy containing the update to a floppy disk inserted in
your computer.
As motherboard manufacturers adapted to the fact that not everyone has a
floppy drive anymore (and that not everyone uses Windows), BIOS updates have
become available in different formats. For example, Intel now offers BIOS updates
in the following formats:
CHAPTER 4 Understanding How Live Linux CDs Work 113
If your computer is running Linux and the only way you can get the BIOS
update you need is in the form of a floppy image, you can convert that floppy image
to a bootable ISO image and burn it to CD. The “Motherboard BIOS Flash Boot CD
from Linux Mini HOWTO” describes how to make a boot CD that incorporates an
updated BIOS so you can flash that BIOS to your motherboard. You can find that
mini HOWTO at www.nenie.org/misc/flashbootcd.html.
Before you update your BIOS, view your current BIOS settings (press F2 or
another key as required when you turn on the computer). You should write down all
settings that you have changed because you might lose those settings during the
update process. With some BIOSes, you have the choice of saving custom defaults.
If that is the case, when the BIOS is updated and the settings are cleared back to
the defaults, you will have the opportunity to restore those custom settings.
bootable. When the BIOS tries to boot an El Torito CD, information about how to
boot that CD is sought in the following order:
■ Boot record—The BIOS looks for a boot record volume descriptor that
resides in sector 11 in the last session on the CD. This boot record points to
the boot catalog.
■ Boot catalog—A boot catalog contains a list of boot entries. Each entry in
the boot catalog points to a boot image, if that boot entry is selected.
■ Boot image—The boot image represents the operating system that is
launched for the selected entry. Instead of being a complete operating system
or a boot loader, the boot image can represent a specialized boot floppy image.
You can see where each of these items came from when someone first created
the live Linux CD ISO image using the mkisofs command. This is an example of an
mkisofs command line to create a bootable live Linux CD ISO image:
In this example, a boot record is created that points to the boot catalog file
(boot.cat, located in the isolinux directory on the CD). The boot.cat file was cre-
ated automatically by the mkisofs command and points to the isolinux.bin file
(located in the isolinux directory on the live CD). The isolinux.bin file is the boot
image that represents the second stage of the boot process. When launched,
isolinux.bin starts the Isolinux boot loader. The isolinux.bin file enables the
user to select bootable images listed in the isolinux.cfg file.
NOTE
Different boot loaders come with their own stage2 boot images. For exam-
ple, for the GRUB boot loader, instead of isolinux.bin, you can use the
stage2_eltorito boot image included with the GRUB package.
The El Torito boot image can be booted in different modes. As someone running
a live CD, you don’t need to know the mode in which this image is running. How-
ever, as someone building a live CD, you need to tell the mkisofs command which
mode this boot image was built to run in. The -no-emul-boot option to mkisofs
shown earlier indicates that this live CD boots in El Torito no emulation mode. You
can boot an El Torito CD in the following emulation modes:
116 Live Linux CDs
When the El Torito boot image starts up, the boot loader takes over the process
of booting the computer.
■ Splash screen—The initial boot screen and any message screen available
during the boot process can also include an image, sometimes referred to as a
splash screen. For Isolinux, images must be in a special LSS 16-color format
(described in Chapter 5, “Looking Inside Live CD Components”). GRUB
allows someone creating a live CD to use an image in gzipped XPM format.
■ Message screens—Live CDs that use the Isolinux boot loader usually
include additional message screens you can display by pressing different
function keys. The live CD developer identifies the files representing these
screens in the isolinux.cfg file by assigning each file to a function key from
F1 through F10. Function keys from F1 through F9 are each represented by
those tags, and the F0 tag represents the F10 function key.
By simply pressing Enter or waiting for the live CD to time out, someone using
a live CD has it boot the way that the live CD creator most commonly intended the
live CD to be used. The default boot image (in our case, typically a Linux kernel at
this point) is started with a file system that is provided from an initial RAM disk
(typically, a compressed file-system image).
Along with the kernel and the initial RAM disk, a useful set of options is typi-
cally appended to the kernel command line. For an Isolinux boot loader, that infor-
mation is defined in the isolinux.cfg file when the live CD is created.
Different labels are made available from the live CD for a variety of reasons.
For example, typically special labels exist for booting with different types of hard-
ware (especially for different video modes). The live CD developer might also have
included several different floppy boot images on the CD.
You can tailor Isolinux or GRUB boot loaders to have the live CD behave the
way you want it to. You can present a simple boot prompt, menus, or images. Then
you can allow the user to choose exactly what to boot (by selecting a boot label
and/or adding options), or bypass the user altogether and proceed straight to boot-
ing the operating system. These choices and others are covered in descriptions of
the Isolinux and GRUB boot loaders in Chapter 5.
The next section describes how the live CD boots the Live Linux system after
continuing forward from the boot loader. The description focuses on booting Knop-
pix as your selected live CD.
Based on this label, the boot loader identifies the kernel named linux as the
one to boot and the minirt.gz file as the initial RAM disk (both of which are stored
in the isolinux directory). Other information shown on the APPEND line is passed as
options to the linux kernel to be used later in various ways. Options that the user
might have added to the knoppix label at the boot prompt (for example, knoppix
nodma to turn off DMA support on local disk drives) are added to the end of the
appended options.
One of the first things the linux boot image (containing the Linux kernel) does
when it starts up is unzip (using the gunzip utility) and mount the initial RAM disk
(minirt.gz). minirt.gz is the root file system that the linux boot image uses; it con-
tains the minimum amount of software needed to set up the full Knoppix system.
Most of the files that the ultimate Knoppix system needs are contained in the KNOP-
PIX compressed image file in the KNOPPIX/ directory on the CD.
With the linux boot image running the Knoppix kernel and the minimum file
system mounted (minirt.gz), the linuxrc script in the root directory can kick in.
The linuxrc script relies on a couple of nonstandard directories it uses during
setup that are contained on the minirt root-mounted file system: /modules and
/static:
Both /modules and /static will be deleted later in the Knoppix boot process.
In the mean time, however, those directories contain important components needed
to set up the Knoppix environment. To see what’s in these directories, as well as
other components, you can start by unzipping the initial RAM disk file and mount-
ing it in loopback. With a running Knoppix system, here’s how to check out the con-
tents of the initial RAM disk file:
1. Unzip and mount the minirt.gz initial RAM disk:
$ cd /cdrom/boot/isolinux
$ gunzip -dc minirt.gz > /tmp/minirt.ext2
$ sudo mkdir /tmp/mini
$ sudo mount -o loop -t ext2 /tmp/minirt.ext2 /mnt/mini
2. List the contents of the initial ram disk:
$ ls -CF /mnt/mini
KNOPPIX/ boot@ dev/ lib@ media/ modules/ proc/
static/ tmp/ bin@ cdrom/ etc/ linuxrc* mnt/
opt@ sbin@ sys/ usr/
You can see from this output which items are directories (/), which are links to
other directories (@), and which are executable files (*). This is the actual file sys-
tem that Knoppix adapts into the file system that it will ultimately use when Knop-
pix is finished booting. So, when directories such as /static and /modules are done
being used, they are removed.
NOTE
When you try to remaster Knoppix later, as described in Chapter 6, “Build-
ing a Custom Knoppix Live CD,” you might decide that you want to make
your own initial RAM disk to include (or exclude) drivers or add commands
to run. With that file unzipped and mounted as described already, you can
make any changes you like. When you are done, just unmount the file
(umount /mnt/mini) and zip up the file again (gzip /tmp/minirt).
After the initial ram disk is mounted, it’s time to start setting up the file system
and additional drivers to run the live CD. Knoppix, Fedora, and live CDs built with
other technology use a linuxrc file to set up the live CD environment. How those
components are directed to set up the Knoppix environment mostly comes from a
script that is located in the root of the initial RAM disk: the linuxrc file.
120 Live Linux CDs
NOTE
Instead of using the file system from the initial RAM disk going forward, as
Knoppix does, Fedora live CDs built using kadischi set up the permanent
file system structure separately from the initial RAM disk. When the new
environment is set up, the pivot_root command is run to change the run-
ning kernel to use the new file-system structure.
to be set that are used later in the linuxrc script. Many of the values con-
sumed here turn off features (noscsi, nousb, or nofirewire, for example) or
set modes of operation (such as debug or expert modes).
■ Sets the location of KNOPPIX—The KNOPPIX_DIR variable sets the
directory containing the Knoppix image file (the KNOPPIX directory, by
default). The KNOPPIX_NAME variable sets the name of the Knoppix archive
(KNOPPIX, by default). This image file contains a compressed archive of
most of the file system (file, directories, applications, settings) used to run
Knoppix. As a result, the Knoppix image is located at /KNOPPIX/KNOPPIX
from the root of the CD’s file system.
NOTE
If you ever set up a live DVD to contain multiple versions (or derivatives) of
Knoppix, changing the value of KNOPPIX_DIR in the linuxrc file for the ini-
tial RAM disk of each version can allow multiple Knoppix distributions to
coexist (and be bootable) from the same disk. For example, one distribu-
tion could use /KNOPPIX/a as the location of the KNOPPIX file-system image.
Another might use /KNOPPIX/b, and so on. If you name the initial RAM
disks differently (minirta.gz, minirtb.gz, and so on), different labels can
point to different versions.
■ Runs in different modes—If debug was set as a boot option, linuxrc sets a
special shell to start up in debug mode. If expert mode was set as a boot
option, the person running the live CD is asked whether they want to install
additional modules from a floppy disk.
■ Probes and configures devices—The linuxrc script checks for PCI
devices (cat /proc/pci) and searches that output for SCSI devices that
might require modules to work. It also checks and tries to install modules for
any IDE raid devices, USB devices, and Firewire devices.
■ Finds KNOPPIX—With all available CD and hard-drive storage devices
(IDE, SCSI, etc.) now properly detected and configured, the linuxrc script
tries to find the KNOPPIX archive that will be used to make most of the
KNOPPIX file system available (including the applications and settings).
■ Mounts KNOPPIX—When found, the KNOPPIX image is mounted. If
multiple KNOPPIX images are found, they are mounted as KNOPPIX2,
KNOPPIX3, and so on. Each image is mounted as a cloop device, so as files
and directories are requested from one of those file systems, they can be
uncompressed on the fly.
122 Live Linux CDs
If the person running Knoppix requested to have the KNOPPIX image writ-
ten to and run from hard disk (tohd) or RAM (toram), linuxrc makes sure
enough space is available to write KNOPPIX there. The linuxrc script also
checks whether the user asked for KNOPPIX to be booted from hard disk or
from an ISO.
■ Mounts RAM disk—After checking for a reasonable size to create a RAM
disk, linuxrc creates a RAM disk (/ramdisk). Writeable directories are cre-
ated on /ramdisk that can be used (via symbolic links) elsewhere in the file
system. These locations include /home and /tmp.
■ Creates the UnionFS file system—To make all the read-only directories
from the live CD available as read-write directories, the linuxrc scripts
merges them with writeable directories on /ramdisk using UnionFS. To see
which directories are linked from the UnionFS file system (/UNIONFS), type
ls -l / | less with Knoppix booted. Chapter 5 describes how UnionFS is used
to enable you to write to merged read-only directories (from the CD) and
read-write directories (from the RAM disk).
■ Sets up the /etc directory—Certain files and directories in the /etc
directory cannot be links but must be real files. To make sure that this is
true, the linuxrc script removes files in the /etc directory that include
ftpusers, passwd, shadow, gshadow, group, ppp, isdn, ssh, ioctl.save, init-
tab, network, sudoers, init, localtime, dhcpc, and pnm2ppa.conf. It then
copies real versions of these files from the CD.
■ Performs final cleanup—To clean up the /etc/mtab file, the linuxrc
script grabs information from /proc/mounts. It then removes the /linuxrc
file and exits.
With the linuxrc script finished, control of the boot process is passed to the
Linux kernel. The kernel then passes control to the init process.
To understand what happens after init starts up, follow the settings in the
/etc/inittab file. Unless overridden, Knoppix starts at run level 5, based on this
entry in the /etc/inittab file:
id:5:initdefault:
Entries identified as sysinit processes are executed when init first starts up.
The following entry in /etc/inittab causes the rcS script to run all init scripts
that begin with the letter S and are located in the /etc/init.d/rcS.d directory to be
executed:
si::sysinit:/etc/init.d/rcS
By default, the only script that is set to start at system initialization (from the
/etc/rcS.d directory) is the knoppix-autoconfig script. The link S00knoppix-
autoconfig points to the /etc/init.d/knoppix-autoconfig script. This is where a
lot of Knoppix configuration occurs. (The knoppix-autoconfig script is described a
bit later.)
The next set of lines in the /etc/inittab file indicate what is launched next,
based on the current run level. (For the run level to be something other than 5, you
must have changed the value of the initdefault line or passed a run level number
as a boot option.) Here are the lines:
# What to do in single-user mode.
~~:S:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1
10:0:wait:/etc/init.d/knoppix-halt
11:1:wait:/etc/init.d/rc 1
12:2:wait:/etc/init.d/rc 2
13:3:wait:/etc/init.d/rc 3
14:4:wait:/etc/init.d/rc 4
15:5:wait:/etc/init.d/rc 5
16:6:wait:/etc/init.d/knoppix-reboot
Valid run states that you can boot into include single-user modes (S or 1) and
multiuser modes (2, 3, 4, or 5). In single-user mode (S), Knoppix opens a root shell
and starts no other services. In single-user mode (1), Knoppix runs the
/etc/init.d/rc script with 1 as an option. This causes all scripts beginning with S
124 Live Linux CDs
in the /etc/rc1.d directory to be started. Likewise, the other run states you might
boot to (2, 3, 4, or 5) each run scripts starting with S from their run level directories
(/etc/rc2.d, /etc/rc3.d, and so on).
In Knoppix, because it is primarily a desktop system, services that might be run
on a server system from those directories (such as Web server, FTP server, MySQL
server, and so on) are not enabled (that is, added to those directories) by default.
NOTE
Many of the scripts representing services are available in Knoppix in the
/etc/init.d directory. So if you were creating your own custom Knoppix,
you could link any of those scripts to a file in any runlevel directory to get it
to run at that runlevel. For example, while you were customizing Knoppix,
you could type the following:
# ln -s /etc/init.d/apache2 /etc/rc5.d/S85apache2
This command creates a link from the apache2 script (for starting the
Apache Web server) to a file (S85apache2) in the /etc/rc5.d directory. The
next time the computer enters runlevel 5 (the default desktop runlevel), the
Apache Web service will start up.
The other scripts that are run when you change run levels begin with the letter
K. For example, if you changed from run level 5 to run level 3, the K10xsession
script would be run to shut down your X server (the desktop interface) and drop you
to a shell. The desktop is turned off at every run level except run level 5, so this is
one of the first services shut off when you shut down the computer (run level 0) or
reboot (run level 6).
As you might guess from the previous sentence, you should never set your run
level to 0 or 6. With the run level set to 0, your system would simply shut down
when init kicked in. With it set to 6, it would continuously reboot. Most Linux sys-
tems are set to 5 (to boot to a desktop) or 3 (to boot to a predefined set of services,
but no desktop). There are historical meanings to run states 2 and 4 from old UNIX
systems, which no longer have much meaning.
The next set of lines in the /etc/inittab file that apply to starting up Knoppix
have to do with starting up virtual terminals:
# 4 virtual consoles with immortal shells
1:12345:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1
2:2345:respawn:/bin/bash -login >/dev/tty2 2>&1 </dev/tty2
3:2345:respawn:/bin/bash -login >/dev/tty3 2>&1 </dev/tty3
4:2345:respawn:/bin/bash -login >/dev/tty4 2>&1 </dev/tty4
CHAPTER 4 Understanding How Live Linux CDs Work 125
These lines show that one bash shell is started as a login shell that is connected
to a specific tty device (/dev/tty1) for run levels 1 through 5. For run levels 2, 3, 4,
and 5, three additional run levels are created (tty2 through tty4). You can get to
those different virtual terminals by pressing Ctrl+Alt+F1, Ctrl+Alt+F2, and so on.
Virtual terminals are a useful way to get to a shell if your desktop interface becomes
scrambled.
The last line in the /etc/inittab file that relates to starting up your system has
to do with starting up your X desktop. When Knoppix goes into run level 5 (the
default), the following lines are the last ones that are executed:
# Run X Window session from CDROM in runlevel 5
w5:5:wait:/bin/sleep 2
x5:5:wait:/etc/init.d/xsession start
After pausing for 2 seconds (sleep 2), the xsession script is run with the start
option. The xsession script starts your X desktop interface based on settings that
were determined during start-up (stored in the xserver and knoppix files in the
/etc/sysconfig directory). It also tries to load modules that could be useful for run-
ning your video card (such as loading AGPGART and DRM modules).
At this point, your Knoppix desktop interface should have started up and you
should be ready to start using Knoppix.
Understanding knoppix-autoconfig
When the init process takes over during a Knoppix boot-up, the knoppix-autocon-
fig script is run from a link in the system-initialization directory:
/etc/rcS.d/S00knoppix-autoconfig. By looking at this file, you can see how a lot
of runtime features are set in Knoppix. When you go to customize your own live CD,
this is a script you might consider modifying.
Here are some highlights of the processing that occurs in the knoppix-autocon-
fig script:
■ PATH—The PATH (where the shell finds the commands you run) is set to
include /bin, /sbin, /usr/bin, /usr/sbin, and /usr/X11R6/bin. This is sig-
nificant because, even for nonroot users (for example, the default knoppix
126 Live Linux CDs
user), the /sbin and /usr/sbin directories, typically used only by root, are
included in the PATH. This is probably because Knoppix expects the regu-
lar knoppix user to run system-administration commands using the sudo
command.
■ Colors—Colors are defined in this script so they can be used to indicate dif-
ferent types of information, as they are in the linuxrc script. As Knoppix
boots up and after you see INIT starting, output from the processing in this
script can appear in RED (failure or error message), GREEN (success mes-
sage), YELLOW (description), BLUE (system message), MAGENTA (found
devices or drivers), CYAN (questions), or WHITE (hint). If you were to add
your own features to this script, you could incorporate these colors as well.
■ Boot options—This script rereads the boot options, in case any of those
options are needed during the processing of this script. Because those
options are stored in /proc/cmdline, the script can simply run the cat com-
mand on that file to get the boot options.
■ Config files check—The script checks whether you want to restore config-
uration files that you previously saved from Knoppix. It does this by check-
ing the boot options for strings beginning with myconf, custom, config, or
floppyconf.
■ Language—The language and keyboard used are based on the lang= value
set as a boot option. For example, U.S. English is us and German is de.
Based on this value, the values country, language, keytable, xkeyboard,
kdekeyboard, character set, and timezone are also set. The language is
enabled immediately, so error messages can be translated as well.
■ Desktop—The desktop boot option is read so that Knoppix knows which
type of desktop interface to start. The default is kde (K Desktop Environ-
ment). This information is checked again in the xsession script.
■ Hostname—The hostname is set to Knoppix.
■ Clock—Based on boot options, the clock can be set to GMT or UTC. Nor-
mally, local time is used. Also, the hardware clock (hwclock command) is set
based on the time zone.
■ Live CD or installed Knoppix—Because Knoppix can be installed and
run from hard disk, some different processing needs to be done depending on
which medium Knoppix is running from. If Knoppix is running from hard
disk, this script does such things as performs file system checks on hard-disk
partitions, remounts the root directory (/) as read/write, and regenerates mod-
ule dependencies on hard disk.
■ Configuration files—A handful of configuration files are recreated in the
knoppix-autoconfig script. This is important to note because if you tried to
CHAPTER 4 Understanding How Live Linux CDs Work 127
save any of these files, the previous versions are erased and the new files will
be populated with information gathered during the boot process. Configura-
tion files that are recreated include several that are stored in the
/etc/sysconfig directory, such as: i18n, keyboard, desktop, and knoppix.
The /etc/environment file (used by OpenOffice.org applications and others)
is also re-created.
NOTE
To determine whether Knoppix is being run from a live CD or from hard
disk, the knoppix-autoconfig script checks for the existence of the
/KNOPPIX/bin/ash command. If it isn’t there, the install is assumed to be a
hard disk install. If you remaster Knoppix at some point, you should be sure
to either not remove that command or change the test for it in this script.
The messages just shown appear on the console terminal. The first few lines
(shaded text) are output from the boot loader as the kernel is started and the initial
RAM disk is uncompressed. The next section (appearing in bold) shows the output
of the linuxrc script as the file systems are set up and merged. The init process
takes over in the final section (second set of shaded text). As its last activity, it
starts up the X server using the xsession script.
By displaying the contents of /proc/cmdline, you can see the boot options that
were used when the live CD first booted. Knoppix uses this on many occasions
when it runs its start-up scripts to determine user preferences. Here you can see the
maximum amount of RAM that can be assigned to the ramdisk (1,000,000 bytes).
/etc/init is the location of the init file, the language is U.S. English (us), and the
power-off feature is assigned to the APM system. The vga=791 option sets the dis-
play to use 1024×768 resolution and 16-bit color. The boot image, which is origi-
nally set to knoppix, ultimately boots the image containing the Linux kernel named
kernel.
If you can’t understand more boot options, you can check several different
places. On the Knoppix CD, check out the knoppix-cheatcodes.txt file. For kernel
boot parameters, refer to the bootparam man page (type man bootparam).
Just as a quick reminder, these components interpret the options passed to the
kernel during the Knoppix boot process:
■ linux kernel—From the isolinux directory on the CD
■ linuxrc boot script—Contained in the root directory of minirt.gz
■ knoppix-autoconfig—Run as part of the init process
■ xsession—Used to start the X desktop
■ knoppix-halt and knoppix-reboot—Run when you stop or restart Knoppix,
respectively
CHAPTER 4 Understanding How Live Linux CDs Work 131
Other services located in the /etc/init.d directory check your boot options.
For example, the /etc/init.d/hdparm service checks whether nohdparm is set (it
skips the setup of disk parameters if it is).
Viewing mounted file systems also yields interesting results from your live CD.
This is the output from the mount command on a Knoppix system:
/dev/root on / type ext2 (rw)
/ramdisk on /ramdisk type tmpfs (rw,size=192996k)
/UNIONFS on /UNIONFS type unionfs (rw,dirs=/ramdisk=rw:/KNOPPIX=ro)
/dev/hdb on /cdrom type iso9660 (ro)
/dev/cloop on /KNOPPIX type iso9660 (ro)
/proc on /proc type proc (rw)
/proc/bus/usb on /proc/bus/usb type usbfs (rw,devmode=0666)
/dev/pts on /dev/pts type devpts (rw)
The /ramdisk partition stores files that are created during the live CD session.
The KNOPPIX image is mounted /KNOPPIX using the cloop driver (so that files from
the /cdrom/KNOPPIX/KNOPPIX compressed image can be decompressed as needed.
Because the most recent version of Knoppix uses a UnionFS file system, the
read/write /ramdisk is jointed with the read-only /KNOPPIX file systems to have all
directories (even those from the read-only CD medium) act as read/write media.
You can use a few other useful commands for determining the state of your
Knoppix or other live CD system. Type the following to see whether your Ethernet
network connection is active:
# ifconfig eth0
Type the following to see the previous run level, followed by the current run level:
# runlevel
N 5
Type the following to see what modules have been loaded for your system:
# lsmod | less
Type the following to see the version of Knoppix you are using:
# cat knoppix-version
For more details on how the boot process generally works in Linux, you can
refer to several different man pages, including boot, inittab, run level, and init.
132 Live Linux CDs
SUMMARY
Although the BIOS, which runs when the computer is first turned on, is typically
supplied by the manufacturer of the motherboard, nearly every other aspect of the
boot process involves open-source software. For that reason, someone creating a
live Linux CD can control nearly every aspect of the live CD boot process when
control is handed off from the BIOS.
The control a user can exert over the BIOS is typically done from the BIOS
setup screen. Most important, the user might need to make sure that the device con-
taining the live CD (CD, DVD, USB flash drive, or other medium) is enabled. The
next step is to be sure that the device falls in the boot order so that another device
(such as the computer’s hard disk) doesn’t boot first.
The BIOS passes control of the boot process to the boot loader next. For Linux
Live CDs, that typically means the Isolinux boot loader. With Isolinux, the user can
type a boot label and options to control the boot process going forward. GRUB is
another type of boot loader that is sometimes used with live Linux CDs (however, it
is more often used to boot from hard disk).
After the selected label is booted, the Linux kernel takes over with the help of
some drivers and commands made available from an initial RAM disk. The kernel
and initial RAM disk represent the most basic components needed to mount the
permanent file system structure, load the needed drivers, and begin the initializa-
tion of the system services.
For Knoppix, the next step is to run the linuxrc script. The linuxrc script,
which is contained on the initial RAM disk, is responsible for mounting the file sys-
tems and loading the drivers needed to proceed to the next stage of the boot process.
System services are started next by way of the init process. The init process
relies on the contents of the /etc/inittab file and run level directories for the cur-
rent run level. For Knoppix, the default run level is 5. This means that the live CD
is intended to boot up to a graphical desktop system.
Many of the features described in this chapter are common to many Linux sys-
tems. Some features are more specifically used on live CDs. The next chapter
describes features such as file systems that are particularly useful to live CDs
(squashfs and UnionFS) and boot loaders used to boot live CDs (Isolinux and, to a
lesser extent, GRUB).
CHAPTER 5
Although many of the components you find in live CD systems are the same ones
you find in installed Linux systems, some components are of particular interest to
live CDs. Live Linux CDs are different than installed systems in these areas:
■ Boot loaders—Isolinux (part of the Syslinux project) is the boot loader
most often used with live CDs because it implements the El Torito standard,
which most BIOSes understand, for booting from CD-ROM. Other boot load-
ers, such as GRUB or LILO, can be used as well but tend to be less popular
for use with live Linux CDs.
■ File systems—Issues related to file system types relate to the facts that live
CDs are typically a read-only medium and that they have much more space
limitations than a typical hard disk. The UnionFS file system type is an
interesting file system type because it can be used to merge read-only and
read/write file systems to enable you to save files in what would otherwise be
a read-only environment on a live CD. Live Linux CDs such as Knoppix use
UnionFS in tandem with file systems compressed for use with the cloop
driver, allowing more than double the amount of software to be included on
the live CD.
The Squashfs file system has become a popular file system type because it
compresses software in a way that it can be uncompressed on the fly. Live
Fedora CDs created using Kadischi can incorporate file systems compressed
with Squashfs.
133
134 Live Linux CDs
After the live Linux CD boots up, the live CD often runs a script that does a lot
of the magic needed to make it operational. Knoppix runs a linuxrc script, which
mounts file systems, loads modules, and copies files that are needed. After that, the
live CD typically passes control to the init process to start up the system
processes. From that point forward, how services start and the ways that you use the
system are very similar to the ways you would use a Linux system installed on your
hard disk. The differences tend to relate to the Linux distribution on which the live
CD is based.
Before you begin the process of remastering or putting together a live CD from
scratch, it helps to understand some of the differences among the different Linux
distributions used to create the live CD you are building:
■ Software packaging—Although you can install software from tarballs
(even building the software you want from source code, if you want), using
software that is prepackaged for the Linux distribution on which your live
Linux CD is based can save you some trouble. Packaging formats described
in this book include RPM (for building Fedora CDs), Deb (for Debian, Knop-
pix, and other live CDs), and emerge (for Gentoo live CDs).
Some live Linux CDs also have their own methods of installing software that
are prepackaged for their own particular live CD. Damn Small Linux has a
MyDSL feature that lets you install tarballs of software live and across
reboots. SLAX lets you add software packaged as compressed modules to
activate software on-the-fly.
■ Installers—Instead of remastering an existing live CD, certain tools avail-
able with some Linux distributions enable you to use the installer that comes
with the distribution to create a live CD. One example of this is the Kadischi
project, which uses the anaconda installer that comes with Fedora and Red
Hat Enterprise Linux to run through a fresh software installation that results
in a live CD ISO image. Another example is the Gentoo Catalyst installer,
which can likewise be used to create a live CD from scratch.
Use the topics covered in this chapter as background for the procedures for
remastering or creating from scratch the different types of live CDs covered in the
chapters that follow. The first section covers how to use boot loaders in live CDs.
instead of typing in the label you want. The following sections describe how to use
Isolinux and GRUB boot loaders with a live CD.
Understanding Isolinux
Isolinux is made to be compatible with the El Torito Bootable CD-ROM Format
Specification (search for the specscdrom.pdf file at www.phoenix.com). That speci-
fication defines what a CD-ROM must include to be bootable and what a computer’s
BIOS needs to boot such a CD. Because the El Torito spec has been widely
accepted since it was created in 1994, most PCs made in the past decade are capa-
ble of booting El Torito–compatible CDs and DVDs.
El Torito extends the ISO 9660 standard (which describes the format of data
CD-ROMs) by identifying the location of a boot record volume descriptor that points
to a boot catalog. The boot catalog contains information on available images that
can be selected and booted.
Isolinux operates in the El Torito mode referred to as no emulation mode. This
means that the computer executes the image without performing floppy emulation
(which limits how much space you can access on the CD-ROM) or hard-disk emu-
lation (which doesn’t work on all BIOSes). Using “no emulation” mode lets you
access the whole CD or DVD from the Isolinux boot loader. For example, accessing
more than 8GB of compressed data on a DVD-9 is no problem.
The Isolinux boot process keys off the isolinux.cfg file. Besides setting some
options about the boot loader (such as how long to wait before timing out), this file
contains one or more labels. Each label identifies the kernel file to run and options
that are appended to that kernel.
Options identified in the isolinux.cfg file can include the location of the ini-
tial RAM disk, along with many options related to hardware issues. For example,
Knoppix includes multiple labels that boot the same kernel, but in different video
modes (including fb1280x1024, fb1024x768, and fb800x600 for using Frame Buffer
mode at various video resolutions).
The following is part of the isolinux.cfg file that comes with Knoppix:
DEFAULT linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off
vga=791 initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix
TIMEOUT 300
PROMPT 1
DISPLAY boot.msg
F1 boot.msg
F2 f2
F3 f3
LABEL knoppix
KERNEL linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off
vga=791 initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix
LABEL expert
KERNEL linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off
vga=791 initrd=minirt.gz nomce BOOT_IMAGE=expert
LABEL memtest
KERNEL memtest
APPEND initrd=
LABEL knoppix-txt
KERNEL linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off
vga=normal initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix
LABEL debug
KERNEL linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off
vga=normal initrd=minirt.gz debug BOOT_IMAGE=debug
LABEL fb1280x1024
KERNEL linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off
vga=794 xmodule=fbdev initrd=minirt.gz nomce quiet
BOOT_IMAGE=knoppix
138 Live Linux CDs
The isolinux.cfg file is a plain-text file in either Linux (UNIX) or DOS for-
mats. It contains a set of keywords and values to provide default settings and user
options. Using the portions of the isolinux.cfg file that comes with Knoppix as an
example, here are some ways that this file can control the boot process of a live CD.
■ Default boot command—The DEFAULT line sets the default command line
to run if the user simply presses Enter at the boot prompt (the Linux kernel
with no options is run by default).
■ Boot timeout—The TIMEOUT value of 300 causes the live CD to wait 30 sec-
onds before automatically booting the default boot command. The value of
TIMEOUT represents [1/10] of a second. A user can prevent the timeout from
occurring by pressing any key from the keyboard after the boot prompt
appears.
The value TOTALTIMEOUT can be set instead to boot the default command after
a set number of [1/10] seconds, regardless of whether the user pressed a key.
Both TIMEOUT and TOTALTIMEOUT can be set to allow the user a short period of
time to stop the default boot process (maybe 30 seconds), but ultimately just
boot after a few minutes (maybe 5 minutes) if the user hasn’t entered a com-
mand by that point.
■ Boot prompt—Setting PROMPT 1 causes the boot: prompt to always be dis-
played from the Isolinux boot screen. By setting PROMPT to 0 instead, the
prompt is displayed only when the user presses the Alt or Shift keys (or if the
Caps Lock or Scroll Lock key is on).
By setting the NOESCAPE flag to 1, you can disable the escapes just described.
For example, if you set PROMPT 0 and then set NOESCAPE 1, the user has no
way of entering anything to the boot prompt. As a result, the default boot
command runs every time. This approach is good if you know the exact hard-
ware environment you are using and don’t want any user intervention in the
boot process.
■ Initial boot screen—The DISPLAY value points to the file whose contents
are displayed as the initial boot screen. Often, as is the case with Knoppix
and many others, the file reads in an image file that is displayed at the top of
the boot screen. The upcoming section “Creating Boot Screens” describes
the format you can use with this file.
■ Additional boot screens—You can have ten boot screens in addition to the
initial boot screen. Using the keywords F1, F2, F3, F4, F5, F6, F7, F8, and F9,
you can assign a particular file to each function key of the same name. You
can assign F0 to the F10 function key.
CHAPTER 5 Looking Inside Live CD Components 139
Usually, as is done with Knoppix, F1 is assigned to the same boot screen file
(boot.msg) as is assigned to the DISPLAY keyword. In that way, the user can
return to the original boot screen (by pressing F1) after visiting the other boot
screens. The boot: prompt remains at the bottom of all boot screens, so the
user can type in the desired label and options from any of those screens.
In the case of Knoppix, the content of the boot.msg file appears on the initial
boot screen and when the F1 function key is pressed. The f2 and f3 files are
assigned to the F1 and F2 function keys, respectively. For information on
how these files are formatted, refer to the “Creating Boot Screens” section.
■ Boot labels—The LABEL keyword identifies the string of characters that
users type at the boot prompt if they don’t want to use the default boot com-
mand. Often labels represent the name of the live CD (such as knoppix for
Knoppix or dsl for Damn Small Linux). Other boot labels, however, indicate
special-purpose commands or settings that come with the live CD.
Typically at least two keywords follow each LABEL keyword. The KERNEL
keyword identifies the image file containing the Linux kernel to boot for that
label. For example, the file linux contains a bootable Linux kernel with
Knoppix.
The other keyword typically used is APPEND. Any options added to the APPEND
keyword are appended to the command indicated by KERNEL for the LABEL.
Options that users type with the label at the boot prompt are added to the end
of the APPEND options.
Some of the options added to an APPEND line direct how the kernel boots,
while other options are passed along and consumed at different points in the
boot process. For example, the initrd=minirt.gz option tells the boot kernel
to use the minirt.gz file as the initial RAM disk. The BOOT_IMAGE option
tells the linuxrc script (which is run after the kernel boots) what mode to
start in.
NOTE
You might notice that an APPEND line near the beginning of the
isolinux.cfg file is not associated with a LABEL. Options attached to this
APPEND keyword are set as global defaults. Those options are appended to
the KERNEL for any LABEL that doesn’t have its own APPEND line. To avoid
using the global APPEND options for a particular KERNEL line, you must add
an APPEND - line after that KERNEL line.
140 Live Linux CDs
Boot labels shown in the previous Knoppix example include knoppix, expert,
memtest, knoppix-txt, debug, and fb1280x1024. These labels, described in
the upcoming section “Creating Different Boot Labels,” can be used to boot
Knoppix in text mode (knoppix-txt), debug mode (debug), or with special
video settings (fb1280x1024). A label also can be used to run a different com-
mand altogether (such as the memtest label, which runs the memtest com-
mand for checking your system RAM).
■ Capability to run from a serial port—In most cases these days, you
would expect a computer running a live CD to have a monitor available that
supports VGA. However, Isolinux can also boot on a computer that uses a
dumb character terminal that connects to a serial port as its console instead
of a graphics display.
To have your live CD work on a computer with the console connected to the
computer’s serial port, you must add a SERIAL line as the first entry in your
isolinux.cfg file. For example, to use a dumb terminal (with a null modem
cable, no flow control or RS-232 status signals) connected to the COM1 port
(/dev/ttyS0 in Linux) of the computer running your live CD, add the follow-
ing to the beginning of your isolinux.cfg file:
SERIAL 0
By default, parameters for the serial port are hard-coded to 8 bits, 1 stop bit,
and no parity. The connection defaults to a 9600bps baud rate and no flow
control. However, if you want to change baud rate and flow control, you can
add them as options to the SERIAL line. To get the flow-control features you
want, you need to combine the bits associated with those features. Table 5-1
shows the hex values for flow-control features.
The Isolinux project recommends several flow-control values you might want
to use, other than the default (0) of no flow control. For null modem cable
detection, use 0x303. Use 0x023 for DTR/DSR flow control or 0x083 for
DTR/DCD flow control. For RTS/CTS flow control, you can use 0x013 or
0x813 (with the latter adding modem input).
For example, you might want to change the baud rate to 14400bps and the
flow control to 0xab3. The 0xab3 would include all values needed for RS-232
compliance (marked with asterisks in Table 5-1). For this example, the
SERIAL line (as the first line in you isolinux.cfg file) would appear as
follows:
SERIAL 0 14400 0xab3
When you set out to create the isolinux.cfg file and related boot files for your
own live CD, you should keep some issues in mind:
CHAPTER 5 Looking Inside Live CD Components 141
TABLE 5.1 Hex Values for Flow Control Options on Serial Terminals
The following sections describe ways in which you can modify the
isolinux.cfg file and associated kernels, boot screens, and other items to steer the
boot process of your own live CD.
■ Text—Add text describing your live CD, boot options, licensing, and other
important information.
■ Colors—Display your text and background in any of 16 different colors.
■ Images—Import image files (created in a special format) that can include up
to 16 colors and be up to 640×480 pixels.
Any of the boot screen files you create can contain plain text in DOS or UNIX
(Linux) format. If no formatting is entered, text is displayed as white characters on
a black background. However, by adding certain control codes, you can change col-
ors, include graphics, or clear the screen.
Entering control codes into a plain-text file can be a bit tricky. If you are edit-
ing a text file with the vi or vim command, you can enter a control code by pressing
the Ctrl key along with the V key. After that, you can enter the control code you
want. For example, to add a Ctrl+X (so you can add an image to a boot screen), you
would type Ctrl+V, Ctrl+X while you are in input mode. The result should look like
the following:
^X
The following examples describe how you can add different features to your
Isolinux boot screens:
6 Brown e Yellow
Notice that the darker colors are assigned to numbers 0 through 7. Lighter
colors are assigned to 8 and 9, and a through f. To cause the foreground
color to flash, pick a dark color for the foreground and a light color for the
background.
■ Adding an image—Assuming that the boot screen where your live CD
will eventually run has a VGA display available, you can add an image to
any of the boot screens. Display mode for the image is 640×480 and 16
colors. Also, the image must be in a simple Run Length Encoding (RLE)
format, referred to as Syslinux SLL16 format. The syslinux package includes
the ppmtolss16 command, which lets you convert an image file from PPM
to SLL16.
Although the available display is 640×480 pixels, when you create your
image, you will not want it to consume the entire 480 pixels so that there is
room for other information. That information typically tells you how to boot
the live CD or find other boot options.
For example, in the isolinux.cfg file for Damn Small Linux (DSL), the file
boot.msg is identified as the initial boot screen (DISPLAY keyword). The fol-
lowing is the content of the boot.msg file:
^017^L^Xlogo.16
DSL is based on Knoppix Debian GNU Linux Technology.
Press <enter> to begin, F2 and F3 for boot options.
144 Live Linux CDs
The information in boot.msg starts by setting the screen colors (^O). It sets
the background color to dark blue (1) and the foreground color to light gray
(7). It then identifies the image file (^X) as the file logo.16. That file is a
640×400–pixel in SLL16 format that is available with the other files in the
isolinux directory.
The rest of the text in the boot.msg file appears after the image. Then the
boot prompt (boot:) automatically is appended at the bottom of the page. Fig-
ure 5-1 shows the initial DSL boot screen, created from the contents of the
boot.msg file.
To add an image to a boot screen (also called a splash screen) from your own
live CD, you need to create an image that will fit on the 640×480 display.
You must save that image to include only 16 colors and be in PPM format.
Then you can use the ppmtolss16 command to convert the image to the
proper format.
Keep in mind that the image will need to look good at 640-pixel width and
16 colors. (You will notice a loss of quality as you go through this process on
an image with many more colors.) Also, if you are trying to keep file sizes
low, the less busy the image is, the more efficiently the ppmtolss16 command
will be capable of compressing it.
CHAPTER 5 Looking Inside Live CD Components 145
To run the following procedure, you need to be on a system that includes the
GIMP and has the syslinux package installed (so you have the ppmtolss16
command available). Knoppix works fine for this case. Here’s an example
of how to create an image for your boot screen using the GIMP image-
manipulation program:
1. Acquire an image you want to use for your boot screen. You can start with
any image format that the GIMP can read.
2. Open the image in GIMP (look on the Graphics menu for most Linux desk-
top systems to launch the GIMP).
3. Scale the image to fit inside the 640×480 boundary (as noted earlier,
640×400 or similar enables you to include extra text) by selecting Image
q Scale Image. Try resizing the width to 640; the height adjusts automati-
cally (provided that the two numbers are locked together).
4. Convert the image to use only 16 colors by selecting Image q Mode q
Indexed. Under the Colormap section of the Indexed Color Conversion
screen that pops up, select Generate Optimum Palette and choose 16 for
Maximum Number of Colors.
5. Save the image as a PPM file by selecting File q Save As. When
prompted to name the file, name it with a .ppm extension and choose
Select File Type (By Extension) to have the image saved as a PPM file. For
example, you might save the file as mylogo.ppm. To avoid naming prob-
lems, be sure to keep the filename to eight characters or less, with an
extension of up to three characters.
6. Open a shell and change to the directory containing the image you just
created. Next, use the ppmtolss16 command to convert the image to the
RLE format. The command itself (/usr/bin/ppmtolss16) is a Perl script.
You can open that script in a text editor to read about the file format and
the processing the script does. Here’s an example of using the command to
convert the image file just created (mylogo.ppm) to an image file you can
use with Isolinux on your boot screen (mylogo.rle):
# ppmtolss16 < mylogo.ppm > mylogo.rle
244480 pixels, 27018 bytes, (77.90% compression)
7. Copy the file you just created (mylogo.rle) to the isolinux directory
where you are building or remastering your live CD.
8. Edit the boot screen file that is being used for your initial boot screen (or
any other boot screen associated with a function key) so it includes your
146 Live Linux CDs
image file. For example, if you are simply remastering DSL or Knoppix,
edit the boot.msg file and change logo.16 to mylogo.rle.
■ Returning to text mode—To have a screen that contains only text, you
can start by telling Isolinux to switch to text mode. A text-only screen is use-
ful for such things as showing boot options or displaying licensing informa-
tion. With text-only screens, you can still change foreground and background
colors as you like. To go to text mode, use Ctrl+Y.
The following line changes the screen to text mode (^Y), sets the background
to dark blue and the foreground to light gray (^O17), and then clears the
screen and home the cursor (^L).
^Y^O17^L
After that, you can begin entering text as you like. Keep your text lines under
80 characters so they don’t wrap on most displays.
TABLE 5-3 Indicate Video Depth, Colors, and Resolution with the vga= Option
In Knoppix, separate labels exist for different framebuffer modes. For exam-
ple, the following label (fb1024x768) starts Knoppix with vga=791. This sets
the screen resolution to 1024×768 and colors to 16-bit color (65,000 colors).
This is a listing of that label:
LABEL fb1024x768
KERNEL linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791
xmodule=fbdev initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix
The xmodule value is set to fbdev and vga is set to 791. In Knoppix, other fb
labels (fb800x600, fb1280x1024, and so on) are set to different vga values. To
have the user prompted for a mode, you can set vga=ask instead.
You can set other xmodule values as well, depending on which drivers your
kernel supports. In Knoppix, open-source drivers exist for ATI (ati), Radeon
(radeon), Savage (savage or s3), NVIDIA (nv), and Intel i810 (i810) chipsets.
If you are remastering a live CD, another option is to add video drivers from
NVIDIA or ATI. Because these drivers are not open source, they are not
available with most Linux distributions. However, you can add those drivers
to your live CD for private use because they are distributed freely from
NVIDIA and ATI.
A few other issues relate to LABEL lines. If a user types the LABEL name at the
boot prompt, followed by one or more options, those options are appended to
the end of the options listed on the APPEND line. If a LABEL has no APPEND line,
the APPEND keyword at the beginning of isolinux.cfg is used to provide
global options. To not use the global options, you can add an APPEND line fol-
lowed by a dash (APPEND -).
148 Live Linux CDs
■ Labels for failsafe and debug—If your live CD won’t boot, it’s nice to pro-
vide the live CD user with labels that include failsafe and debug options. A
failsafe label might be used to start a Linux kernel with many features dis-
abled that might be causing the boot to fail (options such as nodma, noscsi,
nousb, nofirewire, and so on) that then drops you to a shell instead of a
desktop.
Using a debug label, where the debug option is added to the APPEND line, you
can see many more messages relating to the live CD startup, so you can fig-
ure out what is causing any problems that occur during the boot process.
Other Files in the isolinux Directory
Depending on how you set up your live CD boot configuration, the files you have in
your isolinux directory (or boot/isolinux directory) will vary. By way of a quick
checklist, you need to have these files in your isolinux directory before you can
build your live CD:
■ Boot image (El Torito)—Copy the isolinux.bin file to the isolinux (or
boot/isolinux) directory where you are creating your live CD. On a Fedora
system, the file is located in /usr/lib/syslinux. This file contains the El
Torito boot image that the mkisofs command uses when you are making the
live CD ISO image. When the ISO image is created, a pointer is placed in the
image header to point to isolinux.bin. The isolinux.bin image must be
1200K, 1400K, or 2800K in size.
You can create your own isolinux.bin file as you would create a boot floppy.
In fact, you can simply copy the contents of a boot floppy to your isolinux
directory and use it. For example, you could place a boot floppy into the
floppy drive and type the following:
# dd if=/dev/fd0 of=isolinux.bin bs=10k count=144
You don’t need to name the file isolinux.bin. However, any name you use
you must identify with the -b option when you run the mkisofs command.
■ Boot catalog—El Torito requires a boot catalog file (usually boot.cat). The
mkisofs command creates this file automatically, so you don’t have to worry
about creating this file. However, you must identify its name and location
using the -c option when you run the mkisofs command.
■ Isolinux configuration file—The isolinux.cfg file must be created and
stored in the isolinux directory, as described earlier in this chapter.
■ Boot screen files—Files containing the initial boot screen and any boot
screens you make accessible using function keys F1 through F10 need to be
added to the isolinux directory. Knoppix uses boot.msg to contain informa-
tion for the initial boot screen (and also when pressing the F1 function key).
CHAPTER 5 Looking Inside Live CD Components 149
It uses files named f2 and f3 to create boot screens available by pressing the
F2 and F3 function keys, respectively. You can name these files anything you
like (although a limit of 8 characters with a 3-character extension used with
DOS file names is recommended). To enable them, however, you need to
identify them in the isolinux.cfg file.
■ Graphics file—If you incorporate a graphical image (of the special format
described earlier in this chapter), you need to place it in the isolinux direc-
tory. Knoppix calls this file logo.16, but other bootable CDs call this image
splash.lss.
■ Kernel—The isolinux directory must contain a kernel (often named
kernel) that is identified on the KERNEL lines in the isolinux.cfg file.
■ Initial RAM disk—An initial RAM disk file must be placed in the
isolinux directory. In Knoppix, this file is named minirt.gz and is identi-
fied using the initrd option (initrd=minirtgz) on the APPEND line for each
LABEL that requires it.
An initial RAM disk is mounted as the root file system for the kernel that’s
started by the boot loader. It contains commands and modules that the initial
kernel might need at this early stage of the boot process. When the real root
file system is available to be mounted, the initial RAM disk file system is
unmounted.
■ Other executables—You can include multiple kernels or other executables
to launch as identified on the KERNEL line for each LABEL. The memtest com-
mand is an executable that is often included with live CDs.
When all the files you need are in the isolinux directory, that directory can be
joined up with the file system to be used with the live CD. Then you build ISO
images from those files using the mkisofs command (as described in Appendix B,
“Building, Testing, and Burning ISOs”).
GRUB’s flexibility also extends to its user interface. Command-line and menu
interfaces are available with GRUB. As a developer, you can change the look of the
boot screens by adding your own images. As a user, you can edit boot labels before
launching the selected operating system.
Configuring GRUB centers on the grub.conf file. Like the isolinux.cfg file
used with Isolinux, grub.conf can set a variety of options, followed by specific
labels that represent the operating systems GRUB can boot. The grub.conf file is a
plain-text file that you can edit with any text editor.
From a live CD point of view, GRUB comes with an El Torito–compatible
stage2 boot file. That boot file is placed with other GRUB-related files in the /boot
directory. The location of this boot file (called stage2_eltorito) is identified on the
mkisofs command line when you go to produce the ISO image for your live CD.
To illustrate how GRUB can be used as the boot loader for a live CD, the follow-
ing steps describe how to remaster a Knoppix live CD to use GRUB. The steps were
done on a Fedora system that had the grub package installed and the contents of a
Knoppix CD copied to the /knoppix/master directory. If you are using a different
Linux system, you need to get the grub package for your system or download it from
the GNU GRUB site (www.gnu.org/software/grub).
1. From the root of the directory where you are remastering Knoppix (it should
contain several autorun files, as well as boot/ and KNOPPIX/ directories),
make a grub directory. For example, if your remaster directory is
/knoppix/master, you would type the following:
# cd /knoppix/master
# mkdir -p boot/grub
2. Copy the stage2_eltorito file to the grub directory as follows:
# cp /usr/share/grub/i386-redhat/stage2_eltorito boot/grub
3. Copy the files you want from the isolinux directory. I chose to use the kernel
file (linux), the initial RAM disk (minirt.gz), and the memtest command
(memtest):
# cd /knoppix/master/boot/isolinux
# cp linux minirt.gz memtest ../grub
4. Next, you can create your own splash screen to use as the background for the
GRUB menu when you first boot the live CD. For the background, you can
use an XPM image that is 640×480, has a 14-color palette, and is com-
pressed with gzip. You can use GIMP to convert your image to this size or use
the convert command. This example converts a JPEG image to one that can
be used on a GRUB splash screen:
CHAPTER 5 Looking Inside Live CD Components 151
This example shows just a few of the neat features in GRUB. You can find
more options by typing info grub on a Linux system where GRUB is
installed.
6. Assuming that you have remastered Knoppix (or other live CD) the way you
like, you can now create the ISO image of your live CD. This is an example
of a mkisofs command you can use, using the example we created to this
point:
# cd /knoppix/master
# mkisofs -R -b boot/grub/stage2_eltorito \
-no-emul-boot -boot-load-size 4 \
-boot-info-table . -o ../knoppix.iso
In this example, mkisofs creates a boot image (knoppix.iso in the /knoppix
directory) from the current directory (notice the dot on the last line). The -b
option indicates the location of the El Torito boot image added earlier. The
ISO image (knoppix.iso) is created in no emulation mode (-no-emul-boot)
and -boot-load-size is 4 (meaning that four 512-byte sectors are used). The
-boot-info-table option inserts a 56-byte boot information table into the
boot file (indicated by the -b option). (See Appendix B for more information
on the mkisofs command.)
You should now be able to test your knoppix.iso by burning it to a CD and
booting it or by using an emulator (such as qemu). Figure 5-2 shows an example of
the GRUB boot screen I created using the previous procedure.
FIGURE 5-2 Add your own image to the GRUB boot screen and
boot from a menu.
CHAPTER 5 Looking Inside Live CD Components 153
In this example, you can see the background image (a war protestor in Washing-
ton state) behind the GRUB menu. You can use arrow keys to move among the five
menu items, and then press Enter to boot the selected item. By pressing the E key
on an item, you display and edit that item (to either add or remove boot options).
Press Esc to return to previous screens. Then press B to boot the selected entry.
The menu interface shown previously appears by default with GRUB. However,
you can choose instead to have a command-line interface (a grub shell) or a hidden
menu interface (where you see a graphic and must press a key before the timeout to
see the menu). Add hiddenmenu on a line by itself to hide the menu interface.
To go to a grub shell from the menu, press the C key. To see available com-
mands from the grub shell, type help. To return to the menu, type reboot.
after the image has been burned on it. Because the file system used by the
live CD is stored on the CD itself, you can’t just save and modify files from
that file system as you would on file systems stored on a hard disk.
Ways to get around the problem of running from a read-only medium include
loading the entire file system into RAM (which might not be reasonable with a
700MB live CD) and having only selected directories available from RAM
(such as home and temporary directories). The second solution, however, might
not allow you to install software that needs to reside in multiple directories.
The special file system type that can be used to deal with the read-only prob-
lem is called UnionFS. Using UnionFS, read-only and read/write file-system
branches can be combined to appear as one file system to the end user. As a
result, the previously read-only file system looks like a read/write file system
to the user. When the user tries to change or add files to the file system,
those changes are actually stored on the read/write branch.
■ Limited space—Compressed file systems can be used to allow more data to
Another way of doing file system compression on live CDs is with the
Squashfs file system. Using Squashfs, directories, files, and even inodes are
compressed (including files up to 4GB). It can provide greater compression
than some other compressed file-system types by supporting block sizes of
up to 64K. Kadischi enables you to create Squashfs file systems when you
produce live CDs of Fedora or Red Hat Enterprise Linux.
The following sections describe some details on UnionFS, Squashfs, and the
cloop driver.
NOTE
As a quick aside, UnionFS has other uses beyond live CDs. For example,
UnionFS can be used to merge multiple archives of music, images, or video
so they can be accessed from a single point in the file system. Likewise,
home directories from different disk partitions or networked file systems
can be merged to form a single home directory structure.
UnionFS software (it’s actively being developed) from a UnionFS mirror site (for
example, ftp://unionfs-mirror.linux-live.org/unionfs).
To see how UnionFS is used in Knoppix, boot up Knoppix and type the following:
# mount |grep -i union
/UNIONFS on /UNIONFS type unionfs (rw,dirs=/ramdisk=rw:
/KNOPPIX=ro:/KNOPPIX2=ro.delete=whiteout)
Looking at this listing (which I edited somewhat to save space), you can see that
most directories in root (/) are linked to /UNIONFS directories. This enables you to
156 Live Linux CDs
combine the read-only files from the live CD with any changes you make to, for
example, install software or change configuration files in /etc. Notice that /tmp and
/home exist only on /ramdisk because they don’t need to be joined with files from
the live CD. Also notice that directories associated with system functions (such as
/dev, /proc, and /sys) are not associated with a UnionFS file system.
When files are deleted, UnionFS can be set to either delete the files physically
or mask out the real file using what is called whiteout mode. Whiteout is used in this
case. Whiteout files are indicated by .wh files in the writeable branch. For example,
type ls -a /ramdisk/etc to see files that have been deleted or replaced in the /etc
directory.
If you want to further control UnionFS file systems, you can try the unionctl
command. For example, to list the branches of an existing UnionFS file system, you
could use the —list option as follows:
# unionctl /UNIONFS —list
/ramdisk (rw-)
/KNOPPIX (r—)
/KNOPPIX2 (r—)
You can see from this example that /UNIONFS is a union of the /ramdisk, /KNOP-
PIX, and /KNOPPIX2 directories. Permission on a branch can be read/write (rw-),
read-only (r—), or read-only for an NFS file system (r-n). You can also use unionctl
to add (—add), remove (—remove) or change the read/write mode (—mode) of a branch.
that the cloop driver can access it later. As shown in Chapter 6, you often can just
pipe the output of the mkisofs command to the create_compressed_fs command to
create the compressed image named KNOPPIX.
When the live CD goes to use the compressed image when the live CD boots,
the compressed image is mounted using a cloop device. For example, in Knoppix,
the /KNOPPIX/KNOPPIX file on the CD is mounted on /KNOPPIX of the running live
CD, using the /dev/cloop0 device. As files are requested from that image, they are
uncompressed individually. Because accessing the CD drive tends to be more of a
bottleneck than the processing required to uncompress the files, using the cloop
driver adds little or no overhead to the process.
Because the cloop driver is maintained by Klaus Knopper as part of the Knop-
pix project, you can get the source code for cloop the same place you can find
Knoppix source code (at www.knopper.net/knoppix/sources).
When you are ready to begin building your own live CD, you can start from
scratch or you can start with an existing Linux distribution. Starting with an exist-
ing distribution offers many advantages:
Before we launch into a description of the software tools just mentioned (and
how to use them when you are creating your own live CDs), I want to mention a few
other approaches to gathering the software you want and building live CDs that are
not covered in this book. You might want to look into these approaches to building
live CDs if the procedures in this book don’t suit you:
CHAPTER 5 Looking Inside Live CD Components 159
The approaches to creating your own live Linux CD that the coming chap-
ters illustrate were chosen because they let you leverage a lot of work that has
been done for other Linux distributions. Unless you are purely in it for the
learning process of how Linux works, you can start creating your live CD with
Linux distributions that have thousands of software packages ready, well-tested
installers, and proven components for compressing, booting, and running live
CD software.
The following sections provide brief introductions to the different software-
packaging systems you will encounter when create live CDs based on Knoppix
(Debian), Fedora, and Gentoo.
160 Live Linux CDs
Plenty of options are available for querying, listing, adding, and removing Deb
software packages using the apt-get and dpkg commands. Refer to the man pages
for those commands for further information.
using either the rpm command (to install a single package from the local hard disk)
or the yum command (to install selected packages and their dependent packages
from an online repository. However, this is not the recommended approach for
Fedora live CDs.
Despite that fact, you can still use the rpm and yum commands to get information
about software installed on your live CD and packages available from repositories.
The following are a few examples of commands to get information on RPM packages
installed on a Fedora live CD.
Name : pan
Arch : i386
Version: 0.14.2.91
...
Summary : A GNOME/GTK+ news reader for X
Description:
Pan is a newsreader which attempts to be pleasant to new and
advanced users alike.
...
You can use many other options with the rpm and yum commands that you can
find on their respective man pages. Of course, along with those options shown, there
are options for adding and removing software packages using those two commands.
Many other options are available with the emerge command. Refer to the emerge
man page for further information on ways of using emerge to manage software
in Gentoo.
to make your live CD. Two projects illustrated in this book offer tools for running a
modified installation to produce a live CD ISO image:
■ Fedora Kadischi Project (with anaconda)—Using the kadischi com-
mand from the Fedora project of the same name, you can start a process that
launches the Fedora installer (called anaconda) to create the live CD ISO
image. With kadischi, you can install all the packages you want to include in
your live CD to a directory on your hard disk, and then start up kadischi to
run through a modified anaconda installation procedure.
To save you some trouble as you perfect your live CD, you can create a kick-
start file. Information you put in your kickstart file can save you the trouble
of clicking through installation screens. You can simply modify the script and
run it again (after you have made your corrections).
■ Gentoo Catalyst Project—Catalyst is the installer used with Gentoo.
Using Catalyst, along with a spec file, you can tailor a live CD “install” so
that it controls the build process to the smallest detail. The result can be a
highly tuned, highly configured Linux system.
Whether you choose to create your live Linux CD by remastering or by using a
modified installer, understanding how packaging, file systems, and boot loaders
work on your live CD will help you make a quality live CD.
SUMMARY
Although a live Linux CD is, in many ways, like any installed Linux system, some
components are of special interest when you are building a live CD. With an
installed Linux system, you typically set up everything when the software is first
installed so it is tuned to work with your specific hardware. Because a live CD is
typically expected to boot up and be configured quickly on different computer
hardware, setting up a boot loader with options to overcome potential problems can
be helpful.
Isolinux is the boot loader most often used with live Linux CDs. With Isolinux,
you can configure the look of the boot screens, timeout values, and multiple labels
to boot from. Each label can contain different options to help overcome problems
with video settings or failed X display configuration. As an alternative to Isolinux,
this chapter describes how to configure GRUB as your live CD’s boot loader. GRUB
can be used to select different boot labels from a menu interface.
164 Live Linux CDs
Because of limited space on live CDs and the need to write to what the CD
saves as read-only files and directories, the types of file systems used with live CDs
are very important. To be able to compress file system data, some live CDs com-
press their file systems into single archives that can be decompressed on-the-fly
using the cloop driver. Other live CDs use the Squashfs file system to provide a
read-only file system to use.
To be capable of writing to files and directories from the CD, some live CDs use
the UnionFS file system. Using UnionFS, a file system can join read-only and
read/write branches to give the user the appearance of a completely writeable file
system. This also provides a means of saving changes to files and directories so that
they can persist across reboots.
When you set out to remaster an existing installer or create one using a Linux
installer, the Linux distribution you choose to base your live CD on is very impor-
tant. This chapter described the different tools, software repositories, and software
packaging formats available with Knoppix (Debian), Fedora, and Gentoo.
CHAPTER 6
Not only is Knoppix the most popular live CD to use, but it is also the live CD dis-
tribution that has seen the greatest interest in customizing and remastering. Unlike
a Fedora live CD, in which you use scripts from the Kadischi project to essentially
build a live CD from a Fedora install, the common way to remaster Knoppix is by
copying, changing, and rebuilding files from a live Knoppix CD itself.
The remastering process is different than the customization steps described in
Chapter 3, “Customizing a Live CD.” Whereas customization can pull desktop set-
tings or even applications into an existing Knoppix system, remastering lets you
change what is in the Knoppix CD itself. The result is a live CD that can do every-
thing you want it to do, from start to finish.
Much of the procedure shown in this chapter is derived from the Knoppix
Remastering Howto (www.knoppix.net/wiki/Knoppix_Remastering_Howto), as well
as others available on the Web. Refer to that document for further information on
Knoppix remastering as it becomes available. The forum for Customizing and
Remastering Knoppix is located at www.knoppix.net/forum/viewforum.php?f=2.
Because the commands you will use to remaster Knoppix are on the Knoppix
CD itself, you can learn about other options for those commands using the man com-
mand while Knoppix is running. In particular, you might want to check out man
pages for mkisofs (for creating ISO images) and create_compressed_fs (for com-
pressing the KNOPPIX image).
When you know how to create a basic custom Knoppix CD, information at the
end of this chapter describes different ways of doing specialized customization.
These include tips for using some custom scripts to make the setup process easier.
165
166 Live Linux CDs
Figure 6-1 shows the general flow of what happens when your remaster Knop-
pix to make your own custom live CD. It begins by booting a Knoppix CD on a PC
that has enough available memory and disk space to handle the process and ends
when you burn your custom ISO image to a blank CD. In between, you modify the
contents of the Knoppix system you copy to disk so it includes the software and set-
tings you want.
If you are ready to start creating your own customized, remastered Knoppix CD,
you can begin by choosing the Knoppix distribution you want to use as the basis for
your custom Knoppix CD.
CHAPTER 6 Building a Custom Knoppix Live CD 167
Boot Produce
Knoppix CD Custom Knoppix CD
Uncompress/copy
Knoppix file system to
disk
Burn image to CD
NOTE
Using the standard Knoppix distribution offers the best opportunity to use
the latest Knoppix technology. Also, there is more risk of getting broken or
even malicious software if you just grab some random distribution off the
Internet. For those reasons, the procedure in this chapter uses the standard
Knoppix distribution for illustration.
■ Memory (RAM and swap)—At least 1GB of memory (RAM plus swap) is
recommended to create a CD iso image, while 5GB of memory is recom-
mended to create a single-layer DVD. For example, if you have 512MB of
RAM, you need at least 512MB swap for a CD and 4.5GB of swap for a DVD.
■ Hard-disk space—For hard-disk space, you need between 3GB (CD) and
15GB (DVD) of space on a Linux file system. Linux file systems such as ext3
or xfs should work fine.
■ Internet connection—Knoppix automatically configures most wired Ether-
net cards and connects to the network (assuming that a DHCP server is avail-
able). If needed, Knoppix can also be configured manually for many wireless
network cards or for a static Ethernet network connection.
The procedure that follows here assumes that you have a Linux system installed
on your hard disk (with the memory and disk space available as just described). To
carry out the customization, however, the procedure assumes that you are booting
Knoppix and carrying out the instructions from there. Knoppix should detect your
swap area automatically, so you need only be sure that the hard disk space you will
use is on a Linux file system that Knoppix can support.
REMASTERING KNOPPIX
With your computer prepared as described previously, you can start the process of
remastering Knoppix. This procedure was done using a standard Knoppix 5.0.1 CD
(about 696MB). The procedure is split into the following major parts: preparing for
remastering, working in the chroot environment, modifying boot files, creating the
final CD image, and testing and burning the CD image.
NOTE
If you are remastering an official Knoppix DVD, you will notice that there is
a KNOPPIX and a KNOPPIX2 image. Allowing multiple KNOPPIX images (KNOP-
PIX2, KNOPPIX3, and so on) to exist lets you maintain KNOPPIX images that
are a reasonable size to work with. When Knoppix boots up, all KNOPPIX
images are merged using the UnionFS file system. For the purposes of this
procedure, only the single KNOPPIX image that comes on the Knoppix CD is
described.
9. Copy boot files—The boot directory on the Knoppix CD contains the files
needed to boot the live CD. You also need to copy the modules directory. To
copy those files to your master directory so you can use and modify them,
type the following:
# cp -ar /cdrom/boot /media/hda1/knoppix/master/boot
# cp -ar /cdrom/KNOPPIX/modules /media/hda1/knoppix/master/KNOPPIX
10. Copy start-up pages—To copy the first HTML page that appears when
Knoppix boots (or if you open the Knoppix CD in Windows) to your master
directory, type the following:
# cp /cdrom/index.html /media/hda1/knoppix/master
# cp /cdrom/autorun.* /media/hda1/knoppix/master
# cp /cdrom/cdrom.ico /media/hda1/knoppix/master
11. Copy files from CD—You want to copy all the other files needed when
the CD starts up (FAQs and home pages in different languages, license
information, and some images) to your master directory. The following
command line (suggested by the Knoppix Customization Howto) copies all
files from the CD that are less than about 10MB (to exclude copying the
690MB KNOPPIX file):
# cd /cdrom/KNOPPIX && find . -size -10000k -type f -exec \
cp -p —parents '{}' /media/hda1/knoppix/master/KNOPPIX/ \;
NOTE
The two command lines shown here can actually be typed as a single com-
mand line. The backslash (\) at the end of the first line enables you to press
Enter and still have the second line be part of the first.
CHAPTER 6 Building a Custom Knoppix Live CD 173
Now you should have all files needed to boot your live CD in the master/KNOP-
PIX directory. The entire KNOPPIX file system you are using should be in the
source/KNOPPIX directory. Your next step is to change your root directory (chroot)
to the source/KNOPPIX directory and modify that directory structure to contain the
applications, files, and directories you want to include on your live CD.
NOTE
If the partition you chroot to was mounted with the nodev option, a
/dev/null error message might appear (“/dev/null: Permission Denied”).
You can get around this problem by adding the dev option to the entry in
/etc/fstab and then unmounting and remounting the partition. For exam-
ple, the new fstab entry for /dev/hda1 might then appear as follows:
/dev/hda1/media/hda1 ext3 noauto,users,exec,dev 0 0
174 Live Linux CDs
Ignore the /etc/fstab warning (/proc should mount despite that). At this
point, your shell looks at the /media/hda1/knoppix/source/KNOPPIX directory
as your root directory until you exit that shell. Make sure you use this shell
for the steps that follow.
14. Add network access—Because you added the resolv.conf file earlier to
your chroot environment, you should now have Internet access from the
chrooted shell. To check, try the ping command:
# ping www.knoppix.net
If you are only adding new software packages you get from the Internet, you
can proceed to the next step. However, if you want to add data files, applica-
tions, or other software from your LAN, consider configuring the following
network connection types:
■ Samba—By starting the Samba server from the Knoppix desktop (KNOP-
PIX q Services q Start Samba Server), you can mount SMB shares from
Windows clients to copy files from those shares to your chroot environ-
ment. If you do this, you might need to make changes to your
/etc/samba/smb.conf file in the chrooted environment (such as the work-
group name) for this to work on your LAN.
With Samba running on your desktop, you can mount an SMB share from
your LAN by creating a mount point and using the mount command. Con-
sider this example:
# mkdir /tmp/share
# mount -t smbfs //host1/home /tmp/share
Assuming that a share named home is available from a computer named
host1 on your LAN, the share will be mounted on the /tmp/share directory
in your chrooted environment. You can then copy files across to your
chroot environment from that mounted share. (Remember to unmount the
share and remove the mount point before building the CD image.)
■ NFS—Likewise, you can start the NFS server (a popular service for shar-
ing files among Linux and UNIX systems) to use that service to share files
with other Linux systems. Here is what you would type from your chroot
shell to mount a shared NFS directory (/home/chris) from a host at IP
address 10.0.0.1:
# mkdir /tmp/nfs
# mount -t nfs 10.0.0.1:/home/chris /tmp/nfs
CHAPTER 6 Building a Custom Knoppix Live CD 175
The command just shown displays a list of packages, sorted by their file size.
Note the names of the packages you might want to remove. If you are not sure
what a package contains, you can list its description or the files it contains.
For example, to see what openoffice-de-en contains, type the following:
# dpkg-query -s openoffice-de-en
Package: openoffice-de-en
Status: install ok installed
Priority: optional
Section: unknown
Installed-Size: 2353204
Maintainer: Klaus Knopper <knoppix@knopper.net>
Architecture: i386
Version: 2:2.0.2-1
Replaces: openoffice-de-en
Depends: libnspr4
Description: The OpenOffice suite, see
http://www.openoffice.org/
This release uses a quick&dirty hack to support english
as well as german layout and templates in KNOPPIX.
176 Live Linux CDs
For example, if you don’t need an office suite for your live CD (or can live
with a lightweight word processor), you can remove that package using the
apt-get command. The following command removes (remove) the openof-
fice-de-en package and all its dependencies (—purge):
# apt-get remove —purge openoffice-de-en
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
openoffice-de-en*
0 upgraded, 0 newly installed, 1 to remove and 871 not upgraded.
Need to get 0B of archives.
After unpacking 362MB disk space will be freed.
Do you want to continue? [Y/n] Y
Press Y to remove the package. In this example, you can see that removing
the package enables you to save 362MB of disk space (before compression)
that you can use for other software. Use the same command to remove any
other packages you don’t want on your live CD.
17. Adding software—With the packages removed that you no longer need, you
can now add other packages you want on your CD. You can choose from any
of the thousands of packages available from Debian software repositories.
NOTE
Chapter 9, “Customizing a Security Live Linux CD,” through Chapter 14,
“Customizing a Cluster Live Linux CD,” describe software packages that are
appropriate for different types of live CDs. Refer to those chapters if you
want to look into additional software packages to add to a remastered
Knoppix live CD.
Because Openoffice.org was removed from the previous step, the following
example adds a stand-alone word processor in its place:
# apt-get install abiword
You can repeat this command for every package you want installed on your
live CD.
18. Cleaning up software—When you have finished deleting and adding the
software you want, you should do some cleanup to ensure that extraneous
files and packages created in the process are not left on your CD. Here are a
few things to do:
To see whether all your deleting and adding of packages left behind any
unneeded packages, you can run the deborphan command:
# deborphan | less
CHAPTER 6 Building a Custom Knoppix Live CD 177
You can remove any orphaned packages using the apt-get remove com-
mand, shown earlier. Or, as the Knoppix Remastering Howto suggests, you
can simply pipe the list to apt-get remove and delete them all as once, as
follows:
# deborphan | xargs apt-get -y remove
A removed package can sometimes leave behind configuration files. To find
out whether this happened, you can list those packages that you chose to
remove (R) but left behind a configuration file (C). The following command
lists those packages:
# dpkg -l | grep ^rc
You can then remove the files left behind by typing the following:
# dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P
Because apt-get saves all software packages you downloaded and installed
in cache, you should clean out those files before proceeding. Here’s how:
# apt-get clean
Testing Applications
Although applications that rely on particular hardware configurations are best
tested after you build your custom Knoppix CD, most command and graphical
utilities that you install can easily be tested from your chroot environment. These
are a couple of ways to go about launching an X application from your chroot
environment:
Figure 6-2 shows an example of the steps just run. Inside the Xnest server
window, you can see icewm window manager, the xclock application, and two
other applications I ran from menus within that window (Firefox browser and
xboard chess application). The Terminal window in the lower-left corner of
the screen is where Xnest, the icewm window manager, and xclock were
launched.
(files beginning with a dot that end up in the /home/knoppix directory) on the
fly. (More on this file a bit later.)
■ 50x11-common_determine-startup—In the case where no X session start-up
program was set, the settings in this file cause a user-defined or system
default session manager, window manager, and terminal emulator to start up.
■ 75dbus_dbus-launch—This script activates the session bus when the X ses-
sion is started.
■ 90x11-common_ssh-agent—This file contains settings that turn on the ssh-
agent to authenticate clients that run on the X desktop.
■ 99x11-common_start—The single exec line in this file launches the desktop
set by $STARTUP.
As I mentioned earlier, much of the activity for setting the user environment
and desktop happens in the 45xsession file. This file is commented well, so an
experienced Linux user can get a sense of what is happening when a Knoppix desk-
top starts up by just reading that file. The following describes the default activities
that occur when a Knoppix desktop boots up (by default) and how you can change
those items that are set:
■ Global variables—Variables that are active for all desktop types are set
(home directory, username, host name, default cursor, language, keyboard,
and so on).
■ Start KDE—With the default KDE desktop set, the startkde settings are run.
■ Play audio—The playsound script runs to play the /usr/share/sound/
startup.ogg file (“Initiating start-up sequence”). You can substitute any
.ogg audio file you like for startup.ogg to have that play instead.
■ Copy desktop files (/etc/skel)—If no persistent desktop is available
(from a previously saved session), all files contained in the Desktop and .kde
directories are copied from /etc/skel to the knoppix home directory. By
default, you get Floppy and Trash icons in the Desktop directory (and, there-
fore, on your desktop). Other icons representing disk partitions and CD-ROM
drives are added as those devices are available. The .kde directory is where
most of your KDE desktop settings come from. Copy your personal set of
KDE configuration files to the /etc/skel/.kde directory to have those set-
tings used when you boot up your custom Knoppix.
■ Copy knoppix files (/usr/share/knoppix/profile)—Several dot files for
such things as Mozilla, Netscape, and encrypted keys are copied from this
CHAPTER 6 Building a Custom Knoppix Live CD 181
directory to the knoppix home directory. You can modify these files or add
your own.
■ Knoppix start page—An HTML page (/cdrom/index.html) containing
links to Knoppix information is displayed when the desktop starts up. You
can replace this file with your own HTML page, if you choose.
■ Desktop background—The desktop background (wallpaper) is set to
knoppix.jpg (located in /usr/local/lib on the CD). Change that to a differ-
ent file to have the new file used as the background instead.
■ Desktop themes—If custom themes are available from
/cdrom/KNOPPIX/ksplash, those themes are copied into the Knoppix home
directory under .kde/share/apps. You can add to that directory themes that
you want to make available to the user.
■ Change desktop icons—Icons are placed on the desktop with the mkdesk-
tophdicons script (in /usr/bin/). Edit that script to change which icons go
on the desktop.
■ Initialize KDE—The kdeinit script starts to bring up the KDE environ-
ment. This includes dcopserver, clauncher, kded, kxkb, kaccess, kmserver,
kwin, kdesktop, and other processes used in the KDE environment.
If instead of using the default KDE environment you pass a different desktop
name at the boot prompt using knoppix desktop=window_manager (such as twm,
icewm, or fluxbox), search for any of those window manager names in the 45xses-
sion file to see how startup is handled for it. For example, starttwm indicates the
TWM window manager and starticewm is for the Ice window manager. The script
also supports desktops that aren’t installed.
NOTE
When Knoppix is running, if you want to restart the desktop with a different
window manager, you can press Ctrl+Alt+Backspace to end the current ses-
sion. Then change the value of DESKTOP in the /etc/sysconfig/desktop file
and type startx to start the new desktop.
Available window managers include icewm, twm, larswm, and fluxbox. The
script also supports gnome, windowmaker, xfce, ratpoison, lg3d, openbox,
xfcd4, kiosk, tdp, and nx, but they’re not available unless you install them
yourself.
Configuration files or data files you add to the user environment don’t have to
be limited to those that support desktop features. Any files or configuration settings
182 Live Linux CDs
that you want to apply to the user directory can simply be added to the /etc/skel
directory.
Although you can also add any data files you want the knoppix user to have by
placing them in the /etc/skel directory, for a large amount of data, you should use
a different location in the file system, such as a directory under /var.
In the example just shown, the ssh service start-up script is linked to a file
named S55ssh in the /etc/rc5.d directory. The convention of that filename is the
letter S (for “start”), followed by a number (indicating the order the script will be
run), and ending with the script name. (You can use any number you like, although
the convention is to use numbers above 40 for services that require the network to
be running and all local file systems to be mounted.) In this case, the sshd daemon
starts automatically when you boot Knoppix, so remote users can log into the com-
puter using ssh.
CHAPTER 6 Building a Custom Knoppix Live CD 183
Although Knoppix supports this facility, it makes little use of the SysV init
facility itself. However, if you want to see the start-up features that Knoppix runs
itself (and possibly change those features), I suggest checking the following files:
■ /etc/inittab—This file defines the initial run level, as well as some fea-
tures that are started at different run levels. For example, the last line in this
file launches xsession for run level 5 to start your X desktop session.
■ /etc/init.d/knoppix-autoconfig—This script is executed when the system
boots to single-user mode or higher (in other words, every time Knoppix starts
up). It contains many of the basic settings needed to run Knoppix (keyboard,
language, boot options, file system mounting, and so on). This script is run
from a link to /etc/rcS.d/S00knoppix-autoconfig. See Chapter 4, “Under-
standing How Live Linux CDs Work,” for a longer description of this file.
Cleaning Up the chroot Environment
Before you leave the chroot environment, you need to make sure that everything is
cleaned up. Anything you leave behind in the file-system structure will go on your
live CD. The first thing you need to do is unmount the /proc directory you mounted,
as follows:
# umount /proc
Next remove any temporary files or configuration files that you changed during
the course of creating your custom Knoppix. Here are a few places to check:
■ /root directory—Type ls -lat /root and remove any files that were cre-
ated unintentionally in the process of working as the root user.
■ /var/log directory—Check for any log files left behind from applications
you tried out (such as the X server).
■ apt files—Remove files from the /var/lib/apt/lists directory that were
put there when you installed applications using apt-get. From that directory,
you can type rm *debian* *knoppix* to remove extraneous package files
left behind.
One way to make sure that no files created during the customization process are
left behind is to search the entire source directory structure for any files created
from the time you started the customization process. Here is a find command line
that list all files created in the past two days:
# cd /media/hda1/knoppix/source
# find . -type f -mtime 1 -exec ls -ld '{}' \; | less
184 Live Linux CDs
You can page through the list that appears to see the new files that were cre-
ated. Remember that this list also includes software you have installed and want to
keep; think carefully about the contents of this list before you begin deleting files.
When you feel that your Knoppix customization is complete, you can get out of
the chroot environment by simply exiting the chroot shell:
# exit
Next you can begin putting together the KNOPPIX image that will go on the CD.
NOTE
Although in this example we are using a single KNOPPIX image, you can have
multiple KNOPPIX images in the /KNOPPIX directory (KNOPPIX, KNOPPIX2,
KNOPPIX3, and so on). They will all be picked up and merged into a single
root file system (/) when Knoppix boots up.
Allowing multiple KNOPPIX images not only makes each of those images a
more manageable size, but it also reduces the total amount of memory you
need, instead of producing a single, massive KNOPPIX image. The official
Knoppix DVD includes KNOPPIX and KNOPPIX2 images that are merged.
The mkisofs command is the tool used to make a set of selected files into a sin-
gle ISO 9660 file-system image. Because this file system needs to include
Linux/UNIX file system features that are not part of the official ISO 9660 standard,
several options were added to the command line to support those needed features.
The image we create here is not itself bootable (no -b or -c options to add El Torito
boot information). It will, however, be included on the bootable image.
In this example, after the ISO 9660 image is created, it is piped to the
create_compressed_fs command to reduce the size of that image. Here’s an exam-
ple of that command line:
CHAPTER 6 Building a Custom Knoppix Live CD 185
The -R option adds SUSP and RR records that must have file-system attributes
that a Linux or UNIX system expects (longer filenames, symbolic links, permission
bits, and so on). The -U option allows filenames that might include characters that
violate the ISO 9660 standard (such as leading dots, multiple dots, mixed-case
files, and so on). The hide-rr-moved option hides the RR_Moved directory on the
image (if it exists) by renaming it to .rr_moved.
Using the -cache-inodes option saves space on the CD by causing files that are
hard-linked (multiple names for a single file) to physically appear only once on the
CD. The -no-bak option excludes backup files (ending in .bak or including # or ~
characters) from the CD. The -pad option causes the end of the image to be padded
by 300K (150 sectors).
Note the location of the source directory and make sure it matches where
you put your source/KNOPPIX directory. Likewise, note the location where the
image file (KNOPPIX) will end up (in this case, /media/hda1/knoppix/master/
KNOPPIX/KNOPPIX).
The output of mkisofs is piped to the create_compressed_fs command. (That
command is run with the nice command, which attempts to increase the processor
priority to -5). The create_compressed_fs command will run for a while to convert
the image file to a compressed file-system image that the cloop driver can mount
and access. The block size (65536) is set to a multiple of 512 bytes.
When this command line was run on a 1.7GB source directory structure, the
resulting KNOPPIX image was 627MB (about a 39% compression ratio). With the
KNOPPIX file inserted into your master/KNOPPIX directory, you can now take a look
at all the files that will appear on your CD. Most of these files are associated with
how the CD will boot up. You can customize those boot files as well.
the boot process as you like. Ultimately, isolinux starts a bootable kernel image
with an associated initial RAM disk.
If you like, you can add more message files to go with function key definitions
(f4, f5, f6, and so on). For example, you might want to create message files that
describe the contents of the CD or licensing information.
Because the isolinux files are basically the same from one type of live CD to
another, Chapter 5, “Looking Inside Live CD Components,” has general descrip-
tions of Isolinux files. Refer to that chapter for information on creating your own
splash screens and modifying configuration and message files.
Besides the isolinux files, you might consider changing informational text and
HTML files that are available from the CD when it first boots up. These files
include the index.html file that appears in the root directory on the CD. That file
points to introductory files in the KNOPPIX directory that are in a variety of lan-
guages (French, Italian, Spanish, Japanese, and others). You might also look at the
FAQ files in that same directory (also available in different languages) to see
whether you want to change or replace them.
CHAPTER 6 Building a Custom Knoppix Live CD 187
# cd /media/hda1/knoppix/master
# find -type f -not -name md5sums -not -name boot.cat \
-not -name isolinux.bin -exec md5sum '{}' \; > KNOPPIX/md5sums
The command line just shown gathers all files in the master directory and its
subdirectories (excluding the md5sums, boot.cat, and isolinux.bin files), runs the
md5sum command on them, and copies the resulting md5sum for each file to the
188 Live Linux CDs
md5sums file. The content of this file shows each md5sum followed by the file it repre-
sents. For example:
65311f3570a8f9f2bfdb164dc93a3729 ./KNOPPIX/background.jpg
b820d6bfaa53dcf1b170a581661136d9 ./KNOPPIX/avm-license.txt
7383e6da11f2801dbf09980dff20746d ./KNOPPIX/background.jpg
7aa99ddd714a6f0e565555e7eb2a4953 ./KNOPPIX/images/knoppix-24-1.jpg
b72b38f6b70f1cda7d0a73b995f97a11 ./KNOPPIX/images/knoppix-header.png
a19ea9bd8e2701163d22f98cc3da804c ./KNOPPIX/index.html
b346de5c68adc774927725a50740cfdc ./KNOPPIX/index_dk.html
.
.
.
After the CD is produced, you can check the integrity of each file by running
the command md5sum filename. The results should match the left side next to the
filename you just checked; this is a good way to check the integrity of any file that
might be in question.
The final step in producing your custom Knoppix live CD image is to run
another mkisofs command. This time, however, you need to add options to that
command line that make it possible to boot the contents of the CD image. Here’s an
example:
# cd /media/hda1/knoppix/master
# mkisofs -pad -l -r -J -v -V "MyKnop" -no-emul-boot -boot-load-size 4 \
-boot-info-table -b boot/isolinux/isolinux.bin \
-c boot/isolinux/boot.cat -hide-rr-moved \
-o /media/hda1/knoppix/knoppix.iso /media/hda1/knoppix/master
The mkisofs command line shown converts the directory structure you just cre-
ated for your custom live CD (assuming that you placed it in /media/hda1/knop-
pix/master) into a single file (-o /media/hda1/knoppix/knoppix.iso). That file is
an ISO 9660 CD-ROM file system that allows long filenames (-l), SUSP extensions
and permissions that are useful for a Linux or UNIX system (-r), and Joliet direc-
tory records (-J).
You should add your own volume name (-V) instead of the "MyKnop" as was done
here. Several options make the CD bootable:
■ Specifying that the El Torito image load and execute without performing disk
emulation (-no-emul-boot)
■ Indicating the location of the boot catalog file (-c boot/isolinux/boot.cat)
CHAPTER 6 Building a Custom Knoppix Live CD 189
The -hide-rr-moved option moves the RR_MOVED directory (if one exists) to a
directory named .rr_moved at the top of the file-system tree (effectively hiding it
from view). The -boot-load-size option is set to 4, indicating that four sectors (of
512 bytes) are used to load in no-emulation mode.
When the mkisofs command finishes, the resulting boot image named knop-
pix.iso is stored in your /media/hda1/knoppix directory. That image is ready to be
tested and burned to CD or DVD.
The image should boot up in a window on your desktop. Unless you have a ton
of RAM on your computer, you probably won’t have the 512MB of RAM available
(as suggested earlier with -m 512), and your custom Knoppix will probably run
slowly on your desktop. However, this is a good way to make sure that the image is
basically working before you start burning up your CDs.
The following simple cdrecord command (with a blank CD or DVD medium in
a writeable drive) can probably be used to burn your CD image to CD or DVD:
# cdrecord -v -data knoppix.iso
NOTE
This script has not been updated for some time now. Although the follow-
ing procedure eventually resulted in a working ISO image, the script failed
sporadically in some terminal windows.
CHAPTER 6 Building a Custom Knoppix Live CD 191
FIGURE 6-3
After Knoppix files are
copied to disk, choose a
remastering task.
5. Choose Chroot into Your Remaster and select OK. When the shell prompt
appears, you are ready to begin working in your chroot environment.
6. Follow the instructions from earlier in this chapter for working in the chroot
environment.
7. When you have done everything you want to do with your remaster, type exit
(to return to the menu).
8. Select Edit Several Options. From the screen that appears, you can change
the name of the file system, the author of the CD, and a home page. Then
click Quit when you are done.
9. Select to compress the file system. The script gets any available updates and
compresses the file system to a single ISO image.
10. Choose the Create isofs option. The script compresses the file system to a
single ISO image. (This takes a while.)
11. When you are done, select Quit to exit the script.
You can now test and use the ISO image as described earlier in this chapter.
192 Live Linux CDs
SUMMARY
The process of remastering a custom Knoppix CD is largely a manual process, but
many people have managed to do it successfully. The general steps to remastering
Knoppix involve unpacking the Knoppix files directly from a running Knoppix sys-
tem, changing the unpacked files to make the system suit your needs, and then
repacking it all into an ISO file that can be burned to disk.
By modifying the Knoppix file system that was copied to your hard disk in a
chrooted environment, you can install and remove packages, change settings, and
test out your changes as though you were working directly from the live CD itself.
After you recompress the file system and add it back into a full, bootable ISO
image, you can test that image using emulators such as qemu or by burning the
image to CD and trying it out.
CHAPTER 7
To start building your own bootable live Linux CD system, you should set up the
tools you need to build your live Linux and the software packages you plan to put
into it. Because this chapter steps you through creating Live Linux CDs based on
Fedora Core using a project called Kadischi, I describe how to do the following:
■ Obtain and set up the Fedora Core distribution and Kadischi tools needed to
create the live Fedora CD
■ Run the commands to create your first Fedora live CD
■ Learn about the many opportunities to customize your Fedora live CD
When you understand the basics for building a Fedora live CD with Kadischi,
you can go on to use many of the techniques in the third part of this book to create
specialized live Linux CDs and DVDs.
Unlike Knoppix, which is itself a bootable Linux distribution, Kadischi is really
a set of tools you can use to produce your own live Linux distribution based on the
Red Hat–sponsored Fedora Core Linux project. Using the Red Hat anaconda
installer, Kadischi essentially creates a live Fedora Core CD or DVD (in the form of
an ISO image).
193
194 Live Linux CDs
In fact, in some ways, Kadischi can produce live CDs that are more secure and eas-
ier to fix and rebuild than Knoppix live CDs. Here’s how:
■ Read-only file system—By default, Kadischi uses Squashfs as the file sys-
tem that holds most of the files on a Fedora live CD. The drawback is that
those files and directories used directly from the live CD cannot be changed,
deleted, or added to once the CD is running. By keeping those files and
directories read-only, however, fewer opportunities exist to hack into areas
that might be vulnerable. Although making most of the file system readable
in Knoppix with UnionFS is user-friendly, it is inherently less secure.
■ Kickstart—By using a kickstart file, you can define all the options you want
to build your live CD. Instead of having to maintain a chroot environment
(as is done with remastering Knoppix), you can simply rerun Kadischi using
the same kickstart file. Small changes or updated packages in the software
repository can be immediately picked up and incorporated into a new
ISO image.
■ Easy firewall and service setup—During the process of producing a live
CD with Kadischi, you have the opportunity to turn on and configure a
secure firewall. Likewise, you can add users (with passwords) and even turn
on or off services that are needed on the live CD (such as remote shell, FTP
service, or Web service).
Kadischi was created by Darko Ilic as part of the Google Summer of Code
project in 2005 (http://code.google.com/soc-results.html). Discussions of the devel-
opment process on the Fedora Live CD mailing list (www.redhat.com/archives/
fedora-livecd-list/index.html) can give you some insights into the design decisions.
Information about Kadischi is maintained on the Fedora Project Wiki (www.
fedoraproject.org/wiki/kadischi).
The technology on which Kadischi is based includes software from the
Stateless-linux project (http://fedora.redhat.com/projects/stateless)—in particular,
the readonly-root package. Some ideas used for creating Kadischi were also taken
from the Linux4All project (www.linux4all.de), which created the Basilisk
Fedora–based live CD.
Like many other Linux live CD projects, Isolinux (http://syslinux.zytor.com/
iso.php) is the boot loader used by default to manage the live CD’s boot process for
Fedora. The mkisofs command, used to produce the resulting ISO image, is part of
the cdrecord project (http://cdrecord.berlios.de/old/private/cdrecord.html).
Going forward, a fair amount of development is going on with Kadischi. As
more Kadischi features are added to the basic Anaconda installer, building live
CDs based on Fedora will become a more mainstream activity that is built into
196 Live Linux CDs
Fedora Core itself. As for new features that are currently being worked on, a graph-
ical front end for Kadischi is in the works. Tools also are being developed for adding
user-friendly live CD features, such as the capability to keep a persistent /home
directory.
Now that the Kadischi tools are becoming stable, you can expect more Fedora-
based live CDs to begin appearing. A good place to start looking for Fedora live
CDs is from the Fedora Unity project (www.fedoraunity.org). The first live CDs that
organization produced were based on Fedora Core 5 and Fedora Core 6, Test 2.
With Fedora Core installed, you are ready to begin setting up Kadischi.
For the purposes of this procedure, however, I have created an RPM containing
the Kadischi tools that you can install on your Fedora Core 6 system. Although the
software in this RPM works as of this writing with Fedora Core 6, if you want the
latest software (or if updates to Fedora 6 break the Kadischi RPM provided with
this book), refer to the Fedora Project’s Kadischi page to get the latest software.
From a running Fedora Core 6 system, you can install the Kadischi RPM using
the DVD included with this book. For example, with the DVD inserted, type the
following from a terminal window:
# rpm -Uhv /media/LiveCDs/RPMS/kadischi*rpm
The Kadischi software you use to create your live Linux distros is installed in
the following locations:
■ /etc/kadischi—Contains configuration build files used to create your live
Linux CDs.
■ /usr/share/kadischi—Contains scripts and examples used to configure
your live Linux CD.
■ /usr/sbin—Contains the kadischi command, which is used to build the ISO
image containing your live Linux distribution.
■ /usr/libexec/kadischi—Contains some commands used in the process of
building the live CD. These include eject-live-cd, find-live-cd, and
scanswap.
NOTE
You can download the complete Fedora Core 6 installation DVD from a
Fedora mirror site (see http://fedora.redhat.com/download/mirrors.
html). The Fedora Core DVD is also packaged with several books on
Fedora, such as the Fedora 6 and Red Hat Enterprise Linux Bible, by Christopher
Negus (Wiley Publishing).
CHAPTER 7 Building a Basic Fedora Live CD 199
The contents consist of about 3GB of data, so the copy should take a few min-
utes. Remember the location of your repository directory (in this case, $HOME/FC6).
That is the location that you need to identify later when you build your live Linux
with Kadischi.
TIP
Software Repositories
If you want to use a different version of Fedora Core than you have avail-
able, or if you don’t have enough disk space to store Fedora Core locally,
you use a public software repository. Here’s an example of a public Fedora
repository address; the process will take a lot longer but should work just
as well:
http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os
individual packages that are selected. The comps.xml file contains definitions of
available packages and package groups.
When you copied the repodata directory to your hard disk in the previous sec-
tion, the comps.xml file was copied there as well (for example, $HOME/FC6/repo-
data/comps.xml). The screens used to select software categories, packages, and
groups that you see from the anaconda installer come from this file. The tags used
to indicate categories, groups, and packages are <category>, <group>, and <pack-
agelist>, respectively.
Figure 7-1 shows an example of screens that anaconda presents during Fedora
installation (or a live CD build) that reflect the available categories, groups, and
packages. Those entries shown come directly from the comps.xml file.
You might wonder why you should care about comps.xml. Well, if you want to
add packages to a Fedora live CD that are not in Fedora Core, those packages need
to be included in the comps.xml file you are using. Then you can choose to add
those packages when you build your live CD (either from an anaconda screen or
from a kickstart file).
Starting with the Fedora Core software repository you added to your hard disk
in the previous section, here is how you might go about placing other packages into
your repository so they can be added later to your live CD.
1. Enable yum repositories—You can get the packages you want and add
them to your repository using the yum facility. With Fedora Core installed,
yum is already enabled to get additional packages from Fedora Core and
CHAPTER 7 Building a Basic Fedora Live CD 201
Fedora Extras. However, if you want to get packages from the rpm.livna.org
repository, you can do so by typing the following command as root user:
# rpm -ivh http://rpm.livna.org/livna-release-6.rpm
NOTE
A new feature in anaconda for Fedora Core 6 allows you to merge
comps.xml files from different repositories. So, for example, you could
build a live CD using both Fedora Core and Fedora Extras packages without
having to add everything to a single comps.xml file. You could even add
packages from third-party repositories, such as http://rpm.livna.org.
Chapter 11, “Customizing a Gaming Live Linux CD,” describes how to use
this new feature to create a gaming live CD from Fedora Core and Fedora
Extras. Use this section as a means of understanding how the underlying
comps.xml structure works.
<packagereq type="default">bittorrent-gui</packagereq>
<packagereq type="default">ncftp</packagereq>
</packagelist>
</group>
<group>
<id>multimedia</id>
<name>Multimedia</name>
<description>Packages from Livna.</description>
<default>true</default>
<uservisible>true</uservisible>
<packagelist>
<packagereq type="default">mplayer</packagereq>
</packagelist>
</group>
<category>
<id>extras</id>
<name>Extras</name>
<description>Packages from Fedora Extras.</description>
<display_order>01</display_order>
<grouplist>
<groupid>multimedia</groupid>
<groupid>myextras</groupid>
</grouplist>
</category>
I created two groups: MyExtras and Multimedia. In MyExtras, I added pack-
ages from Fedora Extras (just bittorrent, bittorent-gui, and ncftp to start
with). In Multimedia, I added just mplayer. Then I added the group ID for
each group to a new category I called Extras. By setting the display order of
that category to 01, I ensured that it would appear at the front of the category
list on the anaconda screen.
4. Run createrepo—Next I ran the createrepo command to update the reposi-
tory information with the stuff I just added to the comps.xml file. Here’s how:
# cd $HOME/FC6
# createrepo -g Fedora/base/comps.xml $HOME/FC6
Files in the repodata directory will be updated with the new package, group
and category information just added. Later, when you run Kadischi to gener-
ate a live CD, the new category, groups, and packages can be displayed.
Figure 7-2 displays the package-installation screen for anaconda that
appears when the comps.xml changes shown earlier are included.
With all the packages you want added to your repository and the comps.xml file
updated to include those packages, you are ready to start configuring Kadischi.
CHAPTER 7 Building a Basic Fedora Live CD 203
FIGURE 7-2 Create custom software categories and groups on your live CD.
At this point, you should see the Kadischi Fedora LiveCD Creator Tool. Type in
the following information, based on how you set up your repository and where you
want your final ISO image to be placed:
■ Enter a Repository—Type the full path to the directory where you added
your repository. For example, I created my Fedora software repository in the
directory /home/chris/FC6/.
■ Enter a filename and its location—This is where you want the ISO image
to go. In my case, I entered /home/chris/FC6-live.iso.
204 Live Linux CDs
You can add the -f option to the command line to overwrite the location of the
previous ISO file when the new one is created. Add the --text option to the com-
mand line if you want to do the live CD creation process in text mode. If Kadischi is
unable to run in graphical mode on your desktop, it will automatically step back to
text mode. Select OK to continue.
The next steps are part of a standard Fedora Core installation process. You can
find detailed descriptions of this process in many books on Fedora Core (such as
Red Hat Fedora and Enterprise Linux Bible, ISBN 0-47-008278-X, by Christopher
Negus). The following is a checklist covering the install process.
From the terminal window where you launched the install, you can see the
install and ISO build process as it progresses. Depending on the size of the
ISO you are building and your processing power, compressing the tree can
take a while.
At the same time, you will see the Fedora Core installation screens, which
look the same as they would for a regular install of Fedora Core. However, a
few screens that aren’t appropriate to building a live CD are not included in
the process (such as disk partitioning). Figure 7-3 shows an example of the
install process started from the kadischi command (in the terminal window)
and Fedora install screen.
FIGURE 7-3 Installing packages to build the Fedora Core live CD.
When the software packages are installed to the build directory on your hard
disk, the Fedora Core installation screen alerts you that the installation is
complete.
10. Completed installation—Click Reboot to complete the installation.
206 Live Linux CDs
Look back at the original terminal window (or other shell) where you started
the kadischi command. From this terminal window, you are asked to enable
or disable your firewall.
11. Firewall configuration—You can enable or disable your firewall. You can
also customize settings on it.
12. Services selection—Press arrow keys to go to a service you want to enable.
Press the spacebar to have that service enabled (*) or disabled. Enabling first
boot allows the person booting the live CD to add a user and set up some
other features (but prevents the CD from booting right to a login prompt). You
can learn about many of the services by simply typing man service, where
service is replaced by the name of the service you are interested in.
13. Nonroot user creation—You can add a nonroot user (any name you
choose) to the live CD by typing yes. (Typing no skips adding a new user.) If
you add a new user, you need to select a username, a shell (such as
/bin/bash), and a password (twice).
Kadischi now creates the initial RAM disk (initrd) image and compresses
the file system tree. It takes a while to compress the file system; be patient.
After that is done, watch as messages on the screen report as the ISO image
is created and the build directory is cleaned up.
14. Burn CD image?—After Kadischi finishes creating the ISO image, you are
asked if you want to burn the image to CD or DVD. Provided that you have a
CD/DVD burner on your computer, you can type yes to have the image
burned to CD or DVD. When prompted, type the name of the device to which
you want to burn the image (such as /dev/cdrom). Whether you typed yes or
no, the ISO image is now complete and ready for you to use and share as you
like.
The kadischi command shown is about the most basic one you can use. Here
are other options that might interest you that work with kadischi:
your home directory, you could add the following kickstart option:
--kickstart=$HOME/ks.cfg.
NOTE
See the section "Building from a Kickstart File," later in this chapter, for
information on using kickstart files to provide some or all of the informa-
tion needed during a Fedora install.
If you used the same locations as shown in the procedure, the ISO image will be
named FC6-live.iso in your home directory. Here is an example of a qemu com-
mand line for testing that Fedora live CD iso:
# qemu -cdrom ~/FC6-live.iso -boot d -m 768
In this example, qemu boots the FC6-live.iso image so that it appears in a win-
dow on the desktop. The -cdrom option tells qemu that the file is a CD-ROM image.
The -boot d option indicates that the image is booted as an El Torito CD. The -m
option, in this example, tells qemu to use 768MB of RAM as virtual RAM to boot the
live CD (you should use as much as you have available).
The qemu command and the process of burning ISO images to one of those
media are discussed in further detail in Appendix B, “Building, Testing, and Burn-
ing ISOs.”
208 Live Linux CDs
The scripts you can modify in the kadischi directory are python (.py), perl
(.pl), or shell (.sh) scripts:
■ livecd-mkinitrd.sh—This script creates the initial RAM disk (initrd.img)
that is used on the live CD.
■ install-boot.sh—This script creates the files needed to initially boot the
live CD. It copies the initial RAM disk (initrd.img) and kernel, and creates
configuration files in the isolinux directory. You can modify this script to
210 Live Linux CDs
change message files, boot options, and other features that relate directly to
when the live CD boots up (as described later in this chapter).
■ kadischi.py—This is the python script that runs (along with the contents of
the build.conf file) when you launch the kadischi command (/usr/bin/
kadischi). If you like, you can set variables in this script to add options
(such as arguments to anaconda) or override settings (such as the locations of
your build directory or ISO image).
Another opportunity for customizing how Kadischi creates your live Fedora CD
is with scripts in the /usr/share/kadischi/post_install_scripts directory. After
the Fedora software is installed temporarily in the build directory, kadischi runs the
post-install scripts. Names of scripts in the post_install_scripts directory begin
with numbers to indicate the order in which they are executed. Scripts include
these:
■ 01prelink.sh—This script does a chroot to run prelink on the build directory.
■ 02install.sh—This script installs system start-up scripts to the live CD that
uncompress files and mount file systems needed to start the live CD.
■ 03fstab.py—This script modifies the /etc/fstab for the live CD to include
file systems that need to be mounted. You might want to add features to
detect and mount hard disk or other storage media partitions to this script.
■ 04userconfig.pl—This script runs the authconfig and lokkit commands to
turn on requested security features used for the live CD. By default, those
commands enable shadow passwords and disable the firewall and SELinux
features. This script also runs the ntsysv command to let the live CD’s user
select which installed services are turned on or not turned on.
■ 05fsclean.py—This script removes or cleans out directories and files (such
as temporary and log files) that aren’t needed on the live CD.
■ 06sysconfig.py—This scripts creates special links and directories needed
for live CD functions. It also configures firstboot (to let the user do initial
configuration when the CD boots) and kudzu (to do hardware detection each
time the CD boots). (Changing RUN_FIRSTBOOT from YES to NO is one way of
disabling the firstboot process.)
■ 07accounts.sh—This script lets you add a nonroot user to your live CD. This
is a way to get a username and password of your choice added to the live CD
needing to run firstboot and have users enter their own user name before
the CD fully boots up.
You can modify existing scripts or add your own scripts to this directory to
change how the live CD is set up to run. For example, you could change the type of
password protection done by changing the 04auth.sh script.
CHAPTER 7 Building a Basic Fedora Live CD 211
WARNING
Be sure to have a backup copy of the install-boot.sh file before proceed-
ing. If there is a mistake in this file, it could prevent your live CD from boot-
ing at all.
Software for testing and securing your systems and networks are
contained on this live CD. The CD image itself was created using
Kadischi along with Fedora Core/Fedora Extras software packages.
sysdir=$1
csysdir=$2
kernel=$3
.
CHAPTER 7 Building a Basic Fedora Live CD 213
FIGURE 7-4 Create your own splash screen image for when
the live CD boots up.
NOTE
See Chapter 5 for information on creating splash screens and .msg files
(including how to enter control codes to change colors) that can be used
during the isolinux boot process.
.
.
cp $sysdir/boot/isolinux/initrd.img $csysdir/boot/isolinux/initrd.img
cp $sysdir/boot/vmlinuz-$kernel $csysdir/boot/isolinux/vmlinuz
cp /usr/lib/syslinux/isolinux.bin $csysdir/boot/isolinux/
cp /home/chris/mydata/boot.msg $csysdir/boot/isolinux/
cp /home/chris/mydata/about.msg $csysdir/boot/isolinux/
cp /home/chris/mydata/splash.lss $csysdir/boot/isolinux/
cp /home/chris/mydata/memtest $csysdir/boot/isolinux/
.
.
.
cat > $csysdir/boot/isolinux/isolinux.cfg <<_EOF_
default linux
prompt 1
display boot.msg
timeout 600
F1 boot.msg
F2 about.msg
F3 general.msg
F4 license.msg
214 Live Linux CDs
label linux
kernel vmlinuz
append initrd=initrd.img quiet $kernel_params 5
label debug
kernel vmlinuz
append initrd=initrd.img INITRD_DBG=x $kernel_params
label memtest86
kernel memtest
append -
_EOF_
To use a kickstart file to create a live CD with the kadischi command, you
need to create the kickstart file and then identify it with the --kickstart option.
Here is an example of a kadischi command with the minimal kickstart file I
copied to start with:
# cd /usr/share/kadischi/ks_examples
# cp minimal-livecd.cfg $HOME/mydata/
# cd
# kadischi ./FC6/ ./FC6-live.iso --kickstart=./mydata/minimal-livecd.cfg
The kadischi command shown here will run without your intervention. How-
ever, it will cause the Fedora Core installation screen to pop up as packages are
being installed. To keep the installation screens from appearing at all (for example,
if you are running from a text-only shell environment), add the -C option to the com-
mand line (along with the kickstart file), as shown in the following example:
# kadischi -C ./FC6/ ./FC6-live.iso --kickstart=./mydata/minimal-livecd.cfg
You can try out the minimal kickstart file yourself. With the previous command
line shown, a minimum Fedora Core installation is used to create the live CD (about
163MB total size after compression). The minimal-livecd.cfg file contains the fol-
lowing (note that a \ indicates a line that wraps because of our page size and should
actually appear on one line):
# Kickstart file automatically generated by anaconda.
install
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8 en_US en \
en_US.UTF-8 en_US en en_US.UTF-8 en_US en
keyboard us
#xconfig --card "RIVA TNT2" --videoram 4096 --hsync 31.5-37.9 \
--vsync 50-70 --resolution 800x600 --depth 16
#network --device eth0 --onboot no --bootproto dhcp \
--hostname fedora.livecd
#network --device sit0 --onboot no --bootproto dhcp \
--hostname fedora.livecd
rootpw --iscrypted $1$XM/k9ZA1$GMYPu/4Mr3PKKqcbneMeL.
firewall --enabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone Europe/Belgrade
bootloader --location=none
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
CHAPTER 7 Building a Basic Fedora Live CD 217
#clearpart --linux
%packages
# Packages to exclude for minimal package set
- atk
- bind
- bind-libs
- bind-utils
- bluez-libs
- bluez-pin
- bluez-utils
- caching-nameserver
- cairo
- cyrus-sasl-plain
- expat
- freeglut
- GConf2
- htmlview
- irda-utils
- libglade2
- libICE
- libIDL
- libSM
- libX11
- libXau
- libXcursor
- libXdmcp
- libXext
- libXfixes
- libXft
- libXi
- libXinerama
- libXmu
- libXrandr
- libXrender
- libXt
- libXxf86vm
- mesa-libGL
- mesa-libGLU
- NetworkManager
- numactl
- ORBit2
# End package set
%post
218 Live Linux CDs
Before you use the provided kickstart file, you should change at least the
rootpw line (to set your own encrypted password) and timezone (to set the time zone
in which the live CD is expected to run). Also, uncommenting and using a network
line saves you from having to deal with the network configuration screen. Those and
other kickstart options you might want to use are also described here:
install Indicates that the Fedora installation is a new install instead
of an upgrade.
lang Indicates the primary language to use during the installation
process.
langsupport Indicates the language to be installed on the live CD. If more
than one language is installed, a --default= option must be
set to indicate which language is used by default.
keyboard Sets the type of keyboard to be used.
xconfig If you are installing GNOME, KDE, or other X desktop soft-
ware, you can set specifics about your X server configura-
tion. If you don’t set xconfig, Fedora tries to probe for your
monitor and video card. If your display configuration is not
properly detected, you might need to set your X configuration
after you boot up using the system-config-display utility.
network You can set your network configuration so that your network
comes up when you boot your live CD. If a DHCP server is
available, you can use a line such as the following to have
your network come up automatically:
network --bootproto=dhcp –device=eth0
rootpw Using rootpw with iscrypted expects an encrypted MD5
password to be assigned to the root user. To create an
MD5 encrypted password to use on the rootpw line, type
the following:
# openssl passwd -1
Password: mygnucar
Verifying – Password: mygnucar
$1$oob1lgYQ$PhbOsJQjHyTYYRcxrEwKN0
Type the password you want to use (twice) as prompted. The
previous example shows the encrypted string resulting from
the password mygnucar. (Of course, you want to select your
own password and use the string that results.)
CHAPTER 7 Building a Basic Fedora Live CD 219
TIP
Excluding Docs
You can save some space on your live CD by excluding documentation that
comes with Fedora packages. An Everything install of Fedora Core results in
more than 200MB of documents, man pages, and info files in /usr/share/.
To exclude documentation from packages you install to your live CD,
%packages should appear as %packages --excludedocs.
%post You can add scripts you want to run after packages are
installed on separate lines following the %post directive. This
is a good place to do some initial configuration of your live
CD. For example, you could use useradd to add a user. Using
the encrypted created earlier for root, here are some com-
mands to add a user after the %post line:
%post
/usr/sbin/useradd chris
/usr/sbin/usermod -p '$1$oob1lgYQ$PhbOsJQjHyTYYRcxrEwKN0' chris
/usr/bin/chfn -f "Chris Jones" chris
In the example just shown, the user named chris is added to the live CD, with a
home directory /home/chris created by default. The usermod command then enters
the password for chris. Finally, the chfn -f command sets the user’s full name to
Chris Jones.
To find more information about these and other options you can set in your
kickstart file, refer to the kickstart-docs.txt file in the /usr/share/doc/
anaconda* directory. To get that file, you must have the anaconda RPM package
installed.
%packages
@ Basic X Window System
@ GNOME Desktop Environment
@ KDE (K Desktop Environment)
@ Editors
@ Engineering and Scientific
@ Graphical Internet
@ Text-based Internet
@ Office/Productivity
@ Sound and Video
@ Authoring and Publishing
@ Graphics
@ Games and Entertainment
@ Server Configuration Tools
@ Web Server
@ Mail Server
@ Windows File Server
@ DNS Name Server
@ FTP Server
@ PostgreSQL Database
@ MySQL Database
@ News Server
@ Network Servers
@ Legacy Network Server
@ Development Tools
@ X Software Development
@ GNOME Software Development
@ KDE Software Development
@ Compatibility Arch Development Support
@ Legacy Software Development
@ Java Development
@ Eclipse
@ Language Support
@ Administration Tools
222 Live Linux CDs
@ System Tools
@ Printing Support
@ Java
@ Compatibility Arch Support
@ x86 Compatibility Arch Support
%packages --resolvedeps
@ X Window System
cdrecord
rhythmbox
SUMMARY
Using Kadischi, you can create custom bootable CDs and DVDs of Fedora Core.
Kadischi works by accessing a Fedora Core software repository and installing the
software packages you select to a build directory on the local system. Kadischi then
modifies the contents of that directory so it can run from a CD. The result is an ISO
image that can be burned to a CD or DVD.
You have many opportunities to customize your Fedora live CD with Kadischi.
Because the anaconda installer runs as part of the kadischi process, you can
choose the packages that are installed, the keyboard and language used, your Eth-
ernet connection, and other basic anaconda features. You can also modify scripts
that come with Kadischi to change boot screens or modify the contents of your
Fedora live CD file system.
If you choose to use an optional kickstart file, you can automate much of the
process normally done by clicking through anaconda install screens. Using the
kickstart file, you can also add post-install scripts to run at the end of the live CD
build process.
CHAPTER 8
Tools for building live CDs are a natural extension of the Gentoo project. Although
prebuilt binaries are available for many Gentoo packages, many people are drawn
to Gentoo because it is geared toward those who like to select and build installed
Linux systems from scratch.
Although it is possible to build your own Gentoo live CD from scratch, the main
procedure in this chapter has you start with an existing stage2 tarball and builds
from there. After you have built a live CD with that procedure, the following section
describes how to use tools from the Catalyst project (the Gentoo release building
tool) much the same way as you would install Gentoo to hard disk. The difference is
that the result is an ISO image instead of an installed system on hard disk.
The procedures contained in this chapter are based on two different approaches
to creating a Gentoo live CD:
■ Remastering a Gentoo live CD—This procedure is, essentially, a remas-
tering of an existing Gentoo live CD. You install Gentoo to hard disk (to cre-
ate a working environment), copy live CD components (from a stage2 tarball)
to a directory on the hard disk, then add and remove software for that direc-
tory structure. That directory structure is then used to create the new ISO
image. (http://gentoo-wiki.com/HOWTO_build_a_LiveCD_from_scratch).
This is an unofficial process for creating Gentoo live CDs and is only capable
of building a live CD for AMD64 or x86 architectures.
■ Building a Gentoo live CD with Catalyst—Starts by using a stage tar-
ball to create a base image. You then install the packages you want to that
image and ultimately produce a custom live CD image. This procedure relies
on the recently enhanced Catalyst release building tool.
223
224 Live Linux CDs
If you choose to use Catalyst to create your Gentoo live CD, refer to the mailing
list and other resources associated with the Catalyst project that are described later
in this chapter. Because the project is still in early stages of development, it will
help to find out the latest versions that people have gotten working before you
get started.
INSTALLING GENTOO
The recently added Gentoo graphical installer is available from an official Gentoo
live CD. You can begin installing Gentoo to your hard disk by getting the Gentoo
live CD and booting it on the machine you want to use as your build machine.
For this procedure, I used the 2006.1 Gentoo live CD (livecd-i686-
installer-2006.1.iso), which is included with this book’s DVD. You can find
Gentoo download locations by selecting Get Gentoo from the Gentoo.org site. I got
the live CD I used from http://gentoo.osuosl.org/releases/x86/2006.1/livecd. You
can burn the ISO image to CD, as described in Appendix A, “On the DVD,” or sim-
ply boot Gentoo directly from the DVD.
The quickest way to install is to use the kernel and packages contained on the
live CD. This will get you up and running quickly. However, I had some trouble
with the kernel that came with the live CD, so I chose to download and recompile
the gentoo-sources for the kernel and it seemed to work better for my situation
(although it took about an hour longer to run).
NOTE
Refer to the Gentoo Linux Installation Guide (select the appropriate docu-
ment from www.gentoo.org/doc/en). It will help you understand some of
the issues presented to you during the install process.
2. Start Installer—From the desktop, open the Gentoo Linux Installer icon.
The Gentoo Linux Installer screen appears.
3. Read the Welcome screen and select Networkless, then Forward. The
Pre-install Config screen appears. You should not need to change anything
here. Select Forward and the Partitioning screen appears.
4. Partition disk—Select the hard drive you want to install on (if you have
more than one drive) in the Devices box. Then do either of these:
■ Click the gray part of the bar representing unallocated space on that disk.
Then add the partitions you want.
■ Select Recommended Layout to have Gentoo create a recommended layout
from your unallocated space for you to install Gentoo. The recommended
layout requires at least 4GB of unpartitioned space.
The Gentoo installer recommends a small boot partition (about 100MB), a
swap area (two times the system RAM, up to 2GB), and a root partition (/)
that consumes the rest of the free space. You can change these items as you
choose. If not enough space exists on your hard disk, you can delete one or
more partitions (just make sure that you are not deleting anything that con-
tains information you want to keep). Select Forward when you are done. The
Network Mounts screen appears.
5. Connect NFS share—Because this is a networkless installation, the
options will be grayed out on this screen. Select Forward to continue to the
Stage screen.
6. Choose install type—Because this is a networkless installation, the
defaults for a binary install are chosen and the other options are grayed out.
Select Forward; the Portage tree screen appears.
7. Portage tree— Choosing a networkless install automatically selects using
portage from a snapshot, with the snapshot on the CD itself chosen automati-
cally. Select Forward. The make.conf screen appears.
8. Modify settings—This screen lets you enable distcc or ccache for subse-
quent builds, as well as to set your MAKEOPTS. Other options are grayed
out because this is a binary installation. Click Forward to continue. The Ker-
nel screen appears.
9. Choose kernel— The livecd-kernel option is already selected to use as
the kernel for the installed Gentoo system. Select Forward to continue to the
bootloader screen.
10. Choose bootloader— The Grub bootloader is automatically chosen for
you. Select to have it installed on the master boot record (MBR) for the hard
228 Live Linux CDs
disk set to boot on your machine. If you have multiple operating systems
installed on your computer, you might choose to not install the master boot
record on your first hard disk and manually set it to boot your Gentoo install.
Click Forward to continue to the Time Zone screen.
11. Set time zone—Select the time zone you reside in from the map or list
below the map. Click Forward to continue to the Networking screen.
12. Set up network—If you plan to use a DHCP connection for your network
interface, select your network interface (such as eth0) from the Interface box,
choose DHCP, and then click Save. (Or select Static from the Configuration
box and add your address information manually.) This configures the network
for your installed system. Click Forward to continue to the Daemons page.
13. Choose cron and logger—Select the Cron and System Logger daemons to
use (the defaults are fine in most cases). For a networkless install, you can
choose vixie-cron as your cron daemon, or none, if you wish not to use cron.
Click Forward to go to the Extra Packages screen.
14. Select packages—Because the intent now is to get the major components of
your Gentoo install working, select the packages from the list shown that you
want on your system. Only packages marked GRP are available, because pre-
built binaries are available for those packages. You can always add more
packages when the initial install is done. Click Forward to go to the Startup
Services screen.
15. Turn on services—Select to have those services that you want to start up at
boot time. Select to turn on only services for those packages that you
installed on the previous screen. Select Forward to continue to the Other Set-
tings screen.
16. Select settings—Choose settings associated with the display manager,
keymaps, and other features that interest you. Select Forward to continue to
the Users screen.
17. Set root password—Add a root password (twice and click Verify to check
it) and select Add User to add a regular user account to your Gentoo system.
Click Forward to continue to the Review screen.
18. Review options (last chance!)—This is your last chance to back out
before making any changes to your computer’s hard disk. Review the list of
current install options and click Save if you want to save these settings for
another install. If everything looks okay, click Install to begin reformatting
your hard disk and installing Gentoo. Depending on which options you
selected during the installation setup procedure, the process of building and
installing Gentoo can take quite a while.
CHAPTER 8 Building a Basic Gentoo Live CD 229
19. Close installer—When you see the “Install Complete!” message, you can
close the installer window.
20. Log out and reboot—Select to log out. Then from the login screen, select
System and reboot the computer to have the Gentoo you installed to your
hard disk booted. (Be sure to remove the Gentoo CD after it shuts down and
before Gentoo comes up again from hard disk.)
* app-office/abiword
Latest version available: 2.2.11
Latest version installed: [ Not Installed ]
Size of downloaded files: 23,390 kB
Homepage: http://www.abisource.com
Description: Fully featured yet light and fast cross platform
word processor
License: GPL-2
230 Live Linux CDs
From the output just shown, you can see that abiword is a word processor under
the app-office category. Before you install the package, you can see its size, the
license that covers it, and a brief description. If you want to install it, you can do
that with the following emerge command:
# emerge abiword
I personally like the vim text editor, so emerge vim is one of the first things I do
after installing Gentoo. You should install whatever tools you are used to having on
your Linux system.
NOTE
Although the procedure below can be done entirely from the shell, you may
be more comfortable working from a desktop GUI. If you didn’t install a
display manager, you may have booted to a plain login prompt. To start a
GUI after to login, type startx.
wget commands (each should be typed on one line) that get the stage2-x86-
2006.1.tar.bz2 and portage-latest.tar.bz2.
# cd ~
# wget
ftp://ftp.ussg.iu.edu/pub/linux/gentoo/releases/x86/current/stages/
stage2-x86-2006.1.tar.bz2
# wget ftp://ftp.ussg.iu.edu/pub/linux/gentoo/snapshots/
portage-latest.tar.bz2
4. Unpack the tarball and Portage tree—Change to the livecd/source
directory and unpack the stage2 tarball:
# cd ~/livecd/source
# tar jxvpf ~/stage2-x86-2006.0.tar.bz2
# mkdir newroot
# cd ~/livecd/source/usr
# tar jxvf ~/portage-latest.tar.bz2
5. Mount directories and devices—Because you have probably already
downloaded many useful packages for your installed Gentoo system, you can
take advantage of those packages for your live CD by mounting the
/usr/portage/distfiles directory on the directory structure you’re building.
Also, before you chroot to the build directory structure, you need to mount a
few special file systems. The last command in this group copies the
resolv.conf file so you can connect with DNS servers to use the Internet
from your chroot environment.
# cd ~/livecd/source
# mkdir usr/portage/distfiles
# mount -o bind /usr/portage/distfiles usr/portage/distfiles
# mkdir -p proc dev
# mount -o bind /proc proc
# mount -o bind /sys sys
# mount -o bind /dev dev
# cp /etc/resolv.conf etc/resolv.conf
With the build directory now in place, you are ready to chroot to that directory
and begin installing packages and configuring your live CD.
NOTE
If you are working from a Gentoo desktop with several Terminal windows
open, you want to be sure to run commands intended for the chroot envi-
ronment from the Terminal window where you just ran the chroot
command. To ensure that I’m using the right Terminal window, I change
the Terminal Windows title bar to LiveCD. To change the title for gnome-
terminal, select TerminalqSet Title and type the name you want to use.
environment you use to install the packages used on your live CD.
Variables you set here override settings in make.globals (except for USE,
CONFIG_PROTECT*, and ACCEPT_KEYWORDS variables, which are added to
existing variable values). For details on what make.conf can contain, type
man make.conf or see the /etc/make.conf.example file.
This is where some knowledge of the Gentoo Portage system can be very use-
ful. The variables you set in the make.conf file have a profound effect on both
the time it takes to install software and the size of the CD image you end up
with. The following is an example of a make.conf file for creating a Gentoo
live CD:
CHAPTER 8 Building a Basic Gentoo Live CD 233
NOTE
You can use the minimal flag to run a minimal build that disables many
nonessential features. If you add the minimal USE flag, you need to put in
an exemption for the perl package. To do that, before changing to the
chroot environment, type the following:
# emerge -e system
# emerge -e world
# passwd root
New UNIX Password: ********
Retype new UNIX password: ********
The system package class consists of packages needed for your system to run
properly. The world package class contains system packages plus packages
contained in /var/lib/portage/world.
If during the emerge process the C compiler was upgraded (gcc package), you
need to instruct your system to use the new C compiler and then run emerge
again to update your whole system. Upgrading GCC is described in the GCC
Upgrade Guide (www.gentoo.org/doc/en/gcc-upgrading.xml).
5. Change some /etc configuration files—You should change a few features
manually in configuration files. (Note that at this point, nano may be the only
text editor available. You might choose to install vim or emacs to use instead,
when a text editor is called for.)
First, set your time zone. Replace area/city with information that is appropri-
ate to where you are. For example, to set the time zone to America/Chicago,
type the following:
# ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
Another suggested configuration file change is to enable the use of dmraid.
Type the following:
# echo "sys-fs/dmraid ~x86" >> /etc/portage/package.keywords
Using any text editor, edit the /etc/fstab file so that it includes only the fol-
lowing information (be sure to add a blank line at the end of the file):
CHAPTER 8 Building a Basic Gentoo Live CD 235
title=LiveCD
root (cd)
kernel /boot/vmlinuz vga=788 root=/dev/ram0 \
init=/linuxrc looptype=squashfs loop=/livecd.squashfs \
cdroot
initrd /boot/initrd
title=Memtest86+
root (cd)
kernel /boot/memtest86plus/memtest.bin
Note that the backslashes (\) are there only to indicate that the kernel line
(shown as three lines) should actually be only on one line. Be sure to join the
three lines together and remove the two backslashes.
As with other live CDs described in this book, you have the opportunity to
modify the boot loader to customize how your live CD boots. In the menu.lst
CHAPTER 8 Building a Basic Gentoo Live CD 237
NOTE
If you prefer to use the isolinux bootloader instead of GRUB, you can cre-
ate an isolinux directory in the target/ directory. Then edit the
isolinux/isolinux.cfg file to work with your configuration. In Gentoo,
isolinux components are in the syslinux package (emerge syslinux).
When you run mkisofs later, be sure to identify the location of the compo-
nents in the isolinux directory so that isolinux is used as the bootloader.
Next, you can unmount the items you mounted earlier. To do that, type the
following:
# cd /root/livecd/source
# umount sys proc dev usr/portage/distfiles
Because you have already spent a lot of time creating the files system for
your live CD, if you have disk space, consider making a copy of your
chrooted file system before you begin cleaning up. Open a terminal window
outside of the chroot environment and type the following:
# cd /root/livecd
# cp -ar source/ backup
With your backup copy in place, begin removing unnecessary files from
your live CD. Here are some ways to remove files that you don’t want on
your live CD:
# cd /root/livecd/source/usr/src/linux; make clean
# cd /root/livecd/source
# find .-type f -name ".keep" -print -exec rm {} \;
# rm -rf var/tmp/*
# rm -rf var/run/*
# rm -rf var/lock/*
# rm -rf var/cache/*
# rm -rf var/db/*
# rm -rf tmp/*
# rm -rf etc/mtab
# touch etc/mtab
# rm -rf var/log
# mkdir var/log
# rm root/.bash_history
NOTE
Be very careful when you run the following commands to take note of when
leading slashes are and are not used. For example, if you mistakenly put a
slash (/) before the directory name in rm -rf tmp/* below, you will remove
everything from /tmp on your installed Gentoo system and not on the live
CD you are building.
Other files you can consider removing include the Portage tree and docu-
mentation. For example, here are a few directories you could delete to further
save space:
# rm -rf usr/portage/*
# rm -rf etc/portage/*
# rm -rf usr/share/doc/*
# rm -rf usr/src/*
CHAPTER 8 Building a Basic Gentoo Live CD 239
The next step is to convert the file system into a single squashfs archive. To do
that, type the following:
# mksquashfs source/ /root/livecd/target/livecd.squashfs
# touch /root/livecd/target/livecd
# cd /root/livecd/target
# rm -rf files/
After the previous set of commands, you should now have a /root/livecd/
target directory that contains a /boot directory (that includes the kernel and files
needed to boot your computer) and the livecd.squashfs file (that represents a com-
pressed image of your live CD’s file system). If you want anything else to go into the
root of your live CD (such as a license file or a README file), you can place that in
the target directory as well.
The last step in creating the ISO image is to run the mkisofs command. Here is
an example:
# cd /root/livecd/target
# mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
-boot-load-size 4 -boot-info-table -hide-rr-moved \
-c boot.catalog -o /root/livecd.iso /root/livecd/target/
The result of the command just shown is a live CD image called livecd.iso in
the /root directory. This ISO image is ready to be tested.
The emerge command installs the qemu software. The qemu command shown
boots the livecd.iso image, telling the command that it is a CD-ROM image
(-cdrom), that qemu is booting from a CD image (-boot d), and to use 512MB
of virtual memory to run the booted image (-m 512).
■ Burn to media—You can, of course, burn the ISO image to a CD or DVD.
Because you will probably redo your CD image a few times, rewriteable
media will probably save you money. To do a quick erase and burn, you can
use the following commands:
# cdrecord -v gracetime=2 dev=/dev/cdrom -tao blank=fast
# cdrecord -v /root/livecd.iso
Many other options exist for cdrecord (try man cdrecord). For example, to do
a more thorough erase of your CD, use blank=all instead of blank=fast.
After the CD is burned, insert it into the CD drive of an available computer
and reboot.
If everything on your CD worked perfectly, you are done. If there are problems,
assuming that you kept your source directory, you can go back and make correc-
tions. To make corrections to your CD image, return to the step where you mounted
the sys, proc, and other directories in your source directory. Then run the chroot
command again and continue forward with the procedure from there to make any
changes you desire.
NOTE
Using Catalyst to produce live CDs is not intended for casual users. The
information in this section is our attempt to steer more advanced users
toward the recommended way of producing Gentoo live CDs.
With Catalyst, you can create your own group of settings and packages in what
are referred to as spec files. With those spec files, you execute the commands that
are used to make the live CD. You can find more information on Catalyst here:
CHAPTER 8 Building a Basic Gentoo Live CD 241
■ Catalyst project page—For links to the Catalyst FAQ and Reference Man-
ual, refer to the Catalyst project page (www.gentoo.org/proj/en/releng/cata-
lyst). The documentation on the most recent version of Catalyst was not yet
complete at the time of this writing. However, if descriptions of the catalyst
command are still available, they will better reflect the current state of how
Catalyst is used than do descriptions of the older catalyst command from
catalyst 1.1.
■ Catalyst mailing list—The Catalyst mailing list is probably the best place
to ask questions about building Gentoo live CDs. Subscribe to the list by
sending an e-mail from your e-mail address to gentoo-
catalyst+subscribe@gentoo.org (to receive and post to the list) or gentoo-
catalyst+subscribe-digest@gentoo.org (to send a digest of messages every
few days).
■ Catalyst documentation—For information about the catalyst command
itself, type man catalyst or catalyst —help. Sample spec files to use for
creating live CD stage tarballs are available by installing the livecd-specs
and livecd-kconfigs packages. The former contains spec files for building
official Gentoo live CDs, while the later contains files for configuring live CD
kernels for different computer architectures. Review spec files in the
/usr/share/doc/catalyst-2.0*/examples/ directory to learn about the set-
ting you can choose to create your live CD.
Building Gentoo live CDs is done in stages. The livecd-stage1 target is where
you gather and compile all the software packages you want to include on your live
CD to form an archive for use in livecd-stage2. In livecd-stage2, you customize
the basic livecd-stage1 archive you built to include such things as custom splash
screens, create or remove configuration files, and select which system services to
start automatically.
Although, strictly speaking, you don’t need the livecd-specs and livecd-
kconfigs packages, they are useful to refer to later. The packages contain the spec
files that the Gentoo development team used to create the official Gentoo live CDs,
and have recently been updated for the 2006.1 release.
The following list describes variables you can set in the catalyst.conf file.
■ distdir—Use the default distdir in most cases (/usr/portage/distfiles).
This directory contains all the files that were fetched when you install
packages.
■ options—By adding pkgcache and kerncache to the options line, you can
set Catalyst to save all built packages and your built kernel, respectively.
The seedcache and snapcache do caching for those features. These options
are useful because they save time by not having to rebuild components that
don’t change each time you rebuild your stage files. The autoresume option
enables you to save points at which you want to restart a build.
■ sharedir—Indicates the location of Catalyst runtime executables. The
default /usr/lib/catalyst directory is used in most cases.
■ storedir—Indicates the location where stored temporary and cache files are
stored. The default is /var/tmp/catalyst.
■ envscript—If you need to set any options or environment variables to use
when you build live CDs, set the location of a script containing those items
with the envscript variable. By default, envscript is commented out.
CHAPTER 8 Building a Basic Gentoo Live CD 243
This file contains a lot of comments to understand how you can modify the file.
Here is an example of how you might configure the spec file. You can find more
details on variables used in this file, and in Catalyst itself, in the Catalyst Refer-
ence Manual (www.gentoo.org/proj/en/releng/catalyst, then select the link to that
manual).
subarch: i686
version_stamp: 2006.1
target: livecd-stage1
rel_type: default
profile: default-linux/x86/2006.1
snapshot: 20060906
source_subpath: default/stage3-i686-2006.1
livecd/use:
-*
alsa
socks5
nptl
nptlonly
livecd
dbus
gnome
gtk
-kde
-qt3
-qt4
fbcon
ncurses
readline
livecd/packages:
app-admin/ide-smart
app-admin/logrotate
app-admin/passook
app-admin/pwgen
app-admin/sudo
app-admin/syslog-ng
app-arch/mt-st
app-arch/unrar
app-arch/unzip
app-editors/gedit
app-editors/nano
app-misc/livecd-tools
.
.
.
x11-base/xorg-x11
x11-drivers/synaptics
gnome-base/gdm
gnome-base/gnome-light
CHAPTER 8 Building a Basic Gentoo Live CD 245
gnome-base/gnome-vfs
gnome-base/gnome-volume-manager
gnome-base/gnome-applets
The subarch value sets the computer architecture for the livecd-stage1 tar-
ball. The i686 architecture works well with most computers built in the past few
years. If you need the live CD to work with older computers, however, the x86 archi-
tecture will work with everything from an i386 to Pentium 4 and Athlon XP proces-
sor architectures. So x86 is best to use for a live CD that should work across that
range of processors. Subarchitectures for x86 include i386, i486, i586, i686,
pentium-mmx, athlon, athlon-xp, athlon-mp, pentium3, and pentium4.
The version_stamp is set to a string of characters to identify the CD. In this
example, the version_stamp is set to 2006.1 because the CD is using Gentoo
2006.1 as a base. The target variable indicates what is being built from this spec
file (in this case, a livecd-stage1 archive). Use default as the rel_type variable in
most cases (you can use a different build profile if you like).
The profile variable defines the location of the Portage profile that catalyst
will use. In this case, you will use the 2006.1 file (located in /usr/portage/
profiles/default-linux/x86) in the next step. This file contains information about
the architecture and build options (same as /etc/make.conf). The snapshot is the
name given to the Portage snapshot used to build the livecd-stage1 archive.
The value for snapshot must match a portion of the name of the portage snap-
shot you will download in a coming step. For example, for the snapshot portage-
20060906.tar.bz2, I entered 20060906 (you will probably get one with a later date).
The source_subpath indicates the location of the stage3 tarball you will download
in a coming step. For example, the value of default/stage3-i686-2006.1 indicates
that the stage3 tarball is named stage3-i686-2006.tar.bz2 and is located in the
/var/tmp/catalyst/builds/default directory.
Keywords under livecd/use represent USE variables that are used to build the
live CD environment. Packages under livecd/packages indicate which packages
will be added to the live CD.
NOTE
Don’t include the genkernel package to livecd/packages. That would
cause livecd-stage1 catalyst to fail.
A couple of the pieces that this spec file points to need to be created or otherwise
obtained: a portage snapshot tarball and a stage3 tarball. If you don’t want to create
246 Live Linux CDs
your own portage snapshot tarball, there are snapshots available from http://mirrors.
tds.net/gentoo/snapshots or you can use the snapshot used by Gentoo’s Release
Engineering to build the 2006.1 release from http://mirrors.tds.net/gentoo/releases/
snapshots/2006.1. I downloaded one as follows:
# mkdir -p /var/tmp/catalyst/snapshots
# cd /var/tmp/catalyst/snapshots
# wget -c http://mirrors.tds.net/gentoo/snapshots/portage-20060906.tar.bz2
You might wonder why you need a stage3 tarball when you are creating a
livecd-stage1 archive. The reason is that the stage3 tarball is used to create the
chroot environment that is used to create the livecd-stage1 archive. With this
arrangement, you can select a stage3 tarball that is compatible with the livecd-
stage1 archive you create. In this way, the stage3 tarball isolates the livecd-
stage1 archive from the local system.
To download the stage3 tarball, you access any official Gentoo mirror and
download the tarball to your builds directory. Mirror sites are listed here: www.gen-
too.org/main/en/mirrors.xml. Then, for example, to download a stage3 tarball from
a gentoo mirror site, you could type the following:
# mkdir -p /var/tmp/catalyst/builds/default
# cd /var/tmp/catalyst/builds/default
# wget -c \
http:/mirrors.tds.net/gentoo/releases/x86/2006.1/stages/stage3-i686-
2006.1.tar.bz2
The wget command line shown should actually be on one line. The point, how-
ever, is that you need to get a stage3 tarball from a Gentoo site and place it in the
/var/tmp/catalyst/builds/default directory.
With everything in place, the next step is to build the livecd-stage1 archive.
Here’s what to type:
# cd /root/gentooCD
# catalyst -f livecd-stage1_template.spec
Depending on how many packages you have selected to use, this could take
several hours to complete. You can use the resulting livecd-stage1 archiveto build
a livecd-stage2 archive and your live CD.
# cd $HOME/gentooCD
# cp /usr/share/doc/catalyst-2*/examples/livecd-stage2_template.spec .
Before you begin editing the livecd-stage2spec file, you need to get a kernel-
configuration file. I copied one of the kernel-configuration files from the livecd-
kconfigs package to start from. Then I edited it to contain the kernel drivers and
modules I wanted.
# mkdir /root/gentooCD/kconfig
# cd /usr/share/livecd-kconfigs-2006.1/x86
# cp livecd-2.6.17.config /root/gentooCD/kconfig/
Next I edited the livecd-stage2 spec file to contain the setting needed to build
my live CD. The following is an example of an edited livecd-
stage2_template.spec file, used to create a livecd-stage2 archive from the
livecd-stage1 archive created earlier. Although the livecd-stage2 spec file shown
here works, it might not include every feature you want to add to your Gentoo live
CD. I recommend that you step through the comments included in the livecd-
stage2_template.spec file to see other options that you might want to use.
subarch: x86
version_stamp: 2006.1
target: livecd-stage2
rel_type: default
profile: default-linux/x86/2006.1
snapshot: 20060906
source_subpath: default/stage1-x86-2006.1
livecd/cdtar: /usr/lib/catalyst/livecd/cdtar/isolinux-3.09-
memtest86+-cdtar.tar.bz2
livecd/fstype: squashfs
livecd/iso: /root/mylivecd-x86-2006.1.iso
livecd/type: generic-livecd
livecd/splash_type: gensplash
livecd/splash_theme: livecd-2006.1
boot/kernel: gentoo
boot/kernel/gentoo/sources: gentoo-sources
boot/kernel/gentoo/config: /root/gentooCD/kcnofig/2.6.12-smp.config
livecd/unmerge:
acl
addpatches
attr
autoconf
automake
.
.
.
livecd/empty:
/etc/bootsplash/gentoo
/etc/bootsplash/gentoo-highquality
248 Live Linux CDs
/etc/cron.daily
/etc/cron.hourly
.
.
.
livecd/rm:
/boot/System*
/boot/initr*
/boot/kernel*
/etc/*-
/etc/*.old
.
.
.
Notice that many of the values identifying architecture and the locations of files
and directories are the same as they were in the livecd-stage1 spec file. Interest-
ing new options include the livecd/fstype, which identifies squashfs as the file
system type used to hold and compress most of the live CD’s file system.
The livecd/iso value identifies where the resulting ISO image is ultimately
placed. In this example, the final ISO image will be created automatically and
named mylivecd-x86-2006.1.iso. The livecd/type is set to generic-livecd (it’s
important to get this type right).
You have the opportunity to set the splash screen type you want and the theme
associated with that splash screen. As the livecd/splash_type, I chose gensplash.
For the livecd/splash_theme, I used livecd-2006.1.
The next entries in the livecd-stage2 spec file determine the kernel that will
be built for your live CD. For boot/kernel, I chose gentoo as the kernel and chose
boot/kernel/gentoo/sources to be gentoo-sources. Then I indicated the location
of the kernel-configuration file (boot/kernel/gentoo/config) to be the location of
the configuration file I recently copied and edited (/root/gentooCD/kconfig/
livecd-2.6.17.config).
The last entries shown in this sample file have to do with cleaning up the file
system when you are done adding everything there is to add. Items listed under
livecd/unmerge represent packages that will be unmerged after all kernels are
built. With livecd/empty, you can indicate which directories should be emptied of
all contents. After livecd/rm is a list of files that should be removed.
In particular, software packages and files that were used to build the live CD
or that were left behind during the process of creating the live CD can be
removed. I recommend checking the /usr/share/livecd-specs-*/x86 directory to
see what software packages, files, and directories get removed from the official
Gentoo live CDs.
CHAPTER 8 Building a Basic Gentoo Live CD 249
When you feel satisfied that your livecd-stage2 spec file is correct, run the
catalyst command with that spec file as follows:
# cd /root/gentooCD
# catalyst -f livecd-stage2_template.spec
When the catalyst command finishes running, it creates the live CD, based on
the contents of the livecd/iso entry (/root/mylivecd-x86-2006.1.iso, in my
example). You can then test (with tools such as qemu or VMWare) and burn (with tools
such as cdrecord or k3b) that live CD as described in Appendix B, “Building, Test-
ing, and Burning ISOs.”
You almost certainly won’t get a clean build the first time you try this proce-
dure. If catalyst fails as it is building, look for the last error message and try to cor-
rect the problem. You might receive suggestions from the error message to change a
use flag or a notice that some component is missing. If you are not able to overcome
the issue yourself, you can look for help on the gentoo-catalyst mailing list, as men-
tioned earlier. Read a few posts first and try to ask specific questions. Archives are
available at http://archives.gentoo.org/gentoo-catalyst.
SUMMARY
Gentoo is one of the more challenging Linux systems for building a live Linux CD.
The procedure in this chapter for producing a Gentoo live CD has you set up a
chroot environment for your live CD directory structure. Once in that chroot envi-
ronment, you can use emerge to add or remove any software packages as you please
for your live CD.
To save space for your live CD, the directory structure is compressed by
converting it to a squashfs file system. Although isolinux can be used as the
boot loader, this procedure describes how to use GRUB to achieve the same
results.
Active development efforts for producing live CDs are mostly associated with
the Catalyst project. Using Catalyst and spec files, you can produce highly cus-
tomized live CDs. Development of Catalyst for producing live CDs has been pro-
gressing for a few years. However, you should closely follow the Catalyst mailing
list and other resources to find out the latest components you should be using to
build live Gentoo CDs with Catalyst.
This page intentionally left blank
LIVE LINUX CDS
Part III
Making a Specialized
Bootable Linux
251
This page intentionally left blank
CHAPTER 9
Security and system-rescue activities are among the best uses of a live Linux CD.
On one read-only medium, you can gather a range of tools to fix a broken operating
system, scan file systems for intruders, watch traffic on the network, and do hun-
dreds of other activities to check and protect your computing environment.
Putting together your own security live CD offers a means of having all the tools
you need at your fingertips in a way that you can apply to any PC you can reboot.
You have fewer worries when you go to fix a broken system because you can start
with a clean, freshly booted operating system each time. In this way, less chance
exists that the tools you would use to fix a system are themselves broken or infected.
Creating a custom security live CD also can mean adding tools that might not
be on other security live CDs. For example, some software is licensed in a way that
you can use it for personal use but might not be available for someone to redistrib-
ute. Examples of such things are proprietary drivers or utilities that come with a
hardware peripheral. So these features that they can’t legally put on a widely dis-
tributed Linux live CD might legally go on the one you carry around with you to use
when it’s needed.
This chapter covers some of the features that have been put into live Linux CDs
that are used for security and rescue purposes. It also describes additional compo-
nents you might want to add to your own custom live Linux security CD. For demon-
stration purposes, the chapter focuses on the BackTrack live CD.
253
254 Live Linux CDs
NOTE
BackTrack, like other Slax-based live CDs, includes many of the boot files
provided from the Linux Live CD/USB Scripts site (www.linux-live.org).
Refer to that site to learn more about how the scripts, kernels, and other
components from linux-live.org can be used to produce live CDs from an
installed Linux system.
Figure 9-1 illustrates the features that BackTrack pulls into its arsenal of secu-
rity tools. Because BackTrack was created from a combination of tools from two
other popular security-centric live Linux distributions (Auditor and Whax), you can
get a good sense of the tools you would want to have on your own security live CD.
If you are using BackTrack, open the BackTrack menu (lower-left corner of the
screen) to select security tools to try out. In Figure 9-1, the applications displayed
include the Autopsy Forensic Browser, the Automated Image and Restore (AIR)
tool for creating and restoring disk images, and the AutoScan utility for exploring
your network.
CHAPTER 9 Customizing a Security Live Linux CD 255
FIGURE 9-1 Size up systems, hunt down exploits, and explore networks with
BackTrack.
Because security live CDs are not generally meant to be used for gaming or
other high-end graphics applications, a lot of disk space can be saved by including
a simple window manager (or no window manager at all). Because it is lightweight
but carries enough features to launch many useful X applications, the Fluxbox win-
dow manager is available on many of the smaller security live CDs (50MB to
180MB). BackTrack includes Fluxbox for users who want to use it; the KDE inter-
face is used with BackTrack by default.
To understand the foundation on which this security tool chest is built, however,
the next sections step you through the boot process and basic setup used to support
the security tools.
The isolinux.cfg file is stored in the root (/) of the live CD, to direct the boot
process. Three labels exist: slax, linux, and memtest. The memtest label simply
runs the memtest command to check your RAM. The default slax label is the same
as the linux label, except that the slax label sets the default vga mode to
1024×768, 16 colors (vga=0x317, the hexadecimal equivalent of 791). The following
options, that can be used from the boot prompt (using either linux or slax labels)
are described on the message screen by pressing F1:
You can pass other boot options to BackTrack from the boot prompt, including
nocd, nohd, and nodma.
You can set the probeusb parameter to find USB devices earlier in the process
than it would normally do so. You can also set the specific amount of RAM you want
to allow BackTrack to use when it mounts the root (/) directory by setting the ram-
size= parameter (in bytes). By default, 60 percent of your available RAM is used
for the tmpfs file system that will eventually hold the live CD’s root file system.
Boot Components
These bootloader components are used during the default boot process for BackTrack:
the kernel can direct the linuxrc file (located at the root of this file system)
to continue the boot process.
■ With the file system completely set up, linuxrc changes to the root of the
newly formed directory structure (pivot_root). Then it runs /sbin/init to
start the next phase of the boot process.
For more ideas on configuring Isolinux to have your live CD boot as you would
like, refer to Chapter 5.
start up network interfaces. In the case of BackTrack, the network interfaces are not
started automatically. Here are some of the highlights of what occurs after the init
process sets other processes in motion to start up system services:
■ rc.S script—The /etc/rc.d/rc.S script is run every time the live CD is
started (regardless of the init state). This script mounts and checks any file
systems listed in /etc/fstab, turns on swap, starts udev (to manage remov-
able devices), and configures plug-and-play devices.
■ rc.M script—The /etc/rc.d/rc.M script runs when the live CD boots up to
any multiuser run level (2, 3, 4, or 5). It does some logging (sending dmesg
output to /var/log/dmesg and running the syslogd system log daemon). This
script also runs the rc.slax script, which responds to several options that
might have been added at the boot prompt. For example, the noguest option
disables the guest user account and passwd causes the script to prompt the
user for a new root password. For the autoexec option, the script runs the
command given (for example, autoexec="date") and then reboots.
■ System V init scripts—One of the last things the rc.S script does is run
the /etc/rc.d/rc.sysvinit script to start any System V init scripts that are
set to run at the current run level. For example, in run level 3, the script
starts any scripts beginning with the letter S in /etc/rc.d/rc3.d directory.
■ MySLAX scripts—The only script currently in the /etc/rc.d/rc3.d direc-
tory is the SInstall script. If you added any MySLAX Modulator scripts to
this directory (with names that begin with Install_*), they would be exe-
cuted to install the software it contained. Information on adding MySLAX
software is described later in this chapter.
If you had watched as the messages were displayed, the process just described
took place between the message beginning with "INIT:" and the login prompt.
After the boot process completes, the user sees the login prompt and some
information on the screen. That information includes the root password and ways to
start the GUI and the network.
Logging In
With BackTrack, you are expected to log in as the root user from a text-based login
prompt. No other user account is available as a login account.
BackTrack comes with a root password already assigned. That password
appears on the screen when you first boot up. Although this might seem like a secu-
rity concern, remember that there is no network interface at this point, so you
can run the passwd command to change the root password before starting up net-
work interfaces and allowing any remote login services to the machine. You could
also type passwd as a boot option to be prompted for a root password during the
boot process.
Although other active user accounts exist, none is enabled for you to log into.
Knoppix boots up to a desktop owned by the knoppix user (who can request root
privilege without a password), but you need to add a new user to operate the live CD
as a nonroot user (running adduser username steps you through the process).
As noted earlier, the login prompt is text-based and is preceded by instructions
(the contents of /etc/issue are listed). Those instructions include the root pass-
word and commands for configuring the desktop (xconf), starting the desktop
(startx), starting a simpler desktop (gui), and getting an IP address using DHCP
(dhcpcd). Figure 9-2 shows the login screen just described.
Ways of configuring the login process include the following:
■ Change the text shown before the login prompt by editing the /etc/issue file.
■ Set up other user accounts so you don’t have to log in as root.
■ Configure the user environment. You can modify user environment variables
by editing the /etc/profile file.
■ Configure the user home directory. The /root directory is populated with
configuration files that are set up in advance in the /etc/skel directory. You
can add or change configuration files from there.
If the user can successfully log in as a root user, the next areas to look at are
those that set up the desktop environment and features for configuring necessary
peripherals (network interfaces, printers, sound cards, and so on).
CHAPTER 9 Customizing a Security Live Linux CD 261
FIGURE 9-2 The text-based login screen includes information from the
/etc/issue file.
NOTE
One variable set in /etc/profile that you might look at is the PATH variable.
BackTrack added a dot (.) to the PATH. This allows commands to be run
from the current directory (an activity that typically needs to be asked for
explicitly, by typing something such as ./command). BackTrack needs this
feature as part of the way it lets you run commands from the BackTrack
menu. It basically opens a terminal window with the shell open to the direc-
tory containing the command. It expects you to be able to run the com-
mand from there.
Backtrack Menu
The BackTrack submenu on the KDE menu is the most obvious enhancement
BackTrack includes. This is where BackTrack gathers hundreds of security tools
that are available from the live CD. The tools are divided into 15 categories. Figure
9-3 shows the BackTrack menu displayed from the KDE menu and from the Kon-
queror window.
Alongside the BackTrack menu in Figure 9-3 is the KDE Menu Editor. By
opening the BackTrack menu in the KDE Menu Editor, you can see details about
each menu item. For each application, you can see details about how it is run. You
can open the KDE Menu Editor to work with the BackTrack menu by right-clicking
the K Menu button and selecting Menu Editor.
CHAPTER 9 Customizing a Security Live Linux CD 263
FIGURE 9-3 Security tools on the BackTrack menu are divided into 15 categories.
Because many of the security tools available are commands rather than graphi-
cal utilities, BackTrack takes an interesting approach to making those tools avail-
able from the desktop. Selecting a menu item that represents a command opens a
shell that displays the help message associated with that command. In some cases,
the current directory for that shell holds the command and any support files needed
by that command. Because the default PATH enables you to run commands from the
current directory, you can simply run the command (with the options you want) or
refer to the files in that directory for further information.
KDE Settings
Because KDE is the default desktop for BackTrack, you can take advantage of the
available tools for configuring the KDE desktop. Most the graphical administrative
tools for KDE are available from the Settings and System menus on the KDE menu.
To tailor the look and feel of the desktop, refer to Chapter 2. The same features
described there for configuring KDE in Knoppix can be used to configure KDE here.
to turn the interface to your network. Here are two ways to get the interface to a
standard wired Ethernet card configured:
■ From the shell—You can grab an IP address from a DHCP server by typing
the dhcpd command. You can have the interface brought up and down by typ-
ing ifconfig eth0 up (providing that eth0 was assigned to your network
interface). To bring the interface down, you could type ifconfig eth0 down.
■ From the KDE menu—Select the KDE menu button q Internet
q Set IP address. The network configurator window lets you type in a static
IP address, subnet mask, and default gateway. You can also enter the IP
addresses of the DNS servers.
For other types of networking interfaces, GUI tools also are available. To con-
figure a dial-up connection, select the KDE menu button q Internet q Internet
Dial-Up Tool. To configure wireless LAN connections, select the KDE menu button
q Internet q Wireless Manager.
Again, because BackTrack uses KDE, graphical KDE tools also are available
for configuring and managing network interfaces and features. Open the KDE Con-
trol Center by selecting the KDE menu button q Settings q Control Center. Then
select Internet & Network to see Wireless Network (to autodetect or manually con-
figure wireless interfaces) and Network Monitor.
The bottom line is, if you can accept the overhead that comes with using KDE
(disk space and memory required), using KDE as your desktop environment on a
security live CD offers a lot of the tools you need for basically configuring your sys-
tem. By offering the Fluxbox, XFCE, blackbox, or other low-end window manager,
someone using your security live CD can still switch to those window managers.
Although not all KDE tools will be available, they will be capable of running most
of the security utilities that come with BackTrack.
NOTE
In BackTrack, the BackTrack menu has been integrated into the Fluxbox
window manager. Although a Fluxbox user will be missing some KDE con-
figuration tools, most of the security tools should be available to run
directly from the BackTrack menu that appears when you right-click the
Fluxbox desktop.
that means finding the tools to check systems and networks, evaluate and plug
security holes, and deal with problems, such as broken or exploited systems.
Again, BackTrack is used to illustrate the kind of tools you might include on
your own security-oriented live Linux CD. Literally hundreds of utilities, resources
(such as exploit databases), and services are built into BackTrack that you might
find useful for your own Live CD.
Figure 9-4 illustrates the types of features that BackTrack includes.
Windows
Wireless Mac OS
Wireless LANs
Bluetooth BSD
BackTrack GPS
Linux
Security Check
Live Linux CD Enumeration systems and
DNS networks
LDAP
Operating Systems
File Routing
Systems Windows Shares
Email Servers
SNMP Internet
Databases Web Servers
Exploit Testing
Port scanning
VPN scanning
Vulnerability scanning
Images Password attacks
Fuzzers
Disks Spoofing
Sniffers LAN Router
Services Access
Httpd Services
Anaylsis MySQL
Database analysis Postgres
Forensics Snort
VNC
vsFTPD
As you can see from Figure 9-4, features added to a security-oriented Linux
live CD can go well beyond a password checker and a port scanner. To support the
security tools in BackTrack are features such as archives of security information, to
check for vulnerabilities to known exploits. Tools also are available for tracking
down problems with particular types of devices, such as BlueTooth or wireless
LAN cards.
The coming sections take separate looks at the security topics illustrated in Fig-
ure 9-4. You can use those sections to learn a bit about how those tools work and to
help evaluate the kinds of features you want to have on your own security live CD.
266 Live Linux CDs
(URLs), you can download multiple files over the HTTP protocol from a single com-
mand line. Using the dimitry command, you can gather a whole lot of information
at once about a particular Web server (or other type of system). Besides telling you
the system’s name and IP address, this command searches a variety of information
services to find out about the host, including the whois database (Inet and Inic),
Netcraft, DNS (to find subdomains), and e-mail service.
The httprint command (http://net-square.com/httprint) is a tool for finger-
printing Web servers. Instead of relying on what the Web server reports about itself
(which might be masked by modified banner strings and plug-ins), httprint uses
techniques such the Web server’s responses to various requests (such as HTTP
DELETE and GET requests) to determine the type of Web server. Select Httprint GUI
to use a graphical version of the httprint tool.
To find all the URLS on a Web page, select List URLs to run the listurls.py
command. Choose Paros Proxy (www.parosproxy.org) to test the security of your
Web applications. The Paros graphical utility can intercept and modify HTTP and
HTTPS data transferred between the client and server to test for vulnerabilities.
FIGURE 9-6 Metasploit lets you choose exploit modules to test for system
vulnerabilities.
description of the vulnerability it attacks. Then links lead you through the process
of running each module (selecting options, such as remote systems and port num-
bers and starting the module).
Besides being a tool for checking exploits, Metasploit is a framework for devel-
oping your own security tools. To find out more about how to create and integrate
your own tools into Metasploit, a good place to start is the Metasploit documentation
page, which includes the project’s FAQ: www.metasploit.com/projects/Framework/
documentation.html.
remote client. Using that information, an intruder could try attacking any vulnera-
bilities that might be known about that VPN service.
Select the PSK-Crack entry (psk-crack command) from the menu to use a
dictionary file to try to crack a VPN connection during an Internet Key Exchange.
By default, the dictionary used is /usr/local/share/ike-scan/psk-crack-
dictionary. A brute-force cracking technique is also available with the psk-crack
command (—bruteforce option).
The example in Figure 9-7 shows the results of scanning a single IP address
(10.0.0.100) for a host named DAVINCI. After determining some general informa-
tion about the systems, such as its NetBIOS names and MAC address, LANguard
searches for open ports. When it finds open ports, it tests known vulnerabilities for
the active services found on those ports.
In this case, six open ports were found. After the services on those ports were
tested, two vulnerabilities were found relating to those ports. You can see the stored
274 Live Linux CDs
information about the scan on the left, with a running output of messages on
the right.
SuperScan is another graphical tool for scanning one or more systems over a
network. SuperScan is a Windows executable that can be run in Linux using WINE
software. Using SuperScan, you can set up a list of ports you want to scan and set
timeouts, check ports, and resolve host names.
Nikto (www.cirt.net) is a command-line vulnerability tester that tests for a range
of issues that are most useful for evaluating the vulnerability of Web servers. It
incorporates testing features using plug-ins. By running the nikto command on a
name or IP address for a Web server, Nikto first determines general information
about the server (such as operating system, Web server type, host name, and port
number). Then it goes on to test the server to determine whether a later version of
the server software is available and whether the current version unnecessarily
exposes too much information about itself when queried.
In this example, the password for the user jake was discovered to simply be
jake. The password for root was found to be toor. If you were able to crack users’
passwords on a running system, you should tell those users to change their pass-
words. Be sure to remove the mypasswd file and .john directory when you are done
checking passwords.
Other offline password cracking tools include Rainbow Crack tools BKHive,
OPHCrack, Rcrack, Rtdump, Rtsort, SAMDump2, and WebCrack. RainbowCrack uses
prebuilt rainbow tables to speed password cracking. (See www.antsight.com/zsl/
rainbowcrack site for more information on the RainbowCrack project.)
Running Fuzzers
A fuzzer is a program that injects input into an application, hoping that, as a result,
the application will crash or cause an exception. By getting programs to crash, the
fuzzer hopes to find vulnerabilities in the system that can be exploited by such
things as buffer overflows and denial-of-service attacks. You can find fuzzer appli-
cations on the Fuzzers menu (select K menu q Backtrack q Fuzzers).
The Bruteforce Exploit Detector (bed command) sends commands to server dae-
mons in an attempt to get those commands to cause the daemons to crash. This can
help determine whether the server is susceptible to buffer overflow attacks. The
CIRT Fuzzer (fuzz.pl command) lets you identify a host and port to attack. You can
include a template.txt file on the fuzz.pl command line.
You can use the clfuzz.py program to help audit binaries that have setuid set.
The fuzzer.py program can help find buffer overflow and SQL injection.
BackTrack also comes with the SPIKE Fuzzer Creation Kit. Tools that come
with this kit include webfuzz (a combination of small tools for Web application
276 Live Linux CDs
fuzzing) and msrpcfuzz (used to send random arguments with the intent of finding
bugs that will cause a port to close down).
Doing Spoofing
One way to break into networks or systems is to run programs in which the program
pretends to be something it’s not, such as a legitimate DNS server or DHCP server,
in hopes of fooling an unsuspecting application or user into giving up critical infor-
mation. BackTrack includes a whole set of spoofing tools (K menu q Backtrack q
Spoofing) that you can try out to test for vulnerabilities in your systems.
The arpspoof program (part of the dsniff package from www.monkey.org/~dug-
song/dsniff) tries to trick another computer into believing that it is the gateway
machine. It does this by constantly sending the victim machine its own IP address
as that of the gateway. When the victim machine eventually caches the arpspoof
machine’s MAC address as that of the gateway, the victim starts sending its IP pack-
ets to the arpspoof machine instead of the real gateway.
The dhcpx program (www.phenoelit.de/irpas) is a DHCP flooder. This technique
is also referred to as a DHCP exhaustion attack. The dnsspoof command tries to
convince other systems on the LAN that it is the DNS server by faking replies to
various DNS address queries and pointer queries.
Using the fragroute command, you can try to get, change, and rewrite traffic in
the LAN that is destined for locations outside the LAN. This type of network traffic
is referred to as egress traffic. Although fragroute has an effect on only packets
that originate on the local machine, the fragrouter command can work on other
machines as well.
Check the Spoofing menu for other types of spoofing you can do as well. For
example, some commands try to redirect ICMP traffic, and others try to gain control
by replaying TCP/IP packets.
Network Sniffers
As its name implies, a network sniffer watches a network, trying to “sniff” for infor-
mation being passed on that network. That information can be used for evil (in the
case of someone trying to steal data or connection information) or good (to uncover
a potential problem on the network). In some cases, employers use sniffers to make
sure employees aren’t doing anything against company policy with their computers.
BackTrack includes more than a dozen sniffers that you can use to watch net-
work traffic of various kinds. Check the Sniffers menu to see which ones BackTrack
includes (K menu q BackTrack q Sniffers).
CHAPTER 9 Customizing a Security Live Linux CD 277
You can use the AIM Sniffer (aimsniffer command) to log and capture traffic
from AOL Instant Messenger sessions. Driftnet (www.ex-parrot.com/~chris/driftnet)
is a graphical utility that listens for images in TCP traffic and displays those it finds
in the Driftnet window. Figure 9-8 shows the images that appeared on the Driftnet
window after selecting Wikipedia.org from a local Web browser.
FIGURE 9-8
Display images encountered in TCP
traffic with driftnet.
To sniff secure shell (SSH) traffic, the sshmitm utility (part of the dsniff pack-
age) can be placed between an ssh client and server. By acting as the real ssh
server, sshmitm can grab the password information from an unsuspecting client and
then complete the transaction for the client with the real server without the client
suspecting that anything has gone wrong. The ettercap utility (http://ettercap.
sourceforge.net) is a graphical utility that can similarly do man-in-the-middle
attacks, but ettercap can grab whole sessions as well as the password information.
As the name implies, URLsnarf (urlsnarf command) can grab Web address
information requested on a selected interface (matching any pattern you like). XSpy
(xspy command) can track everything typed into an X display and echo that infor-
mation back to the shell where xspy is running.
To save files that are transferred using the NFS protocol, you can use the
filesnarf command. Using the msgsnarf command, you can save messages and
chat sessions from many different IRC and messaging protocols. With mailsnarf,
you can sniff SMTP and POP traffic to save e-mail messages. All three, mailsnarf,
filesnarf, and msgsnarf, are part of the dsniff package.
attached to your system, you can start and stop the GPS tracking daemon by select-
ing Start GPS Daemon or Stop GPS Daemon, respectively. Several utilities also
exist for changing the drivers used on your wireless cards.
For forging packets on wireless networks, a handful of tools are available on the
Packet Forging menu. The aircrack-ng package (www.aircrack0-ng.org/doku.php)
contains a set of tools for auditing the reliability of your wireless network, including
aireplay-ng (for injecting frames that generate traffic for cracking WEP and WPA-
PSK keys). Airsnarf (www.shmoo.com) can be used to set up a rogue wireless access
point. WifiTap (wifitap command) can be used to capture traffic and inject packets
on an 802.11 network (see http://sid.rstack.org/index.php/wifitap_EN).
Database-Analysis Tools
BackTrack divides its tools for analyzing database vulnerabilities into categories of
generic database tools, MS-Sql, Mysql, and Oracle. Nearly a dozen tools exist for
checking database vulnerabilities.
Absinthe (www.0x90.org/releases/absinthe) is a graphical tool for downloading
database schema and content that might be vulnerable to blind SQL injection. It
also includes the basics for MS SQL server error-based injection. The tool is used
primarily to improve the speed of recovering data.
The SQL-Dict selection runs the sqldict.exe Windows binary for launching
the SQL Server Dictionary Attacker (http://ntsecurity.nu/toolbox). The window lets
you start attacks to test for SQL dictionary vulnerabilities based on target server IP
address and target account. You can also load a password file.
For MySQL databases, BackTrack includes Blind SQL Injection (bsqlbf.pl
script from www.unsec.net), SQL-Miner (mysql-miner.pl script), and Setup MySQL
(setup-mysql Python script). The setup-mysql script lets you configure and start a
MySQL server on which you can start testing.
Forensic Tools
To check out a system for problems after they occur, BackTrack includes a handful
of forensic tools you can run on the system. The Autopsy Forensic Browser
(www.sleuthkit.org/autopsy) lets you set up cases to do volume and file-system
analysis. As forensics are run, data is stored in an Evidence Locker that is associ-
ated with a case.
Using the pasco command (www.foundstone.com/resources/proddesc/pasco.htm),
you can browse the contents of cache files that Internet Explorer left behind. It
takes an index.dat file as input and outputs field-delimited data that you can use
in a spreadsheet.
Acquiring Tools
To be able to run forensic analysis tools on an infected system, you usually need to
copy the file system to an image file to work on it from another location. The standard
tool for copying an image file, and possibly converting it in various ways, is the dd
command (which has been around since the old UNIX days). BackTrack includes
several related commands that can also work with those file system images.
The dcfldd command is an enhanced version of the dd command that is
intended specifically for doing forensics. This command can do such things as
CHAPTER 9 Customizing a Security Live Linux CD 281
hashing on-the-fly (to ensure data integrity) and performing flexible disk wipes
(using any known pattern you choose). To learn more about dcfldd, refer to its
SourceForge page (http://dcfldd.sourceforge.net).
The ddrescue command (www.gnu.org/software/ddrescue/ddrescue.html) is a
data-recovery tool that does its best to rescue data in environments where there
might be read errors. Because ddrescue runs automatically, it fills in data gaps
instead of truncating output or stopping for errors.
A graphical tool for creating file-system image files, already discussed in this
chapter, is the Automated Image & Restore (AIR) utility.
Running Services
Because network interfaces and services that run on those interfaces are off by
default in BackTrack, the BackTrack Services menu (K menu q BackTrack q
BackTrack Services) lets you select to start and stop various system services that
can help you with rescue and security activities. You can select the following serv-
ices from this menu:
Depending on the types of services you want to be able to test from your live
Linux CD, you might want to add other services as well.
Miscellaneous Services
A whole bunch of services that didn’t fit into any other category are lumped into the
Misc category on the BackTrack menu. Among the tools on that menu are QTParted
(a graphical disk-partitioning tool based on the parted command), PDF Viewer (for
viewing PDF files with the kpdf viewer), and Screen Capture (to take a screen shot
with the ksnapshot command).
282 Live Linux CDs
To find available software modules that will work with BackTrack and other
SLAX-based live CDs, go to the SLAX modules page (www.slax.org/modules.php).
There you will find 15 categories of software you can add to your running live CD or
to the /modules directory when you remaster. To install a module immediately, find
the software you want (either select the category or use the search box to find what
you want). Then download the module you choose.
With the module you want to install in the current directory, you can use the
uselivemod command to install the module. For example, you could type the follow-
ing to install the eMovix package:
# uselivemod eMovix_0_9_0.mo
CHAPTER 9 Customizing a Security Live Linux CD 283
SUMMARY
With dozens of security- and rescue-oriented live Linux CDs available today,
choosing one for yourself can be done based on the tools that are provided and the
Linux distribution it is based on. For examples in this chapter, I used the Back-
Track network security suite live CD.
Using BackTrack, you can evaluate literally hundreds of security- and rescue-
oriented tools to work on Linux systems, networks, and a variety of systems you can
reach from a network. BackTrack is based on SLAX (which is based on Slackware)
and, therefore, can use many of the resources available to SLAX (such as extra soft-
ware modules).
284 Live Linux CDs
The chapter steps you through some of the design decisions in BackTrack and
notes where you have opportunities to modify how BackTracks boots up and starts
services. Because BackTrack uses KDE as its desktop, you have a wide range of
desktop tools to support specialized security utilities that will run from that platform.
CHAPTER 10
Customizing a Presentation
Live Linux CD
If you are creating a live Linux CD for the express purpose of making a presenta-
tion, showing your photos, or playing a video, why not have that CD boot directly to
applications that play that content? You can create a live CD that offers one or more
presentations that you, a friend, or a coworker can select from the boot prompt. By
offering your presentation in this way, you can not only go directly to your content,
but you also can play that content with the exact players and options you want.
Because I could not find an existing live Linux CD that boots directly to a pres-
entation the way I wanted, I created my own custom live CD. I began with the latest
version of Damn Small Linux and remastered using a procedure similar to the Knop-
pix remastering procedure in Chapter 6, “Building a Custom Knoppix Live CD.”
For demonstration purposes in this book, I created a live CD that I call Pup-
petiX (don’t look for it at distrowatch.com), which is designed to promote a puppet
workshop and parade. To get a feel for how this type of CD might ultimately work, I
have also included content so you can actually see the viewers in action. From the
boot screen of this live CD, you can select to launch the following components:
■ Slide Show (GQview)—A slideshow of images from past puppet parades
are displayed in full-screen mode using GQview (gqview command).
■ Presentation (Openoffice.org Impress)—The presentation, displayed as
an OpenOffice.org Impress file, describes the puppet workshop and parade.
It was designed for live presentations at community groups and schools.
You can add your own presentations or slideshows that can be launched from
the boot loader. For this particular project, I chose to use the GRUB boot loader so
I could take advantage of the menu interface. I added options to different boot
labels to indicate which presentation to launch.
285
286 Live Linux CDs
one, except that the entire OpenOffice.org suite has been added. Although
this ISO will run the Impress presentation, the ISO itself is much larger
(about 160MB) and requires 384MB of RAM to run properly. This ISO also
takes longer to load, in part because it uses the MyDSL feature (described
later).
To try out PuppetiX, you can copy the ISO you choose to hard disk and then
burn it to a blank CD. Here’s how to do that from a Linux system:
1. Insert the DVD that comes with this book into the DVD drive on your computer.
CHAPTER 10 Customizing a Presentation Live Linux CD 287
2. Copy the puppetix ISO you chose from the DVD to your hard drive. For
example:
# cp /media/livecd/distros/puppetix-1.0.iso /tmp
or
# cp /media/livecd/distros/puppetix-oo-1.0.iso /tmp
3. Remove the DVD and insert a blank CD. Then type the following:
# cdrecord -v -eject /tmp/puppetix*.iso
When the CD ejects, you can boot it from a spare PC to follow along with the
descriptions in this chapter. When you first boot up the CD, you will see a boot
screen that looks like Figure 10-1.
The boot screen contains the head of a large, ugly puppet. Move the cursor
(using arrow keys) between the two selections (Puppet Slideshow and Puppet Pre-
sentation) to choose which one you want to start. Press e on either selection to see
the contents of that boot label. Press e again, this time on the kernel line, to see the
boot options being passed to the kernel. Press Esc and b when you are ready to boot.
PuppetiX boots up to a presentation based on the puppet= boot option added to
the end of kernel lines for the two selections. The Puppet Slide Show label includes
a puppet=slides boot option, which runs gqview (in full screen, slide show mode)
288 Live Linux CDs
with all the images in the /var/puppets/images directory. The Puppet Presentation
label includes the puppet=impress boot option, which ultimately launches an
OpenOffice.org Impress presentation that was added to the /var/puppets/presen-
tations directory.
Depending on whether you selected the presentation or slide show, the
mylaunch script starts either gqview (for the slide show of digital images) or impress
(for the presentation). The data for the two presentations were placed on the live CD
itself in subdirectories of /var/local/puppets.
When the presentation is done, you exit to a simple desktop, which has icons
for launching the same presentations as were on the boot screen. Although I have
added only two selections on this live CD, as I further describe this project, you can
see that it would be simple to add as many slide shows, presentations, videos, or
other content and players as you like.
Any settings you choose are stored in the /home/dsl/.gqview directory. If you
want to keep those settings to use later, you can copy the .gqview directory to the
etc/skel directory where you are remastering the live CD. In that way, you can
keep those settings permanently with the live CD.
Using Impress, you can edit each slide of the presentation, add more slides, or
change a variety of attributes (colors, fonts, layout, and more). You can move around
the presentation by selecting from thumbnails of each slide. Besides playing a
native OpenOffice.org Impress presentation, Impress can work with PowerPoint
presentations and presentations in other formats (such as StarImpress).
Although the OpenOffice.org suite requires a lot of disk space and RAM to run
in PuppetiX and other DSL derivatives, if you have those resources, OpenOffice.org
lets you handle most every type of office file format that exists today.
The rest of this chapter describes how this live CD was put together. In the
process, you learn a bit about using Damn Small Linux to create a minimal live CD
that does just what you want it to do.
CHAPTER 10 Customizing a Presentation Live Linux CD 291
NOTE
In the Knoppix remastering described in Chapter 6, most of the reason for
changing to a chroot environment is to run apt-get and related tools to
add and remove software for the live CD you build. If you choose to use the
MyDSL feature, you might not need to run chroot at all. You can simply
copy MyDSL archives of applications, as described here.
1. Boot DSL—Boot up Damn Small Linux (an ISO is included on the DVD
that comes with this book). The computer you boot up doesn’t need quite the
resources you would need to remaster Knoppix. However, at least 500MB of
disk space and 256MB of RAM probably is a good idea.
2. Set up directory structure—As with Knoppix, DSL provides desktop fea-
tures for easily mounting hard-disk partitions. Because DSL uses /mnt and
not /media to mount hard-disk partitions, the directory names used in the
procedure should be different for DSL. For example, I set up my directory
structure for remastering on /mnt/hda1/DSL instead of /media/hda1/knoppix.
All directory references in that chapter should change accordingly.
3. Get software—After copying files to your new remastering (master and
source) directories, you can get any additional software you need for the live
CD. Instead of using apt-get to get packages from online repositories, if pos-
sible, I recommend that you use the MyDSL feature. To make that happen, I
did the following:
■ Open MyDSL—Select MyDSL from the desktop. The MyDSL Extension
Tool window appears.
■ Choose application—Choose the category and application you want.
You are asked where to save the archive (tarred and gzipped) representing
the application.
■ Save archive—To include the application on the live CD, save the
archive representing that application in the master directory. For example,
if you named your remastering directories as I suggested earlier, you could
292 Live Linux CDs
NOTE
I selected Apps q gqview.dsl.info (for the slide show) to add to both
puppetix images and Apps q openoffice-1.1.4.info (for the Impress pre-
sentations) to the puppetix-oo image.
Advanced users who want to change or add options can edit (press E) the
boot label they want before starting it up.
■ Splash screen—The image on the splash screen can fill the screen. The
menu appears in front of it. This enables you to use a larger image than you
can with Isolinux.
Using GRUB, you can have as many presentations available from the boot
screen as you want. Each presentation can be run with a different player or options
that you define later.
To begin setting up the GRUB boot loader, I added a grub directory to the
master/boot directory during remastering. On the resulting live CD, that directory
will end up as the /cdrom/boot/grub directory. More important, however, when you
make the ISO file system (mkisofs command), the El Torito boot image and related
files will come from that directory.
The contents of the grub directory are fairly simple. By making the labels simple,
you bypass extra help screens. The grub directory contains the following components:
■ linux24—This is the 2.4 kernel copied from the isolinux directory from
Damn Small Linux. That kernel is used for each bootable presentation in
PuppetiX.
■ minirt24.gz—Likewise, the initial RAM disk (minirt24.gz) was copied from
the Damn Small Linux isolinux directory.
■ stage2_eltorito—A stage 2 El Torito boot image is identified with the -b
option of the mkisofs command when you build the ISO image. I got this
image from the grub package that comes with Fedora Core. However, DSL
has a grub package available from the MyDSL feature, which, I presume,
would work as well.
■ puppet.xpm.gz—The splash screen image is a gzipped image in XPM format
(X PixMap image). I used an image of a giant puppet. The XPM image is
640×480 pixels and uses a 14-color palette. Chapter 5 includes a procedure
for converting a digital image to this format.
■ grub.conf—The grub configuration file (grub.conf) is where most of your
customization goes for GRUB. With all the other files in place, you can begin
editing the grub.conf file.
The following code example shows the contents of the grub.conf file in the
PuppetiX boot/grub directory. I left out some comment lines to save space:
# grub.conf
#
294 Live Linux CDs
default=0
timeout=10
splashimage=(cd)/boot/grub/puppet.xpm.gz
# color blue/green red/green
For simplicity, this grub.conf file shows only two labels. For your presentation
live CD, you might want to have multiple slide shows, presentations, or other
content/players. Text that is highlighted in the example grub.conf file is of particu-
lar interest for this live CD.
The default=0 option sets the first boot label (title “Puppet Slide Show”) as the
default. After a timeout of 10 seconds (timeout=10), the default boot label boots
automatically. You can see the seconds count down on the boot screen.
The image used on the splash screen (splashimage) is identified as being
located on the CD image (cd) in the /boot/grub/ directory with the name
puppet.xmp.gz. You need to give the full path to the image (a relative path such as
boot/grub/puppet.xpm.gz is not supported).
The rest of the file is associated with the two boot labels. The title lines indi-
cate the text that will appear on the splash screen menus that you use to select
which presentation to boot (Puppet Slide Show or Puppet Presentation).
For both, the target root device from which data will be read is a CD (cd). Both
labels also use the exact kernel and initrd information that DSL uses in its
default label in the Isolinux configuration file. In this case, however, two options
were added.
Because the PuppetiX live CD was tuned for the Fluxbox window manager, that
window manager is set explicitly on the kernel line (desktop=fluxbox). The puppet=
option, however, eventually triggers the presentation to be run. The slide show of
CHAPTER 10 Customizing a Presentation Live Linux CD 295
NOTE
I left a commented-out color line (color blue/green red/green) as a
reminder that you can change the colors on the splash screen. The first set
of colors indicates the foreground/background colors used for most text on
the GRUB menu. The second set indicates the colors used for the high-
lighted areas (from moving the arrow key to the label you want). Chapter 5
notes the colors you can use.
The mylaunch script is run here without an ampersand (&) at the end. That was
done to prevent Fluxbox from starting up until the presentation is done running. (I
tried it the other way, but Fluxbox kept opening any windows that were behind the
presentation to add borders. They would come to the foreground and obscure the
presentation.)
The mylaunch script was created to make the connection between what was
entered at the boot prompt and which presentation is run. Here are the contents of
the mylaunch script:
#!/bin/ash
# ===========================================================
# text processing functions
# ===========================================================
# Play slideshow
#
if [ ! "`cmdline_parameter puppet=slides`" = "" ]; then
/usr/bin/gqview -s -f /var/puppets/images/
fi
# Play presentation
if [ ! "`cmdline_parameter puppet=impress`" = "" ]; then
/opt/openoffice-1.1.4/soffice -impress -show
/var/puppets/presentations/pp.sxi
fi
CHAPTER 10 Customizing a Presentation Live Linux CD 297
The purpose of the mylaunch script is to read options set from the kernel boot
line and then start up a presentation for any puppet= option that appears on that
line. Those options are stored in /proc/cmdline. If you typed cat /proc/cmdline,
you would see all the options from the label you booted.
The mylaunch script starts with several functions for reading values from
/proc/cmdline. Those functions come from the liblinuxlive script that is part of
the Linux Live CD project (www.linux-live.org). Then in the Presentations section
of the script, the script currently looks for two options.
If puppet-slides was set, the gqview command runs a slide show mode (-s) in
full-screen mode (-f) using all images placed in the /var/puppets/images direc-
tory. If puppet=impress is set, the soffice command is run in Impress mode
(-impress) as a full-screen slide show (-show) to display the pp.sxi OpenOffice.org
Impress presentation.
When the selected presentation is finished running, the Fluxbox window man-
ager starts up. After that, you can begin using the desktop.
Because someone might want to run another presentation or slide show without
having to reboot, the PuppetiX desktop has been modified to all users to run other
presentations from the desktop or restart the original presentations. That desktop
has also been tuned to include a different Fluxbox theme, to match the content of
the PuppetiX live CD.
The xsri command sets the X background to the image given to it. Figure 10-4
shows an example of the full PuppetiX desktop, incorporating the new background:
Other Fluxbox attributes set in PuppetiX are used to make the presentations
and slide shows available from the desktop. To do that, entries for the two slide
shows and presentations were added to the DSL menu that appears when you right-
click on the desktop. The first change is to the etc/skel/.fluxbox/menu file that is
copied to /home/dsl when PuppetiX starts up. A line indicting to include a
mylaunch.menu file in the menu is added to the beginning of the menu file so it
appears as follows:
Debian MENU
[begin] (DSL)
[include](.fluxbox/mylaunch.menu)
[include](.fluxbox/mydsl.menu)
[submenu] (Apps) {}
[submenu] (Editors) {}
.
.
.
Next, a mylaunch.menu file was created in that same directory. That file contains
the following:
CHAPTER 10 Customizing a Presentation Live Linux CD 299
[submenu] (Puppets) {}
[submenu] (Puppet Slideshows) {}
[exec] (Parade 2006) {/usr/bin/gqview -s -f /var/puppets/images}
[end]
[submenu] (Puppet Presentations) {}
[exec] (Workshops 2006) {/opt/openoffice-1.1.4/soffice -impress \
-show /var/puppets/presentations/pp.sxi}
[end]
[end]
The mylaunch.menu file adds a submenu for Puppet Slideshows and one for
Puppet Presentations. One entry exists on each submenu. The two entries align
with the same slide show and presentation set up to launch from the boot prompt.
The menu that results puts the Puppets menu at the top with two submenus, as
shown in Figure 10-5.
FIGURE 10-5
Restart any presentation from
the DSL menu on the Fluxbox
desktop.
Of course, just as with the boot labels, you can add as many menu items as you
have presentations (or ways of running presentations).
compressed KNOPPIX image for the live CD. I ran the following mkisofs command
to produce the KNOPPIX image:
# mkisofs -R -U -V "My Knoppix File System" \
-publisher "John W. Jones" \
-hide-rr-moved -cache-inodes -no-bak -pad \
-graft-points /var/puppets/images/=/home/dsl/images/ \
/mnt/hda1/DSL/source/KNOPPIX \
| nice -5 /usr/bin/create_compressed_fs - 65536 > \
/mnt/hda1/DSL/master/KNOPPIX/KNOPPIX
Next, I ran the following to produce the final ISO image (called puppet-0.1.iso):
# cd /mnt/hda1/DSL/master
# mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
-boot-load-size 4 -boot-info-table \
. > ../puppet-0.1.iso
You can also add multiple graft points to add images or other content from many
directories to your live CD. With the small size of the operating system (50MB to
about 150MB for the examples of PuppetiX) and large removable media (up to
8.4GB for a dual-layer DVD), you have the potential to create massive bootable
slide shows using the live CD described here. Grafting enables you to store them
separately and join them to the live CD only when you make the final ISO image.
SUMMARY
The PuppetiX live CD was created for this book to illustrate how to make a live CD
that boots up directly to a slide show or presentation. Using the GRUB boot loader,
a PuppetiX user can select from a menu of presentations. The operating system
then boots up to a remastered Damn Small Linux that results in a full-screen dis-
play of the selected presentation.
By starting with a mini desktop distribution, such as Damn Small Linux, you
can create this special-use type of live CD in a way that enables you to add lots of
content. Using features such as MyDSL, you can add only those players you need
(such as the gqview and OpenOffice.org Impress applications). The rest of the space
on your live CD or DVD can be dedicated to holding the digital images, presenta-
tions, videos, or other content you want to display.
Because DSL is based on Knoppix, you can use many of the remastering tech-
niques described in Chapter 6 to tailor the content of your live CD. You can also
customize the Fluxbox desktop to include images, colors, and other desktop attrib-
utes to match the content you are displaying.
CHAPTER 11
301
302 Live Linux CDs
If you want to put together a live CD that you can distribute freely, you can
check out several lists of available applications. Later in this chapter, I take
you through the selection of games that are included with the Linux Live
Game Project live CD.
■ Commercial games and demos—Many of the most popular computer
games were, of course, created to sell commercially. Most commercial com-
puter games were made for Microsoft Windows platforms, but some commer-
cial games have been ported to Linux.
Although it might not be legal to include most commercial Linux games on a
live CD, in some cases you can get permission to include demos of those
games on a Linux live CD. We describe some of the licensing issues sur-
rounding redistributing commercial Linux games later in this chapter.
■ Classic commercial games—You might be able to legally include on a live
CD some classic commercial games that were created originally for PCs or
game consoles. That’s not to say that it’s alright to just include a game on
your live CD because a company isn’t selling it anymore. Most companies
don’t simply relinquish their copyright because the game is no longer being
marketed.
However, in some cases, rights to classic games have been released into the
public domain. In other cases, game console emulators are available in
Linux, and you can purchase the games themselves to run on those emula-
tors. In yet another case, parts of a commercial game might have been
released into the public domain, while open-source clones of the parts that
are still copyright protected might have been created so the whole game can
be freely distributed. Doom is an example of such a game.
■ Video card support—A big impediment to getting support for 3D gaming
in Linux is getting drivers for video cards that support hardware acceleration.
Closed-source drivers for Nvidia and ATI graphics cards are available for
Linux, but restrictions govern redistributing those drivers and some difficul-
ties inhibit getting those drivers to play nicely with open-source video drivers
on the same machine. Later in this chapter, I describe ways to get drivers to
play more advanced 3D graphics games.
To start, this chapter takes you through some of the available Linux live CDs.
Then it describes open-source games that you can include on your own live CD so
that you can freely distribute your CD. To demonstrate many of these games, the
chapter includes a description of a Knoppix customization called the Linux Live
Game Project (LLGP) live CD.
CHAPTER 11 Customizing a Gaming Live Linux CD 303
This chapter goes on to cover the issues that surround including software on
your live CD that was or is still covered under licenses other than GPL types of
licenses. These types of games include games that are sold commercially or that
have other licensing impediments that you might or might not be able to work
through.
PCLinuxOS SuperGamer
If you want to test the limits of your computer hardware for gaming, the SuperGamer
live DVD (based on PCLinuxOS) has plenty of 3D accelerated games you can play.
SuperGamer doesn’t have a home page yet, but you can learn more about it from the
CHAPTER 11 Customizing a Gaming Live Linux CD 305
FIGURE 11-1 Play strategy, arcade, or even kids games (such as Potato Guy)
with GamesKnoppix.
NOTE
If you don’t have an Nvidia card, you might encounter driver conflicts if you
try to use 3D acceleration on other video cards. When I tried a machine
with an old Intel i810, games requiring 3D acceleration failed to run (com-
plaining that GLX was not available). I uninstalled Nvidia drivers and
restarted the system. After that, I was able to run games requiring 3D accel-
eration using the proper i810 drivers. (It didn’t run fast because it was an
old machine with low RAM, but it did work.)
306 Live Linux CDs
games. A lot of RAM is also required to run these games. Don’t expect very good
performance with less than about 512MB of RAM and a sub-1GHz processor.
The PCLinuxOS SuperGamer live DVD includes these playable demos and
3D games:
■ Doom and Quake—Demos of the popular Doom 3 (www.doom3.com) and
Quake 4 (www.quake4game.com) first-person shooter games are on the DVD.
■ Wolfenstein—The Return to Castle Wolfenstein: Enemy Territory demo
(http://games.activision.com/games/wolfenstein) is included on this DVD. In
this game, you can save the world from Himmler and his evil occult army.
■ Neverball—Roll a ball through an obstacle course in this combination puz-
zle and action game. You can learn more about it from the Icculus site
(http://icculus.org/neverball). Neverputt, a miniature golf game based on the
same technology, is also included here.
■ BZFlag—Play against the computer or in teams over the Internet with this
3D tank battle game (www.bzflag.org).
■ PlanetPenguin Racer—Help Tux race down the mountain on his belly in
this 3D race-against-the-clock game (http://projects.planetpenguin.de/
racer/).
■ UFO: Alien Invasion—Fight against hostile aliens in this tactical battle
game (www.ufoai.net).
■ America’s Army—This video game, sponsored by the U.S. Army, was
designed to portray soldiers’ experiences in different occupations in the
army. The game includes training events that proceed to multiplayer opera-
tions. See www.americasarmy.com for more information.
Aside from the games, SuperGamer includes some multimedia applications for
working with digital images (GQview, GIMP, XSane, and others), sound (Kaboodle,
KsCD, and Xmms), and video (Realplayer, TVtime, and Xine). The Networking
menu also has a good set of communications applications (file transfer, instant mes-
saging, e-mail, and so on).
Figure 11-2 shows an example of the SuperGamer desktop, displaying the Bat-
tle of Wesnoth game and the XMMS media player.
CHAPTER 11 Customizing a Gaming Live Linux CD 307
To focus on games, LLGP developer Fabio Fabbri removed office and multime-
dia applications to make lots of room for games. He added multiple available LLGP
backgrounds and a separate Games menu to the panel. He also put a Games Juke-
box icon on the panel so you can select a random game to start. To speed up the boot
process, kudzu hardware detection was completely removed, leaving all hardware
detection done by hotplug and udev.
Although LLGP includes Nvidia drivers, they were included in a more
thoughtful way than I have seen with other live CDs. For example, I tried LLGP
on my old Intel i810 computer, and no apparent conflicts arose with Nvidia driv-
ers. Typing glxinfo showed that direct rendering was on (Yes) and GLX exten-
sions were enabled, so I could play games requiring DRI and GLX (albeit, rather
slowly, given the slow processor and low RAM amounts). See the LLGP Nvidia
discussion for more information (http://tuxgamers.altervista.org/LLGP_Nvidia_
packages).
If you have questions about LLGP, you can go to the Tuxgamers forum area to
ask questions or see what others are discussing about LLGP (http://tuxgamers.
altervista.org/forum). English and Italian forums are available there.
Figure 11-3 shows the LLGP desktop with one of several LLGP backgrounds in
use. In the lower-right corner, you can see the game selected today from the Games
Jukebox icon. The complete Games menu (shown on the left) is displaying the Strat-
egy games submenu. Other games shown on the screen include Xbill and KPoker.
The following sections contain descriptions of games that you can try out from
the LLGP live CD. Because all these games are available from Debian/Knoppix
repositories, you can use them in any Knoppix remaster you do yourself. Because
they are open source, most other Linux distributions offer the games as well (if you
prefer, for example, a Fedora, Gentoo, or Slackware remaster).
Adventure Games
Falcon’s Eye is a graphical version of the popular NetHack game. With Falcon’s
Eye, instead of moving keyboard letters around ASCII grids, you see graphical
characters and items appearing around a colorful grid. The purpose of the game is
to travel through mazes to retrieve the Amulet of Yendor. Along the way, you
encounter creatures and items that can help you on the quest.
Running Falcon’s Eye requires Simple DirectMedia Layer software support
(www.libsdl.org). Read about the game from the Falcon’s Eye home page
(http://users.tkk.fi/~jtpelto2/nethack.html). To install the game from Debian repos-
itories, request the falconseye package.
CHAPTER 11 Customizing a Gaming Live Linux CD 309
FIGURE 11-3 Choose a random game or select from hundreds of games on the
LLGP menu.
Arcade Games
Dozens of games appear on the Arcade submenu of the LLGP games menu. Some of
the games are simple KDE games that will run in almost any working X desktop.
Others games require SDL support to work. Table 11-1 shows information on games
in the Arcade list so you can try them and decide whether you want them on your
own live CD.
Some of the most entertaining games of those just mentioned are BZFlag and
TuxRacer. You can play BZFlag against the computer or against others on the Inter-
net. It contains a server component that lets you start your own BZFlag server that
others can connect to. You move your tank around a landscape, destroying oppo-
nents and picking up flags. In capture-the-flag mode, you try to get the opponents’
flags before they get yours.
310 Live Linux CDs
continues
312 Live Linux CDs
TuxRacer is a 3D racing game. You steer Tux the penguin down the hill, going
around flags and avoiding obstacles. Try to make it to the finish line first. Figure
11-4 shows an example of the TuxRacer game running from the LLGP live CD.
CHAPTER 11 Customizing a Gaming Live Linux CD 315
FIGURE 11-4 Pick up herring as you race Tux down snow-covered hills toward
the finish line.
Board Games
Many of the board games available in open source are fashioned after real board
games (backgammon, mahjongg, and chess, for example) and are packaged in KDE
and GNOME games packages. Table 11-2 contains lists board games that are pack-
aged with LLGP live CD.
Some of the board games just described include editors for creating design ele-
ments to go with the games. Atlantik Designer lets you design each estate on the
Atlantik board, as well as name rents, property prices, and street names. Penguin
Taipei-Editor lets you design tile combinations to play with the Ace of Penguins
Taipei game.
316 Live Linux CDs
Figure 11-5 shows examples of several board games that come with LLGP.
Those games include 5-in-a-Row, KReversi, GNOME Tali, and Shisen-Sho.
FIGURE 11-5 Add Yahtzee (GNOME Tali), 5-in-a-Row, KReversi, and Shisen-
Sho board games to a live CD.
318 Live Linux CDs
Card Games
Card games that come with LLGP are dominated by solitaire games, including
include AisleRiot, FreeCell, and Gnome Solitaire. A few, however, can be played
with others over the network (see Table 11-3).
Kids Games
The only game in the Kids Games category in LLGP is Potato Guy, in which you put
a face, hands, hats, and other accessories on a potato. Although the game is not very
complicated, it keeps younger kids amused for a long time.
Sports
The sports games included with LLGP are all 3D games that can test your hard-
ware. Battleball (battleball package) is a soccer game played with tanks and heli-
copters. BilliardGL (billiard-gl package) is a 3D billiards game. CannonSmash
(csmash package) is a table tennis game simulator. Foobilliard (foobilliard pack-
age) is another 3D billiards game.
Strategy
Some of the most challenging games available on LLGP are the strategy games.
Freeciv (freeciv-client, freeciv-data, and freeciv-server packages) is a
clone of the game Civilization, in which you build and maintain civilizations.
Lincity (lincity package) is a similar game for building communities and city
infrastructures.
Battle for Wesnoth (wesnoth, wesnoth-data, wesnoth-editor, wesnoth-music,
and wesnoth-server packages) is a popular fantasy, turn-based strategy game.
Scorched3D (scorched3d, scorched3d-data, and scorched3d-doc packages) is a
tank game that is based on the classic DOS game Scorched Earth. Liquidwar (liq-
uidwar and liquidwar-data packages) is a multiplayer war game.
An example of a slightly sticky case is the free release of the popular first-
person shooter game Doom. Although the game was released to be fully
redistributable, a clause remained related to the Doom shareware Wad: “You
may not: modify, translate, disassemble, decompile, reverse engineer, or cre-
ate derivative works based upon the Software.”
Because the capability to change the code is an important element of soft-
ware projects such as Fedora Linux, that project decided to replace the
offending part (the Doom engine) with the Freedoom package. Freedoom was
a Doom engine written completely from scratch, so it can be redistributed—
and also modified—by those who receive it.
Another piece of gaming software that can be used to play games released to the
public is ScummVM (www.scummvm.org). LucasArts originally created SCUMM to
create many games, such as Monkey Island, Day of the Tentacle, and Legend of
Kyrandia. ScummVM is released under the GPL and can play many games that
originally ran on SCUMM. See the ScummVM compatibility list (www.scummvm.
org/compatibility.php) for details.
Games in this category that will play on ScummVM that have been released
into the public domain include Beneath a Steel Sky (made available as freeware in
August 2003) and Flight of the Amazon Queen. These games are included on some
games live CDs/DVDs, such as the GamesKnoppix DVD.
Some great places for investigating the licensing issues related to different
gaming software include the mailing lists for Linux distributions that deal with
what software to include or not include in their distributions. For example, the
Fedora Extras mailing list has had good discussions on game-licensing issues
(www.redhat.com/mailman/listinfo/fedora-extras-list).
RPM package (that comes on the DVD), make sure that you have enough work
space in /tmp, and run a command similar to the following to get started:
# kadischi —graphical -f \
http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os \
/tmp/fedora-live.iso
The command just shown should appear on one line (the backslashes are there
to indicate that the line should continue). I have you use the --graphical option
because selecting multiple repositories is not currently supported in text mode. The
-f option causes any previous ISO image (fedora-live.iso) to be overwritten.
Step through the installation screens until you get the screen that lets you select
multiple repositories. Select the check box next to Fedora Extras. If you like, you
can also choose other third-party repositories and add them as well (in particular,
rpm.livna.org).
Next, select the Customize Now option near the bottom of the screen and con-
tinue. The next screen that appears shows the available package groups from which
to choose. Select Applications q Games and Entertainment. Then select Optional
packages. The screen appears as shown in Figure 11-6.
FIGURE 11-6 Choose from more that 60 gaming packages from Fedora Core
and Fedora Extras.
CHAPTER 11 Customizing a Gaming Live Linux CD 323
Select the games packages you want to add to your live CD. Refer to descrip-
tions of gaming packages earlier in this chapter to help choose which might be the
most fun for you to include. After that, choose other packages from other categories
to install. You will notice that there are many more interesting packages available
that you get with a basic install of Fedora Core, because the listing contains pack-
ages from Fedora Core and Fedora Extras.
Continue through the installation procedure as described in Chapter 7. Use the
procedures in that chapter to add your own splash screen or other custom settings
as appropriate for a gaming live CD.
SUMMARY
Gaming live CDs can be just plain fun to put together and use. Hundreds, if not
thousands, of free and open-source games are available to include on your Linux
live CDs. Categories of games include adventure, arcade, board games, card games,
sports, and strategy games.
A big issue with getting high-quality 3D games running well on Linux live CDs
is the issue of supported 3D accelerated video cards. Nvidia and ATI release binary
versions of their drivers, but those drivers can sometimes conflict with drivers for
open-source hardware-accelerated video cards. Open-source purists also note that
there’s no way to know how those drivers might be causing conflicts in your Linux
system kernel.
Outside the realm of open-source games, you might be able to include with your
live CD some older commercial games that have been released as freeware. Games
once sold commercially, including Doom and games such as Beneath the Steel Sky
and Flight of the Amazon Queen, that run on the GPL-licensed ScummVM can also
be included on a live CD.
The Fedora installer and tools from the Kadischi project are used to illustrate
how to build a gaming live CD that is based on the Fedora Linux distribution. Using
the latest Fedora anaconda installer, you can select packages from multiple online
repositories to gain access to many more gaming and other software packages.
This page intentionally left blank
CHAPTER 12
Customizing a Multimedia
Live Linux CD
Creating, manipulating, and displaying multimedia content has long been a favorite
pastime for PC users. Computers these days are just expected to enable you to play
music, watch movies, and work with your digital images. Improvements in free and
open-source multimedia applications make for a rich set of choices for someone
putting together a Linux-based live CD that focuses on multimedia applications.
Multimedia live CDs covered in this chapter fall into two categories:
■ Multimedia players—By specializing in only playing video, music, and
slide shows, multimedia player live CDs can be trimmed to a very small size.
Consuming only a few megabytes of disk space allows these players to run
totally in RAM, while the CD or DVD drive can be used to hold music or
movies.
■ Multimedia production tools—For Web designers, musicians, graphic
artists, and animators, live CDs provide a means of carrying tools to produce
high-quality digital art. Many open-source tools are beginning to rival com-
mercial offerings in areas of image manipulation (The GIMP) and 3D anima-
tion (Blender).
To illustrate multimedia players, I’ve added a description of GeeXboX to this
chapter. Besides describing how to use GeeXboX as a multimedia player, I describe
the GeeXboX Generator, which can be used to add content, codecs, and personal
settings to a remastered ISO image of the GeeXboX multimedia player.
In the area of multimedia toolkits, I describe Dynebolic live CD. Dynebolic
includes more than 100 open-source applications that can be used with a desktop
system dedicated to producing and publishing multimedia content.
325
326 Live Linux CDs
■ Software patents—Many of the audio and video standards that are used for
creating and playing commercial music and video contain patented technol-
ogy. Anyone writing music and video players is subject to claims from those
royalty holders to pay for every player or encoder the software creator distrib-
utes.
■ Digital Millenium Copyright Act (DMCA)—The DMCA is an act of the
United States Congress in 1998 that made it illegal in the U.S. to create tech-
nology to circumvent copyright-protection measures.
The threat of software patent claims has been looming over the free and open-
source software movement since people began distributing free software. To fight
the long-term battle someday, major software vendors have been gathering patent
portfolios relating to everything from database structures to how you click to buy
something on the Internet. In the short term, however, some of the most litigious
types of software components have been those related to multimedia.
In theory, you should understand the licensing arrangements associated with
every piece of software that you use. In reality, most of us rely on the legal interpre-
tations of the commercial software vendors or open-source software organizations
that create and/or redistribute software for our consumption. So instead of giving
you legal advice about what you can and cannot do with the software described in
CHAPTER 12 Customizing a Multimedia Live Linux CD 327
this book (which I am not qualified to do), I pass on the general interpretation of
what is and is not considered to be freely distributable software for multimedia.
If you are creating video or audio content from scratch, you can use open-
source audio and video codecs. Any content you create with these open-source mul-
timedia players can be freely distributed along with the players and encoders
themselves. You can even include these encoders and players in your own commer-
cial products, as long as you adhere to the licensing associated with them (which
generally requires that you make the source code available).
As I noted earlier, playing your own multimedia content in Ogg Vorbis and The-
ora from live CD is not a problem. Playing commercial multimedia content, how-
ever, is an issue. This is where you need to do some digging. Every major Linux
distribution includes software for playing commercial music CDs, but most don’t
include software for playing MP3 music files. Likewise, every major video format
outside of Theora comes with some patent restrictions that prevent it from being
freely distributed.
Playing commercial movies from DVDs is a different case. The encryption
techniques used to produce and play commercial movies on DVD were kept as
trade secrets and, therefore, were not patented or copyrighted. So when that encryp-
tion was broken with software refered to as DeCSS, there was nobody to claim a roy-
alty for distributing the software to play commercial DVDs.
328 Live Linux CDs
However, what makes the distribution of DeCSS illegal are the DMCA and var-
ious hacker laws around the world. The DMCA made it a felony in the U.S. to cir-
cumvent copyright protection, as DeCSS did. To my knowledge, there has been no
legal action taken against anyone in the United States for using or distributing code
that breaks DVD encryption. One of three creators of the DeCSS, Joon Lech
Johansen, was tried several times in Norway under a criminal hacker law but was
later acquitted (see http://en.wikipedia.org/wiki/DeCSS).
Because of licensing issues and other legal entanglements, most open-source
DVD players use the libdvdcss library (http://developers.videolan.org/libdvdcss)
for unscrambling and accessing commercial DVDs based on the Content Scram-
bling System (CSS). Despite the fact that CSS is not really a copy-protection system,
but a means of keeping people from playing DVDs without licensed software, most
major Linux distributions don’t include libdvdcss in their distributions.
With all that said, software for playing just about every audio and video codec
under the sun is available from unofficial sources to go with most Linux distribu-
tions. In some cases, private use of these codecs is permitted without paying royal-
ties (assuming you are using GPL sofware and not stolen commercial software).
The following are examples of repositories where you can get codecs you need for
playing and encoding a variety of audio and video formats for your particular Linux
distribution:
Before you include any contentious software on a live CD, particularly if you
plan to redistribute that software to a larger audience, you need to check carefully
into licensing and patent issues. For in-depth discussions of multimedia software
issues as they relate to the Fedora Project, refer to the Fedora Project Forbidden
Items page (http://fedoraproject.org/wiki/ForbiddenItems)
CHAPTER 12 Customizing a Multimedia Live Linux CD 329
(NFS), you can mount shared remote folders or directories that contain con-
tent to play.
■ Network file transfer—By connecting to FTP repositories, you can select
content contained in those repositories.
■ Streaming content—By including media players that can play streaming
audio and video, you can play that type of content from your live CD.
The following sections contain descriptions of several multimedia player live
CDs. Descriptions include information on the features each live CD supports and
ways that you can add content. You’ll also find descriptions of how to add codecs so
you can play additional types of audio and video content.
FIGURE 12-1
Simple menu interfaces
keep system resource
use low with GeeXboX.
All partitions are mounted on the /mnt directory under names that relate to
their partition numbers. For example, the first partition on the first IDE hard disk
(/dev/hda1) would be mounted on /mnt/Disk 1 Part 1 directory. Use the right and
left arrow keys to move up and down the directory structure to find the media files
you want to play.
Before you select any content to play, only a few commands are available.
Select M to show or hide the GeeXboX menu. Choose S to switch to TV Out. While
you are playing audio or video content, you can use regular mplayer features to con-
trol playback. Table 12-1 details playback controls.
To choose other options for playback, select Options from the main GeeXboX
menu. From the Options menu, you can do such things as adjust the aspect of the
video playback, switch to TV Out, switch vertical sync, and set a sleep timer.
Normally, if you insert a DVD, it simply begins playing the movie. By selecting
Autoplay Mode from the Options list, you can disable that feature. Then go to DVD
settings and choose DVD Navigation Menu. The next time you open a DVD, you
will be able to use the regular DVD navigation menu as you would on a standard
DVD player. With the DVD navigation menu enabled, you can use the keys shown
in Table 12-2 to get around.
Regenerating GeeXboX
The GeeXboX ISO Generator lets you rebuild GeeXboX using existing binaries so
you can use GeeXbox exactly the way you want to. This software provides the
means to include content, codecs, or settings in a way that completely personalizes
your own version of GeeXboX completely personalized.
CHAPTER 12 Customizing a Multimedia Live Linux CD 333
You can regenerate GeeXboX on a Linux, Mac OSX, or Windows system. To get
started regenerating your own personal GeeXboX, do the following:
1. Download the GeeXboX ISO Generator—Go to the GeeXboX download
page (www.geexbox.org/en/downloads.html) and choose either the i386 or
PowerPC version. Then select the nearest download site to download the
geexbox-generator package to your hard disk. Or refer to Appendix A
for information on using the geexbox-generator included on this book’s
accompanying CD.
2. Unpack the geexbox-generator package—Save the geexbox-generator
package to a directory on a partition that contains enough space to do the
regeneration that you want. The software itself requires only about 13MB of
disk space, but if you are adding a movie to your regenerated GeeXboX ISO,
that can take considerably more space. To unpack the package in Linux, type
the following:
# tar xvfz geexbox-generator-*tar.gz
The archive is uncompressed and added to a geexbox-generator subdirec-
tory (for example, geexbox-generator-1.0.i386).
3. Start the GeeXboX Generator—Go to the geexbox-generator* directory
and launch one of the following commands, depending on which operating
system you are using to regenerate the ISO:
# ./linux-i386-generator # for Linux Systems
# generator.exe # for Windows Systems
# ./macosx-generator # for Mac OS X Systems
Figure 12-2 shows the GeeXboX Generator window when it is run from a
Linux system.
FIGURE 12-2 Tune different aspects of your personalized GeeXboX from the
GeeXboX Generator.
CHAPTER 12 Customizing a Multimedia Live Linux CD 335
If you are interested in playing multimedia in Linux, another project that might
interest you is MythTV (www.mythtv.org). Although MythTV was designed to install
and run from hard disk, the project contains a front end that can run from a live CD.
Using that live CD, you can play multimedia content from a MythTV server on your
LAN and display that content on an inexpensive client PC. KnoppMyth
(www.mysettopbox.tv/knoppmyth.html) is a live CD that can get you started
installing Knoppix on a hard disk.
Understanding Dynebolic
The Dynebolic live CD was designed to run lean so that most resources can be
directed toward running powerful multimedia applications. Dynebolic boots up
directly (no login required) to a WindowMaker window manager without many frills.
Emphasis is on ease of use, so access to available storage device and root privilege
are immediately opened.
The WindowMaker window manager (www.windowmaker.info) incorporates
small applications called docapps into its interface instead of end-to-end panels.
For Dynabolic, docapps are added to the desktop to let you immediately open fold-
ers on different storage locations using the rox file manager. Locations include your
home folder, hard-disk partitions, network shared folders, and any removable
media (CDs, DVDs, floppy drives, and USB flash drives).
Hard-disk partitions and removable storage devices that have read/write capa-
bilities (such as USB flash drives) are all mounted with read/write permissions.
When you open a terminal window or storage device from the desktop, you do so as
root user with the capability to effectively change any file or directory on the com-
puter. Again, this reflects Dynebolic’s intent to be as easy and open as possible.
The menus on the WindowMaker desktop are where you see what there really is
to do with Dynebolic. Right-click the desktop to see the dyne:II menu, which
includes categories of applications that include video, audio, image, text, Net, files,
devel, xutils, and desktop applications. There are also selections for opening a ter-
minal window (XTerm) and configuration window (Configure).
Figure 12-3 show some docapps (right) for opening disk partition and other
storage media, as well as the dyne:II menu for selecting multimedia applications to
run. Applications for configuring language, networks, modems, printers, screen res-
olution, sound cards, and WindowMaker itself are shown in the Configure folder.
To support lots of work going at the same time, the Dynebolic WindowMaker
desktop is configured with six virtual desktops. Select the docapp from the upper-
left corner of the screen to switch desktops.
Dynebolic also enables you to save the changes you made in a way that allows
you to restore those changes later. The Nest (which you can create by selecting the
Nest icon from the Configure window) lets you save your desktop settings and data
to an archive on hard disk or USB key so that you can restore these later. (Chapter
2, “Playing with Live Linux CDs,” contains descriptions for setting up a Nest.)
With Dynebolic booted, you have a lean desktop, access to all locally con-
nected storage media, and basic tools for configuring the desktop and saving data
and settings going forward. Now for the fun part: using the multimedia applications.
340 Live Linux CDs
FIGURE 12-3 Open multimedia applications and disk partitions from the
Dynebolic desktop.
FIGURE 12-4 You can play DVDs, VCDs, CDs with a variety of supported video
types from Xine media player.
FIGURE 12-5 You can edit video and audio content using Cinelerra.
FIGURE 12-6 View artist information as you play music from playlists and col-
lections in AmaroK.
CHAPTER 12 Customizing a Multimedia Live Linux CD 343
SUMMARY
Many multimedia tools and players are available in the free and open-source world.
Some live CD developers have created tiny Linux distributions that are dedicated to
playing and displaying audio, video, and digital images. Those types of distribu-
tions include MoviX, GeeXboX, and LiMP.
An example of a live CD that focuses on creating a multimedia toolkits of open-
source applications is Dynebolic. Using Dynebolic, you can create, edit, and pub-
lish audio, video, and digital images in a variety of formats. Dynebolic contains a
lightweight window manager and many easy-to-use features to facilitate an efficient
platform for running multimedia applications.
CHAPTER 13
Live Linux CDs make an excellent choice for a firewall, for a number of reasons.
First, most firewall-specific distros require very little software, so they fit quite well
on a single CD-ROM. Second, performance isn’t much of a factor because, again,
not a lot of software is involved in setting up a Linux-based firewall; the system
shouldn’t need to read from the CD-ROM very often, so it shouldn’t take a perform-
ance hit in reading from CD-ROM instead of a hard disk.
Third, the software on the CD-ROM is write-only, so you don’t have to worry
about an intruder tampering with the software included with the live CD distro.
Finally, you don’t usually need to write data to disk with a firewall distro, so you can
make use of a system that doesn’t even have a hard drive.
Customizing a firewall CD can include putting new packages on the CD or just
hard-wiring your configuration so that you don’t need to read additional data off a
hard drive, floppy, or USB flash drive.
In this chapter, we look at the Devil Linux distribution and how to use and cus-
tomize it, and we briefly discuss some of the other options in the live CD firewall
arena.
345
346 Live Linux CDs
a used Pentium or Pentium II computer with at least 32MB of RAM is usually suf-
ficient to provide decent performance. For my home network, I use a Pentium III
clocked at 350MHz, with 384MB of RAM and two 10/100 Ethernet cards.
This is probably overkill because the firewall serves only two users and a hand-
ful of computers, but it’s the oldest machine I had lying around when it came time
to set up a firewall.
After you select your hardware, it’s time to choose the distro. You have the fol-
lowing options when it comes to using a live CD for your firewall:
If you’re using a live CD for your desktop and you have only a single computer,
you might want to just configure firewall rules in Knoppix (for example) and leave it
at that. If you’ll be setting up a dedicated firewall, though, you probably want to go
ahead and use a distro that’s specifically set up for the task.
I spent a fair amount of time considering the options and finally chose Devil
Linux as the firewall of choice, for the following reasons:
buffer overflows and other attacks that take advantage of minor vulnerabili-
ties to run arbitrary code. Because the firewall is your first line of defense,
you want it to be as secure as possible.
■ Simple GUI tools—I also like Devil Linux because I can use a simple GUI
application, Firewall Builder, to create firewall rules to run with Devil Linux.
■ All open source—Finally, Devil Linux is totally open source. Some of the
nicer live CD firewall distros, such as Coyote Linux, include proprietary
components that prevent modification or prevent use in commercial environ-
ments without licensing fees. Well, I don’t want to waste my time and trouble
learning a system that I can’t use in a commercial environment down the
road, if I so choose.
NOTE
To use Devil Linux, you’ll need to have at least a 486 or compatible CPU,
32MB of RAM, two or three Ethernet cards supported by Linux, and a
device to store a configuration to. In this chapter, we assume that you have
a hard disk attached to the computer—even a small one will do. You can
also use a USB flash drive or floppy disk, if you still have any floppies!
So, to be clear, the complete command line includes the kernel name as well.
This is taken as read in the Devil Linux documentation and is likely to confuse new
Linux users. The entire command line would look like this:
boot: /boot/vmlinuz root=/dev/ram0 initrd=/boot/initrd.gz
init=/linuxrc DL_config=/dev/ide/disc0/part1:myconfig.tar.bz2
That probably seems like a lot of typing, but remember that when you have your
firewall set up, you shouldn’t need to reboot very often.
This example would tell Devil Linux, “Look for the file myconfig.tar.bz2 on
the first IDE disk (disc0) on the first partition (part1).”
NOTE
Yes, the syntax is a bit muddled—0 is the first disk, but 1 is the first parti-
tion. Not only is counting from 0 confusing, but it’s also nonstandard
because it’s not applied across the board.
CHAPTER 13 Customizing a Firewall Live Linux CD 349
Finally, you can string more than one config location, if you need to, by separat-
ing them with commas, like so (make sure that the entire text of both lines is typed
into one line):
DL_config=/dev/ide/disc0/part1:myconfig.tar.bz2,/dev/scsi/disc0/part1:sc
siconfig.tar.bz2
Note that there’s no space between the comma and configuration locations.
If this is the first time you’re booting Devil Linux, you can save the bit of time it
takes to scan the drives by passing this option instead:
DL_config_no_scan
The initial scan can take quite a while (a couple minutes, so you probably want
to use the DL_config_no_scan parameter if you already know that you don’t have the
configuration file.
If you don’t pass the DL_config_no_scan parameter and there’s no configuration
file for Devil Linux to find, it will stop during boot-up with a prompt saying “Would
you really like to load DL without configuration Media?” Go ahead and press y;
Devil Linux then finishes booting.
Devil Linux also includes the memtest utility on the live CD, so if you’re a bit
concerned that a machine has bad RAM, you can type M at the boot prompt to boot
Devil Linux into memtest.
Pressing F1 takes you to the help screen, and F10 returns you to the main menu.
When the CD finishes booting, it’s time to log in.
As you can see, in the first example, there’s one SCSI disk on this system, and
it already has a Linux partition. The second example looks a little more compli-
cated, but it’s not too hard to follow; the system has an IDE drive as the first device
on the first IDE bus, which translates to /dev/hda. (SCSI disks are usually sdn and
IDE disks are hdn where n is the letter for the device—a for the first one, b for the
second one, and so on.)
If the disk doesn’t have a partition or you just want to get rid of it and start fresh,
run something like this:
# fdisk /dev/sdb
Replace /dev/sdb with the appropriate device. Note that you’ll see an error
message about lacking a file system if the disk has never been initialized. It’s okay
to ignore that.
To create a new partition, press n at the fdisk menu and follow the prompts.
Note that you can see the fdisk help menu by pressing m; remember to write the
changes to disk when you’re finished with w, or press q to quit without saving.
When you’ve got that finished, run setup to enter the Devil Linux System Con-
figurator menu. The main System Configurator screen is shown in Figure 13-1.
Although most menus are self-explanatory, the following descriptions walk you
through a few of the more important menus.
First I recommend that you set the root password (the LoginPW option); you
don’t want to have a firewall with a blank root password, right?
After that, it’s time to move on to the basic configuration. Select the Basic
option from the System Configurator menu shown in Figure 13-1. The Config Menu
screen appears as shown in Figure 13-2.
In the basic configuration, you can configure the host name, time zone, key-
board layout, and so forth. Go ahead and set up the system the way you like it, and
press Back when you’re finished.
CHAPTER 13 Customizing a Firewall Live Linux CD 351
NOTE
Don’t let the fact that Devil Linux uses text menus scare you off; a lot of users
expect a graphical user interface, but there’s nothing inherently difficult
about using a text-based menu. Besides, you’ll spend very little time in the
configuration menu, so when everything is set up as you like it, you probably
won’t need to see the configuration screen again for a very long time.
Most of the defaults in the basic configuration menu are probably safe to use. Be
sure to change the host and domain names to reflect your network, though. As you can
see in Figure 13-2, I’ve set the hostname (Kodos), domain name (zonker.net), and time-
zone (America/Denver). You can also set the logging level, mouse device, and so forth.
The next step is to configure services. If you’re just running a firewall, the
default set of services will probably be fine. However, if you want to be able to run
cron jobs, an SSH daemon, or other services, or maybe remove IPv6 support, you’ll
need to configure the services here. From the System Configurator main menu,
select Services. Available services are listed as shown in Figure 13-3.
FIGURE 13-3 Turn on system services for your firewall from the
System Configurator Services menu.
As you can see in Figure 13-3, there are quite a few available services to
choose from. Very few, if any, additional services should be turned on for a firewall.
I do recommend setting up SSHD, though, if you plan to administer the firewall
CHAPTER 13 Customizing a Firewall Live Linux CD 353
remotely. My firewall doesn’t even have a keyboard or monitor attached to it; I do all
the administration via SSH after its set up.
You’ll also need to set up your network devices, naturally. From the System
Configurator main menu, select NET. The Networking Menu appears as shown in
Figure 13-4.
One of the reasons I like Devil Linux is that it’s better suited to more complex
network setups, such as three-NIC configurations that provide a DMZ, instead of
the standard two-NIC configurations that provide only a single barrier between the
LAN and the Internet.
As you can see on the Networking Menu in Figure 13-4, you have several
options here. You can choose a two-card Local LAN configuration or a DMZ setup
with three interfaces. You can set up the interface to each card individually.
As you can see, Devil Linux makes it easy to set up a basic firewall framework
with the FW2 and DMZFW3 options. Unfortunately, it doesn’t make it easy to set up
the NICs. On systems I’ve tested, Devil Linux doesn’t autodetect network cards, so
you have to explicitly tell Devil Linux what modules to use for the cards.
Because users rarely know exactly what model network card they have, and
because the name and model number of the card might or might not bear any
resemblance to the actual module name, this can be a bit tricky. I recommend boot-
ing the computer using another live CD, such as Knoppix, and then seeing what
354 Live Linux CDs
module it uses to fire up the NICs. (Type lsmod and lspci -v to get information
about your network interface cards.)
Go ahead and set up the NICs (remember, it’s a pain the first time, but you
shouldn’t have to do it again) and then go back to the main configuration.
Now it’s time to save your configuration and reboot. After you reboot, you
should be ready to set up your firewall rules. You can save the configuration via
the text menu or using the save-config command. You’ll want to use the menu
option for the first go and use the save-config option after configuring your fire-
wall rules.
The configuration is saved under etc.tar.bz2 on the hard drive or other media.
This will come in handy later because you can do away with the need for a hard
disk, floppy drive, or USB key by copying that to another system and creating a new
CD-ROM with the configuration already available on it. Devil Linux includes scp,
so you can just use scp to send the file to another machine.
However, Devil Linux might not mount the drive, so you’ll need to mount it
before you can copy the file. Assuming that your media is the first partition on the
first IDE drive, for example, you would use this:
# mount -t ext3 /dev/hda1 /mnt
Then use cd to change to the /mnt directory and use scp to copy the file to
another host:
# scp etc.tar.bz2 username@host:/home/username/
We return to that in a bit when we discuss making a custom CD. Now it’s time to
set up firewall rules.
Ubuntu and Debian users can grab Firewall Builder by running this:
# apt-get update
# apt-get install fwbuilder
This also grabs any dependencies you might need for Firewall Builder.
Firewall Builder has three templates that should get you started: a basic set of
firewall rules that allows connections to the firewall only from the internal LAN and
only via SSH, a more complex set of rules that also allows the firewall to serve as a
DHCP and DNS server for the internal network, and a set of firewall rules with a
DMZ for a machine with three interfaces.
The templates assume a couple things: first, that you want to use the
192.168.1.0 private subnet, and, second, that you’re pulling your IP address on the
Internet-facing interface using DHCP.
Firewall Builder is a bit too complex to cover in depth here, but it’s not too dif-
ficult to use. You should be able to master it in an afternoon if you are at all famil-
iar with networking. When you have your firewall configuration, you can use
Firewall Builder to publish it to the firewall and then save the configuration.
CREATING A NEW CD
The Devil Linux distribution ships with a script called custom-cd. You might think
that mastering a new CD would be a royal pain, but it’s actually quite easy and takes
only a few minutes, at worst. Note that you’ll need to either be running as root or use
sudo to run the script because you’ll need to mount a directory for the ISO image
while the new one is created.
Earlier in the chapter, we discussed saving the configuration to another
machine so you could create a new Devil Linux CD with your custom configuration.
We use that as an example of how to create new CDs. You can also use this process
to add software or replace other configuration files or packages.
To start, you need to be in the Devil Linux directory, which should be something
like /home/username/devil-linux-1.2.10-i586-SMP/. (This differs based on the
version of Devil Linux that you are using.)
Now create a directory called new to hold any new files that need to be added to the
ISO image. Note that you need to replicate the CD-ROM structure under the new direc-
tory, so if you want to add a file under, say, /home, you would add it under /new/home.
To replace the Devil Linux default configuration, place the etc.tar.bz2 file you
created earlier under the new directory, and make sure you have a directory under
/mnt (or anywhere, really, but /mnt is standard) for the script to mount the ISO
356 Live Linux CDs
image. I usually just use devil, which is what the script defaults to, but you have
the option of giving it a different name if it suits you.
Now run ./custom-cd as root, or sudo ./custom-cd if you use a distro such as
Ubuntu that doesn’t use the root account by default.
You’ll see a series of prompts:
jzb@kang:~/local/devil-linux-1.2.10-i586-SMP$ sudo ./custom-cd
Enter location of existing CD drive or ISO image [./bootcd.iso] ->
Enter your new ISO image [./bootcdnew.iso] -> ./newboot.iso
Enter where to mount your CD/ISO [/mnt/devil] ->
Enter location of directory with new files [./new] ->
Enter temporary location to hold the files [./tmp11832] ->
Notice that I changed the name of the new ISO image to newboot.iso instead of
bootcdnew.iso because I already had a bootcdnew.iso.
Then you’ll see a bunch of status messages and a mkisofs message about the
options used. You can safely ignore these. At the end, you should get a final mes-
sage saying that the new ISO image has been created.
Depending on the speed of your machine, it can take 5 minutes, or it can take
considerably longer. On my Athlon 64 3000+ with 2GB of RAM, it takes about 5 to
10 minutes to generate a new ISO image.
You definitely want to be sure that you’ve got the configuration that you want
before you burn the ISO image to CD-R. Descriptions in Appendix B, “Building,
Testing, and Burning ISOs,” can help you use QEMU or VMware to test your Devil
Linux ISO image. Refer to this appendix for information on burning the ISO image
to CD.
SUMMARY
As you can see, the live CD format is ideal for some firewalls and routers. Devil
Linux, in particular, is great for any situation when it’s necessary to customize the
live CD.
In this chapter, we covered basic use of Devil Linux, configuration of a new
firewall, and how to modify and update the Devil Linux live CD. Using the informa-
tion in this chapter, you should have no problem building your own live CD based
on Devil Linux.
Although Devil Linux isn’t the only game in town, it is one of the most flexible
and relatively easy to use. If you’re fairly familiar with Linux, it will probably take
you the better part of an afternoon to use Devil Linux to create a customized fire-
wall CD.
This page intentionally left blank
CHAPTER 14
Imagine that you have an office full of computers that are used only from about
9 a.m. to 5 p.m. That’s a lot of computer power going to waste, and there’s an easy
way to harness the horsepower of those computers the rest of the day using live CD
clustering distributions.
If you’re looking for a way to create a quick-and-dirty cluster, a live CD is defi-
nitely the way to go. You can pop a CD into each machine’s drive and reboot, and
use it for a few hours (or a few days, and make the most of a long holiday weekend!).
When your computing task is finished, reboot the machine, pop out the CD, and
you’ve got the PC’s original operating system available, untouched by the cluster
operating system.
For really hardcore computing tasks, you probably don’t want to use a cluster
live CD; if you’re doing work for the Department of Defense doing battlefield simu-
lations or something equally computationally intensive (not to mention high
budget), you’ll probably want to go ahead and install the operating system directly
to the hard drive. In fact, in that sort of scenario, you’d probably be working with a
vendor or IT department that would supply its own customized version of Linux.
This chapter discusses basic clustering concepts in general and looks at the
options for live CD cluster distributions.
WHAT’S A CLUSTER?
Let’s start this chapter by discussing what a cluster is and what you can accomplish
with a live CD distro to be used for creating a cluster of computers.
359
360 Live Linux CDs
The simplest definition of a cluster is two or more computers that are connected
and that work together. Clustering is used for many different reasons. A cluster can
provide high availability, load balancing, high-performance computing, and utility
or “grid” computing facilities. Note that these functions are not exclusive, so a clus-
ter can provide high performance and high availability, or high availability and
load balancing.
Load Balancing
Sometimes a task is just too difficult for one server to take on, no matter how much
horsepower that server has. Consider a popular site such as Slashdot; the traffic it
handles is far too much to be handled by a single server.
A load-balancing cluster spreads the computing load across two or more com-
puters. Sites such as Slashdot have several Web nodes and database nodes to han-
dle requests. Usually a load-balanced cluster is also an HA cluster—that is, if one
node in the cluster fails, the application that the cluster provides does not fail. It
might take a performance hit, but it won’t fail when one node drops out.
Grid Computing
Grid computing, also called “utility” computing, is similar to HPC and load balanc-
ing, but the difference is that grid computing often makes use of nondedicated
machines. For instance, the SETI@home project uses a client on the computers of
volunteers to search radio transmissions for signs of intelligent life in the universe.
(We’ve ruled out Washington D.C., and have the rest of the universe to search!)
Now that we have our terminology straight, it’s time to look at ParallelKnoppix.
PARALLELKNOPPIX
ParallelKnoppix, or PK, is a modified Knoppix live CD designed for use in creating
HPC clusters. In this section, we look at how to start up PK on multiple nodes to run
a cluster, and how to customize PK to add or remove applications. We also review
some of the applications present on the live CD and when you might want to use PK.
Starting ParallelKnoppix
ParallelKnoppix is contained on the DVD that comes with this book. Refer to
Appendix A, “On the DVD,” to learn how to get and boot ParallelKnoppix. After it’s
booted, ParallelKnoppix appears as shown in Figure 14-1.
In Figure 14-1, you can see the PK boot screen. To start PK, just press Enter,
unless you need to pass boot options to the kernel to get it to boot. For example, you
might want to pass the acpi=no argument to the kernel if you have had problems
getting PK (or other live CDs) to boot.
PK can also be used to run memtest to check the system memory. This is a good
idea if you have any problems with the machine that you can’t track down, such as
programs crashing for no apparent reason.
After ParallelKnoppix has started, you might notice that it seems to be missing
the menu bar. Actually, ParallelKnoppix has a taskbar, but it’s hidden. Move the
mouse to the bottom of the screen, and you’ll see the taskbar after it unhides. In
Figure 14-2, you can see the KDE taskbar, and PK’s documentation in Konqueror.
362 Live Linux CDs
FIGURE 14-2 The ParallelKnoppix desktop with KDE taskbar and Konqueror.
CHAPTER 14 Customizing a Cluster Live Linux CD 363
If this behavior annoys you as much as it does me, you can just right-click the
taskbar and select Configure Panel. Then you’ll see the Configure KDE Panel dia-
log, and on the left side you’ll see Hiding. Click that and deselect Hide Automati-
cally under Hide Mode.
NOTE
ParallelKnoppix assumes that you’ll be able to pull an IP address via DHCP.
If you’re not running DHCP on your network, you can open a terminal and
use su - to switch to root. ParallelKnoppix has no root password, by
default.
Then run the following to set up your IP address:
# ifconfig eth0 10.0.0.10 netmask 255.0.0.0 gw 10.0.0.1
Of course, you’ll want to change the values to reflect your network setup.
This will give you a 1GB swapfile; adjust the count to reduce or increase the
size of the swap. Note that the general rule of thumb is to have twice the amount of
system RAM—at least, that used to be the case before 1GB and more of RAM
became common. If you’re using swap enough to need more than 1GB of swap, you
probably need more RAM than a bigger swapfile. Remember, accessing swap is
much, much slower than accessing RAM.
Now you need to format the file as swap and tell the system to use it:
# cd /media/hda1
# mkswap swapfile.swp
# swapon swapfile.swp
364 Live Linux CDs
That’s all there is to it. When remastering the system, you might want to make
sure that you set up the swapfile permanently in /etc/fstab. To do this, you add a
line like this:
/dev/hda1/swapfile.swp none swap sw 0 0
Saving Settings
One of the annoying things about a live CD distro is that all your hard work disap-
pears into the ether if you reboot the machine—unless you have a way of saving
your settings, at least. PK gives you a way to do this quickly and painlessly.
Go to the ParallelKnoppix menu and look for the Save PK Configuration menu.
The Create PK configuration archive dialog appears as shown in Figure 14-3:
This dialog walks you through a series of options to save your personal configu-
ration, network settings, printer settings, and whatnot. In Figure 14-3, I’ve asked
PK to save my network settings, desktop files, and personal configuration. I don’t
worry about the X configuration because I may want to use the configuration on a
machine with a different video card.
CHAPTER 14 Customizing a Cluster Live Linux CD 365
FIGURE 14-3
Save settings from the
ParallelKnoppix Create
PK configuration archive
dialog.
First, the dialog asks what settings you want to save and then asks where you’d
like to save the information. PK is a bit dumb here—note that in Figure 14-4 it
shows an option to save the configuration to a floppy drive, whether or not one
exists! Make sure you verify where you want the file saved to. After you have cho-
sen what to save, the dialog asks you where you want to save the configuration files,
as shown in Figure 14-4.
FIGURE 14-4
Selecting a partition to save
the information.
recent Linux distro, odds are, your distro has a Qemu package available. Ubuntu
users, for example, can install Qemu by running the following:
# apt-get update
# apt-get install qemu
The -m option tells Qemu how much RAM to allocate for the virtual machine.
You probably want to allocate at least 384MB of RAM, and more if your machine
has enough RAM to spare. (If you’re running on a machine with less than 512MB of
RAM, running things under Qemu might not make sense.) The -cdrom option tells
Qemu to use an ISO image to boot from.
Note that Qemu is not as high performance as VMware Player, Server, or Work-
station. You might want to download VMware Server or Player if you want to play
with ParallelKnoppix for any amount of time. VMware is also described in Appen-
dix B.
Go to the ParallelKnoppix menu option on the KDE menu, and select Setup
ParallelKnoppix. PK will launch the cluster configuration dialog.
Next, tell PK how many nodes, maximum, you want to allow in the cluster. I
have about 12 computers on my home network at any given time, but I never use all
of them simultaneously, so I usually say 10 here.
After you’ve selected the number of nodes, you have to choose the network card
you want to use. This can be handy; if you have a system with two (or more) network
cards, you can let it remain connected to your main network while keeping one
interface on the LAN.
PK should autodetect the interface that you want to use here, so it’s probably
okay to accept the default. Next, PK asks if you want to provide any boot options.
Again, unless there are any specific options, you can probably accept the default.
PK will also ask what network card(s) to support on the slave nodes. Just accept
the default here, because we’re going to boot from the PK disc and it should support
just about any Linux-compatible network card without help from the master node.
NOTE
Technically, you can boot the slave nodes using PXE boot rather than using
a PK disc—but, because many computers don’t support PXE, I’m going to
stick with the tried-and-true method of using a PK disc here. If your systems
support PXE, you can try booting using PXE and let the systems boot
entirely off of the master system.
Next, select media that can be read-write. Your master machine will need to
have a hard disk with space it can write to, your slave nodes will not need a hard
drive unless you would like them to have swap space (which is probably a good
idea). This will be a working directory for all the nodes that will be shared via NFS.
After this step, PK will be ready to accept compute nodes to the cluster.
After your master node is ready, it’s time to boot the rest of the computers. Pop
a PK disc into the slave node(s) and boot them up. If you have everything config-
ured properly—the master node is running and waiting for slave nodes, and they’re
on a network separate from other DHCP servers—the remaining nodes should auto-
matically configure themselves as slave nodes without any intervention on your
part.
Re-run the StartHPC script, and it will add waiting nodes to the cluster. You’ll
see a dialog labeled tkping, and it will show green blocks for each node that’s
attached to the cluster, and red blocks for open slots in the cluster.
This will fire up POV-Ray, and tell it to render the scene in mediasky.pov.
Depending on how many nodes you have and how fast they are, this can be done in
a minute or so or it may be done in a few seconds. With two compute nodes, it takes
about 45 seconds in my test environment.
NOTE
POV-Ray, the Persistence of Vision Raytracer, is a program that creates 3D
scenes and graphics. It’s capable of some stunning images—but they can
take a very long time to render using a single computer. Using PK, you can
render images much, much faster.
Another way to monitor and manage your cluster is to use XPVM, which is a
GUI manager for the Parallel Virtual Machine (PVM). PVM is the software that
allows your cluster to be used as a single virtual machine. XPVM provides an easy-
to-use interface for PVM.
CHAPTER 14 Customizing a Cluster Live Linux CD 369
Open a console on the master node and run xpvm. This fires up the XPVM inter-
face, which shows all the attached nodes and their states.
To run a program across the nodes, click the Tasks button and select SPAWN.
You’ll see a dialog with a field labeled Command. Put the PVM-compatible command
in the command field and click Start. (When you’re starting out, you can probably
just accept the defaults here.)
Note that programs have to be compiled with PVM in mind to be used with
PVM/XPVM. For example, POV-Ray is designed to use PVM, but Firefox or the
Gimp aren’t—so they won’t run under PVM.
To test XPVM, go ahead and do another POV-Ray test run using the following:
# cd /usr/share/doc/povray-3.5/examples/advanced/
# povray +N mediasky.pov
Note that you can take nodes out of use with PVM if you want to run a job with
just a fraction of your compute cluster. Go to the Hosts menu and unselect any hosts
that you don’t want to use. (You can bring those nodes back online by reselecting
them.)
That’s really all there is to it. And you thought running a cluster would be hard!
REMASTERING PARALLELKNOPPIX
According to the PK notes, you need at least 2GB free to remaster PK to create a
new disc. That’s a very, very optimistic estimate, and I’ve found that you’ll probably
want to go with at least 4GB. Given today’s humongous disk drives, it shouldn’t be
too difficult to scrape up a disk with at least that much space free for remastering.
NOTE
Here’s one helpful hint: If the system you’ll be remastering PK on is a system
you use for day-to-day work, copy the files or packages you want to use to
your file system before rebooting into PK. That way, you can just copy them
over into the PK file system after rebooting instead of having to download
them while running PK.
370 Live Linux CDs
The version of ParallelKnoppix I have been testing had a slight error in the sec-
ond script, the 2-StartCHROOT script, located in the /home/knoppix/Desktop/
ParallelKnoppix/Remastering directory. On line 72, the path to xterm is listed as
/usr/bin/X11R6/xterm. This is incorrect; it should be /usr/bin/xterm. Open the
file in vi (or your preferred editor) and modify that line. After you modify the line, it
should run fine. This might be fixed by the time this book is published, so give it a
shot and see whether it works before modifying the script.
Start the process by going to the KDE menu q ParallelKnoppix q Remastering
q 1-CopySourceForRemaster entry. Here you’ll get a dialog similar to the one
shown in Figure 14-5, asking where you want to save the source for remastering.
FIGURE 14-5
Select media to copy the
ParallelKnoppix source to.
Again, be sure to check for free space. Remastering ParallelKnoppix can take
more than an hour, and you don’t want to get to the middle of the process and find
out you’ve run out of room!
Now run the 2-StartCHROOT script, either from the command line or from the
ParallelKnoppix menu, and you’ll be dropped into the chroot environment and be
able to make changes, including adding and removing packages using dpkg, or
adding users, modifying the root password, and so forth. For instance, let’s say you
want to add Firefox. The best way to do that is to grab the official Firefox distribu-
tion from Mozilla.com and then copy it into the chroot system.
Figure 14-6 shows the Get into CHROOT Environment dialog. This lets you
select which disk and partition to use for the CHROOT environment.
CHAPTER 14 Customizing a Cluster Live Linux CD 371
FIGURE 14-6
Select the partition for the
chroot environment.
Now, when you’re in the chroot environment, you’re limited on what you can
do, so it’s best to copy it into the directory beforehand. Let’s say you’ve selected
the first partition on an IDE drive to copy the PK source to. This would be
mounted as /media/hda1. You will find the PK source under /media/hda1/
parallel_knoppix_remaster/source/KNOPPIX. When the chroot is started, this
will be the root directory, and all the rest of the file system lives under here.
If you want to copy a few files into /etc on PK, you copy them to /media/hda1/
parallel_knoppix_remaster/source/KNOPPIX/etc, and so forth.
For instance, let’s say you want to add the very latest version of a program to
your PK system. You can copy a Debian package into the chroot file system and
install it there, or compile the source, give the root user a password, or whatever you
want to do.
When you’re finished, you’ll be able to create a new ISO image by going to the
KDE menu q ParallelKnoppix q Remastering q 3MakeISO. This runs a script to
create an ISO image out of the file system that PK created after copying the source
from the original ISO to the file system.
As I mentioned earlier, PK will run under Qemu. PK offers to let you test out
your shiny new ISO image under Qemu if you want, or you can just press Ctrl+C to
exit and collect your ISO image to burn it to CD.
The ISO image can be found under /media/hda1/parallel_knoppix_remaster/
as parallelknoppixhomebrew-XXXX-XX-XX.iso, where XXXX is the year and XX-XX is
the month and date.
372 Live Linux CDs
SUMMARY
In this chapter, we looked at the ParallelKnoppix live CD that can be used to create
HPC clusters. As you can see, PK is very versatile, easy to use, and probably one of
the best cluster live CDs available.
Although you probably wouldn’t want to use PK to break into the Top 500, it’s
definitely suitable for a number of other tasks when a temporary cluster will do. PK
is also the best choice for a cluster CD because it’s well maintained and develop-
ment is steady; many of the other cluster CDs are out-of-date and don’t seem to be
well maintained.
With the remastering capabilities, PK can be almost anything—the only limit is
your imagination.
LIVE LINUX CDS
Part IV
Appendices
373
This page intentionally left blank
APPENDIX A
On the DVD
A special live DVD included with this book features the contents of more than a
dozen live Linux CDs. Those live CDs come in the following forms:
■ Directly bootable—By adding a new boot screen, creating special boot
options, and doing a bit of remastering, I’ve created a DVD that (from the
boot prompt forward) lets you launch about a half dozen of the live CDs
included on the DVD.
■ ISO images—For all the live CDs included with this book, there is an ISO
image included that you can burn to CD. If you have a blank or rewritable
CD, you can burn any of those ISO images to CD and boot them separately.
Use any of the live CDs you fancy that boot directly from this DVD to see how
they work. As for the ISOs included for the live CDs, you can burn them to CD or
DVD (using tools such as cdrecord and K3b, described in Appendix B, “Building,
Testing, and Burning ISOs”). In most cases, you should use the CDs you burn to
build and remaster your own live Linux CDs.
NOTE
One item on the DVD that doesn’t fall into either the boot directly or ISO
image areas is the kadischi RPM package. Because the Kadischi project,
which is used to create live CDs based on Fedora Linux, is still in early devel-
opment, there is no official software package available for Kadischi.
For that reason, I created a kadischi RPM file for this book and placed it in
the /RPMS directory on the DVD. Chapter 7, “Building a Basic Fedora Live
CD,” describes how to use this RPM.
375
376 Live Linux CDs
TABLE A-1 Labels for Booting Different Live CDs from the DVD
You can add boot options, if you like. Any boot options available from the live
CD selected should be available by typing the options after the label noted
earlier.
To exit most of the live CDs included, you can select a shutdown option from
the desktop. Entering Ctrl+Alt+Delete or init 0 (as root user) should work as well.
Sometimes you can simply turn off the computer. However, you should unmount any
file systems you have mounted before you just press the off switch.
NOTE
Many Linux live CD projects are maintained by individuals outside of their
regular places of business. Most offer ways for you to contribute money or
expertise to help advance the projects. I encourage you to donate whatever
you can to the projects you like, to help those projects improve and grow.
To use any one of the live CDs that come with this book, do the following:
1. Insert the DVD into the DVD drive on your PC with any operating system
running that includes CD-burning software. The operating system can be
Windows or Linux. (As an alternative, you can boot the DVD itself and use
Knoppix or one of the other live CDs to do this procedure.)
2. Copy the ISO for the live CD that you want to use to a folder on the hard
disk. With an installed operating system running, copy the live CDs from the
/distros directory. With a live CD running from the DVD, look in /cdrom/
distros. (If you have two CD/DVD drives, you can probably skip copying the
ISO you want to hard disk and burn the ISO directly from your DVD to the
writeable CD drive.
3. Eject the DVD and insert a blank or rewritable CD into the DVD/CD drive.
4. Burn the ISO image to CD, using a tool such as cdrecord or K3B.
5. Try the live CD by inserting the newly burned CD into any PC and reboot-
ing it.
The following sections describe the live CDs that have ISO images included on
the DVD.
About Knoppix
Knoppix is the premier desktop live Linux CD. The home page for Knoppix (in Eng-
lish) is www.knopper.net/knoppix/index-en.html. From there, you can get informa-
tion on what Knoppix contains, how to use it, and how to download or purchase it.
The Knoppix.net site includes a great deal of information and an active commu-
nity related to Knoppix. There you can find documentation, forums, and download
information.
The ISO image for the English version of Knoppix 5.0.1 is included in the
/distros directory on the DVD (KNOPPIX_V5.0.1CD-2006-06-01-EN.iso).
APPENDIX A On the DVD 379
About MoviX2
MoviX2 is part of the MoviX project (http://sourceforge.net/projects/movix) and can
be used to play movies, music, and images. You can get information about MoviX2,
as well as the related eMoviX (for creating bootable movies), from that site. You can
also find forums and screenshots and download information from that site.
The DVD that comes with this book includes a zipped archive of MoviX2
(movix-0.3.1rc2-iso.zip) that contains the MoviX2 ISO image (movix2-0.3.1rc2.iso)
and some useful README files. Use the unzip command to unzip the archive.
Then burn the ISO image to CD.
About BackTrack
Information about the BackTrack network security suite live CD is available from
the Remote Exploit site (www.remote-exploit.org). Refer to that site for developer
information, as well as news, tutorials, and ways of donating to the BackTrack proj-
ect. BackTrack 1.0 (backtrack-v.1.0-260506.iso) is included in the /distros direc-
tory on the DVD.
About GeeXboX
GeeXboX (www.geexbox.org) is a tiny multimedia player live Linux CD, created
particularly to play movie DVDs and music CDs. To use GeeXboX, burn the ISO
image of GeeXboX version 1.0 (geexbox-1.0-en.i386.iso) from the /distros directory
to a CD. The GeeXboX Generator (geexbox-generator-1.0.i386.tar.gz) is also
included in the /distros directory. You can use GeeXboX Generator to create your
own live CD that includes audio and/or video content you choose, as described in
Chapter 12, “Customizing a Multimedia Live Linux CD.”
380 Live Linux CDs
About ParallelKnoppix
Create HPC clusters with ParallelKnoppix (http://idea.uab.es/mcreel/Parallel-
Knoppix). The ParallelKnoppix live CD is included in the /distros directory on the
DVD that comes with this book (parallelknoppix-2006-06-19.iso).
APPENDIX A On the DVD 381
When you have all the pieces of a live CD in place, you can gather those pieces into
a bootable ISO image from Linux typically using the mkisofs command. That ISO
image can then be shared from software repositories and run by either of these ways:
■ Starting the ISO image from an emulator—A convenient way to try an
ISO image is to run the ISO image from the local file system using a CPU
emulator. Popular emulator software includes VMWare and Qemu. Because
Qemu is available with most of the Linux distributions described in this book
(and works well in most cases), this appendix primarily describes how to use
Qemu to test the ISO images you build. A short description of how to get and
use the VMWare Player is also included.
■ Burning the ISO image to bootable media—Because the live Linux
ISO image is intended to be bootable from a removable medium, the last step
in producing a live Linux system is to burn that image to CD, DVD, or other
removable boot medium. This appendix describes how to use tools such as
the cdrecord command and K3b graphical utility to burn ISO images to CD
or DVD.
Utilities for making ISO images (mkisofs command), testing ISO images before
burning (qemu), and burning them to media (cdrecord and K3b) are noted in proce-
dures throughout the book. However, because those utilities have more features
than the few that are mentioned earlier, you can use this appendix as a reference for
expanding ways of building, testing, and burning your ISO images.
383
384 Live Linux CDs
NOTE
Refer to Chapter 4, “Understanding How Live Linux CDs Work,” for infor-
mation on what the El Torito specification is and how it is used to make
bootable live Linux CDs.
Using mkisofs
The mkisofs command is noted in several places in this book as the last step in pro-
ducing a live CD. The following command line shows many of the common options
you might add to a mkisofs command when you produce a live Linux CD.
# mkisofs -R -b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 8 -boot-info-table . > ../livecd.iso
In the example of mkisofs just shown, you are starting with the following
assumptions:
■ Live CD directory structure—The dot (.) indicates that the directory
structure of your live CD starts at the current directory and its subdirectories.
Unless told otherwise (and it’s not in this example), all files and directories
below that point go into the resulting live CD ISO image.
■ Isolinux files—The Isolinux files (isolinux.bin and isolinux.cat) are in
a subdirectory of the current directory named isolinux.
■ Live CD image—The final live Linux CD ISO image files are named
livecd.iso and are placed in the directory above the current directory
(> ../livecd.iso).
The locations of those files just mentioned can vary, depending on your setup.
Also, instead of directing the output of mkisofs to a file using the less-than charac-
ter (>), you can use the -o file option to indicate the name and location of the
resulting ISO image. You also have the option of piping the output of mkisofs
APPENDIX B Building, Testing, and Burning ISOs 385
directly to the cdrecord command. The method for doing that is described later in
this section.
You need to supply the El Torito boot image (-b image option) or use the
isolinux.bin boot image that comes with the isolinux software package (which
most people do). If you are using the GRUB boot loader, an El Torito boot image
comes with that package as well. The boot catalog (-c catalog) is produced during
the mkisofs process.
Because the ISO 9660 images originally included only DOS-style file naming,
extensions need to be added to allow such things as longer filenames, UNIX-style
user and group information, symbolic links, block and character devices, and per-
mission bits. The -R option generates System Use Sharing Protocol records (SUSP)
and Rock Ridge Interchange Protocol (RR) records to add this information to files
that need it on the live CD.
Instead of the -R option, you can use the -r option, which changes permission
and ownership to be restrictive in a way that makes sense for a read-only file sys-
tem. Ownership and group are assigned to the root user. If execute permission is
assigned to a directory, to allow searching of that directory, the execute bit is
assigned to all directories above that point as well.
The -no-emul-boot option prevents hard disk or floppy emulation from being
used to create the boot image. The -boot-load-size 8 option tells mkisofs to load
the image into eight 512-byte sectors. The -boot-info-table option instructs
mkisofs to modify the boot file indicated by the -b option.
In this example, all files ending with .junk would be excluded, as would all
files named core or whatever. Instead of excluding files on the command line, you
could add all the files you want excluded to a list and give that list to the mkisofs
command using the -exclude-list option, as follows:
-exclude-list filename
386 Live Linux CDs
Although it seems easiest to keep all the files for your live Linux CD in one
directory structure, mkisofs enables you to merge files from multiple paths. Instead
of just changing to the root of the master directory containing your complete live CD
directory structure and identifying it with a dot (.) on the mkisofs command line,
you could add multiple paths to the end of the mkisofs command line. Files from
each of those paths would be added starting from the root of the live CD’s file sys-
tem. For example:
# mkisofs [options] /home/chris/master /home/chris/stuff > livecd.iso
Another way to add files to your live CD without having them exist in the live
CD directory structure is to use the -graft-points option to graft files or directories
into your live CD at other points in the file system than the root directory. For exam-
ple, if you wanted to add photos from the /home/a/image directory to a directory
called data/photos on the live CD, you could use mkisofs with the following option:
# mkisofs [options] -graft-points /data/photo=/home/a/image > livecd.iso
I have used this option myself to drop a changing set of images I download from
my digital camera to a live CD without changing the structure of my live CD remas-
tering directory. (See Chapter 10, “Customizing a Presentation Live Linux CD,” for
an example of how you can graft a directory of images into your live CD.)
This is useful if you are creating a set of live CDs. The option might be set as
in this example:
-volset "This is 1 of 5 live CDs showing live Linux solutions"
If you burn your ISO to CD using K3b, as described later in this chapter, you can
see this information you added to the volume header. If you had used the options
shown in the earlier examples, when you load the image to K3b for burning, the
header information will appear as shown in Figure B-1.
As you can see, the system automatically filled in the image type (Iso9660
image), the size of the image (633.4MB), and the system ID (LINUX). The system ID,
volume ID, volume set ID, publisher ID, and preparer ID all came from the mkisofs
options just described. The other information shown includes the application ID
(indicating that mkisofs created the ISO) and the MD5SUM (which is checked on
the fly when the ISO image is read by K3b).
If you are preparing a lot of live CDs—say, for your company or organization—
you might want the same header information included in all the live CDs you pro-
duce. You can use a .mkisofsrc file to set these values. The mkisofs command
checks the current directory, then your home directory, and then the directory
where the mkisofs command is located to find a .mkisofsrc file.
This example of a .mkisofsrc file contains the tags that can be used instead of
the mkisofs command-line options. To see how those tags can be used to provide
the same information shown in Figure B-1, that information has been added to the
tags as shown here:
388 Live Linux CDs
PREP="www.example.com"
PUBL="Acme Widgets"
VOLI="LiveLinuxCD"
VOLS="Acme Widgets Live CD set. This is 1 of 5 live CDs showing live
Linux solutions."
Other tags you can use in a .mkisofsrc file include APPI (to set an application
identifier of up to 128 characters), COPY (to add up to 37 characters of copyright
information), ABST (to identify a file on the disk containing an abstract with the
disk’s contents), BIBL (to add up to 37 characters of bibliographic information), and
SYSI (to change the SYSI to something other than LINUX).
Here’s one last, extraneous use of the mkisofs command that you might need to
use. If you are going to pipe the output of mkisofs directly to cdrecord, some CD
writers (and some writing modes) need to know beforehand the size of the ISO
image. The form of that command would then be something like the following:
# mkisofs options | cdrecord options -
Along with the other mkisofs and cdrecord options you enter, you need to pass
on the size of the image file to cdrecord using the tsize=#s option, where # is
replaced by the number representing the size of the resulting ISO image. To get
the number that cdrecord needs (the number of 2048-byte sectors), add the
-print-size option to the mkisofs command line you are about to run. For example:
Using this example, when you go to run cdrecord (or when you pipe the output
of mkisofs to cdrecord), you can add the following value to the cdrecord command
line:
tsize=324323s
Many other options are available with the mkisofs command. To read about
those options, refer to the mkisofs man page (man mkisofs). Alternatively, you can
run mkisofs with the -help option (mkisofs -help).
The system being emulated is either a standard PC with an IDE bus or a PC with an
ISA bus (by adding the -M isapc option).
QEMU can operate in user mode (allowing it to run processes created for one
CPU type on a different CPU) or full system emulation (emulating the CPU and key
peripherals). Often people use QEMU in user mode to run WINE, allowing them to
install and run Windows applications, or DOSEMU, to run DOS applications. How-
ever, for the purposes of testing live CD ISO images, this book describes QEMU in
full system emulation.
For the Linux distributions described in this book, prebuilt binaries are avail-
able for QEMU. With an Internet connection, you can install binary packages of
QEMU from Debian/Knoppix, Fedora, and Gentoo, respectively, using the following
commands:
# apt-get install qemu Debian-based systems like Knoppix
# yum install qemu Fedora-based systems
# emerge qemu Gentoo systems
If you prefer, you can also install QEMU from source code. QEMU source code
is available from the QEMU download page (http://fabrice.bellard.free.fr/qemu/
download.html). From that same page, versions of QEMU also exist for Windows
and Mac OSX. (See the “Using QEMU in Windows” section later in this appendix.)
To enhance the performance of QEMU, you can add a kqemu accelerator module
plug-in. Because it is available in binary form only (no source code available),
it is not distributed with some Linux distribution. For Fedora 5, check http://
fedoranews.org/tchung/qemu/ for information on the latest QEMU packages and the
location of the kqemu plug-in RPM package. If you get the source code from the
QEMU download page instead, you must follow additional instructions to install the
kqemu module and create necessary device files.
NOTE
VMware Player is another technology you can use to test ISO images on
your computer’s desktop. See the sidebar “Testing ISO Images with
VMware” for further information.
The command just shown tells the qemu command to boot the file image named
dsl-3.0.1.iso (from the current directory) and to boot it as an ISO 9660 CD image
(-cdrom -boot d). If you already burned the image to CD, you can insert that CD
into the drive and boot from it in QEMU using the following command line:
# qemu -cdrom /dev/cdrom -boot d
NOTE
Although we are focused on CD images for this book, QEMU can also boot
from hard disk. For example, if you had Gentoo installed on a second hard
disk (/dev/hdb) while you worked on Fedora from the first hard disk
(/dev/hda), you could launch Gentoo on your desktop by typing something
like the following:
# qemu -boot c /dev/hdb
The qemu command assumes you want to assign 128MB of your available mem-
ory as virtual RAM for qemu to run the live CD. If you have more available, you can
tell qemu to use more memory with the -m ??? option (where ??? is replaced by the
number of megabytes of RAM to use). For example, the following command boots
an image called myliveCD.iso with 512MB of memory:
# qemu -cdrom myliveCD.iso -boot d -m 512
If the amount of memory you want is not available, qemu simply fails and notes
the lack of memory.
You can use the QEMU monitor (Ctrl+Alt+2) as a way of sending commands
directly to QEMU itself (rather than the system you are booting). Ideas for using the
392 Live Linux CDs
Other commands are available from the QEMU monitor as well. To find out
about other commands, refer to the QEMU man page (man qemu) or the QEMU CPU
emulator user documentation (http://fabrice.bellard.free.fr/qemu/qemu-doc.html).
Figure B-3 shows an example of the Damn Small Linux desktop displayed in a
QEMU window on a Windows XP desktop:
If you switch to another live CD (copy a new one to livecd.iso), be sure to set the
VMware Player preferences (Select Player q Preferences) to power off the virtual
machine on closing. Otherwise, closing the old CD will simply suspend it, so it is
reopened the next time you start vmplayer. Figure B-4 shows the boot screen of a
slide show live CD I made of a trip to DisneyWorld. It is running in a vmplayer win-
dow using the VMwarez.com software described previously.
Every major Linux distribution that I know of includes the cdrecord command.
If you have a recent Linux distribution, it probably includes cdrecord 2.0 or later.
Jörg Schilling created cdrecord, but several Linux distributions (including Red Hat
Linux systems and SuSE) maintain their own versions of cdrecord.
Using default settings (set in the /etc/cdrecord.conf file), you aren’t required
to add a lot of options to cdrecord. The default drive is typically set to /dev/cdrom
in that file. If a writeable CD or DVD drive is your first drive, and that drive is not
being used currently to run a live CD, you might be able to burn an ISO image to
CD or DVD with just one option: the name of the ISO. For example, if your ISO
image were in the current directory and were named mylivecd.iso, you would
insert a blank CD or DVD into the drive and type the following:
# cdrecord mylivecd.iso
With the example just shown, when cdrecord completes, you can eject the CD
or DVD and you are done. If that doesn’t work, or if you want a bit more control over
the process, you can use one of many options to cdrecord.
You can get information about your writeable drives in several ways before pro-
ceeding. If you have multiple CD or DVD drives, you might need to indicate which
396 Live Linux CDs
one you want to write to. You can use a device name (such as /dev/cdrom) to indi-
cate the drive or the SCSI device name. To determine the SCSI device name for your
writeable CD and DVD drives, you can use the scanbus option, as follows:
# cdrecord -scanbus
Cdrecord-Clone 2.01-dvd (i686-pc-linux-gnu)
Copyright (C) 1995-2004 Jorg Schilling
scsidev: 'ATA'
devname: 'ATA'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.8'.
scsibus1:
1,0,0 100) 'LITE-ON ' 'DVDRW SOHW-1633S' 'BS0C' Removable CD-ROM
1,1,0 101) *
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1,7,0 107) *
In this example, only one CD/DVD writer is found, at the SCSI address 1,0,0.
That indicates SCSI bus 1, target 0, and LUN 0. So using the dev= option, you can
identify that device as either dev=1,0,0 or dev=/dev/cdrom on the cdrecord com-
mand line. The SCSI address form is preferred, for the simple reason that there is
no guarantee that the Linux system you are using will use /dev/cdrom to access the
CD drive you want.
To see a complete list of options, type cdrecord -help. To find the version num-
ber of cdrecord, use the -version option. For information on SCSI transport speci-
fiers, use the dev=help option. You can use the driveropts and -checkdrive
options to check for options that are specific to a drive. For example, to check
options for the drive located at /dev/cdrom, type the following:
# cdrecord dev=/dev/cdrom driveropts=help -checkdrive
.
.
.
Driver options:
burnfree Prepare writer to use BURN-Free technology
noburnfree Disable using BURN-Free technology
forcespeed Tell the drive to force speed even for low quality media
When no speed option is given, cdrecord tries the maximum speed that it can
detect is available for the drive and medium you are using. At times this value can
be incorrect, or you might be getting write errors and want to change the speed
yourself. In particular, I’ve noticed that the maximum speed for some DVDs is not
APPENDIX B Building, Testing, and Burning ISOs 397
detected properly; you might have to set the maximum writing speed yourself. To set
the speed to the lowest possible value, use speed=0.
Other popular options to the cdrecord command include the verbose option (-v)
and the eject option (-eject). If you are unfamiliar with the drive you are using, you
can do a test run using the -dummy options. Using cdrecord with -dummy goes
through all the motions requested on the cdrecord command line but doesn’t turn
on the laser and actually burn the disk. This command-line example includes sev-
eral of the options just described:
# cdrecord dev=/dev/cdrom1 speed=4 -eject -dummy -v mylivecd.iso
In the example just shown, cdrecord uses the second CD drive (/dev/cdrom1)
and a 4x speed (which is four times the audio speed). Verbose output is displayed as
the recording progresses. When the entire image has been burned to CD/DVD, the
disk is ejected.
You can choose from several writing modes. Most drives created after 1997 are
compliant with the Multimedia Command set 2 (MMC-2) specification, so they
should support at least one of the writing modes described. Consider these
examples:
NOTE
In cases noted shortly, when you need to know the exact size of each track
before you begin recording, you can determine that size when you run the
mkisofs command to create your ISO image. Adding the -print-size
option produces the information you need.
■ -sao—The Session At Once (-sao) mode is available only with MMC drives
that support this mode. To use this mode, cdrecord must know the exact size
of each track. This mode is also sometimes called Disk At Once mode (so
you can use -dao instead of -sao).
■ -tao—The Track At Once writing mode is used by default with cdrecord.
This mode is required if you are doing multisession recording.
■ -raw—Some CD recorders that have bad firmware won’t work in -sao or -tao
modes. In those cases, you might need to use the -raw writing mode. When
-raw is specified, it defaults to -raw96r. The -raw96r mode uses 2448-byte
sector sizes (from 2352-byte sectors and 96 bytes of raw P-W subchannel
data). Other raw modes include -raw16 (2368-byte sector size, from 2352-
byte sectors plus 16 bytes of P-Q subchannel data) and -raw96p (same size as
-raw96r, used only in a few CD recorders). Either -raw96r or -raw16 should
be used in most cases when you want to write in raw mode.
398 Live Linux CDs
If you are using a rewriteable CD medium (which is a good idea as you test your
live CDs repeatedly), you can use a blank option with cdrecord to erase your CD
before rerecording. To blank an entire disk, use blank=all, blank=disc, or
blank=disk. For a quicker but less thorough way to erase your disk, you can just
erase the PMA, TOC, and pregap using blank=fast or blank=minimal. Here’s an
example of a command for fully erasing the disk associated with /dev/cdrom:
# cdrecord dev=/dev/cdrom blank=all
Many more options available with the cdrecord command also might interest
you. To learn more, refer to the cdrecord man page (type man cdrecord).
6. Select Start. K3b begins burning your ISO image to CD or DVD. You can
watch the FIFO and Device buffers as the writing progresses. When it is
done, a trumpet sounds and the CD ejects.
7. Select Show Debugging Output. You can see verbose output from the
cdrecord command that was used to do the actual writing. At the end, the
output show the full cdrecord command line that was used to write the ISO to
CD or DVD.
8. If you changed any of the settings, you can select Save User Defaults. That
way, you can bring back the same settings the next time you burn a CD/DVD.
A applications
autostarting, 80
Absinthe, 280
ParallelKnoppix, 364
Abuse, 310
testing, 177-179
acpi= boot option (Knoppix), 72
apt utility, 178
adventure games, Falcon’s Eye, 308
apt-get command, 34, 160
AES (Advanced Encryption
arcade games, 309-314
Standard), 93
archives
AIM Sniffer, 277
exploit archives, 270-272
aimsniffer command, 277
file configuration, 94-96
AIR (Automated Image & Restore)
Armagetron, 310
utility, 281
arpspoof command, 276
aircrack-ng package, 279
ass command, 267
aireplay-ng command, 279
Atari, 303
AisleRiot Solitaire, 319
Ataxx, 316
ALLOWOPTIONS keyword
ATI cards, 50-51
(isolinux.cfg file), 141
ATI video drivers, 283
amap command, 272
Atlantix, 316
amaroK Live, 14
Atomic Tanks, 310
America’s Army, 306
audio. See multimedia live CDs
Amiga, 304
Automated Image & Restore (AIR)
Amphetamine, 310
utility, 281
APPEND keyword (isolinux.cfg file),
Autopsy Forensic Browser, 68, 280
139
401
402 Index
X
XBill, 313
XBlast-TNT, 314
XBlast-TNT-mini, 314
Xboing, 314
Xbreaky, 314
xhrefresh= boot option (Knoppix),
71
Xine, 64
Xiph.Org Foundation, 327
XKoules, 314
Xmms, 65
xmodule= boot option (Knoppix), 71
xprobe2 command, 267
Xracer, 314
XScat, 319
XScat via IRC, 319
Xscavenger, 314
Xscorch, 314
xserver file, 81
xserver= boot option (Knoppix), 71
xsession script, 125
Xsoldier, 314
XSpy, 278
xspy command, 278
xvrefresh= boot option (Knoppix),
71
Y-Z
yersinia command, 279
yum command, 34, 160-162
Zblast, 314