Creating Debian Installers with PGI

G. Branden Robinson

Steve Hunger

Eric Gillespie, Jr.

John R. Daily

$Progeny: guide.xml,v 1.92 2002/04/23 18:16:54 branden Exp $

Table of Contents
1. Overview
1.1. Features
1.2. What PGI Won't Do (Without Your Help)
2. Procedure Highlights
3. System Requirements
4. Kernel and Module Selection
5. Determining Package Placement on the Installer Media
5.1. Creating Installer-Only PGI ISO Images
5.2. Creating PGI ISO Images with a Partial Package Archive
5.3. Creating PGI ISO Images with a Complete Package Archive
6. Networking Requirements for the Installer
6.1. Pre-configuring Network Options
6.2. Documentation for the User
7. Implementing the Second Stage
8. Preparing Your Files
8.1. /etc/pgi/codename
8.2. /etc/pgi/codename/options
8.3. Other Files Under /etc/pgi/codename
9. pgi-build Cookbook
9.1. Selecting Debian Package Archive Mirrors
9.2. Selecting the Kernel Version To Be Used by PGI
9.3. Identifying and Branding your PGI-Based Installer
9.4. Selecting the Temporary Directory Used by PGI
9.5. Controlling Cleanup and Setting up Live Filesystems for NFS Usage
10. Wrapping It Up
10.1. Examining the Generated ISO Images with Loopback Mounting
10.2. Creating CD/DVDs from ISO Images
A. Running pgi-build
pgi-build -- generate ISO images containing the PGI Debian installer
B. Example Configuration Files

Chapter 1. Overview

PGI[1], the "Progeny Graphical Installer", is a system for creating installers for the Debian GNU/Linux operating system. PGI is based on the installer used in the Progeny Linux Systems, Inc. distribution of Debian. Without customization, PGI produces a minimal Debian system installer on an ISO 9660 filesystem image suitable for burning to recordable CD or DVD media. With customization, PGI is a powerful, flexible foundation upon which you may implement as sparse or as elaborate a Debian GNU/Linux installer you may desire.

PGI conceptualizes an installation as taking place in two stages. The first stage consists of running the installer itself. During this stage (or, at least, up until the very end of it), the target system — that is, the system to which one is installing the operating system — is regarded as "not installed". This means that there is no bootable Debian GNU/Linux system on it, or the one that is present is not desired. When the second stage begins, one is running the desired operating system, but essential system parameters may not be configured to the user's taste. Under these definitions, a Debian GNU/Linux system that can boot to multi-user mode and present a login prompt, but has no no user accounts and no password on the root account is installed but not configured. Thus, configuration is extremely important for security as well as usability. Fundamentally, PGI is a first-stage installer only; all it does is prepare a bare, unconfigured system. When it exits, you will get a login prompt if no vendor hook has been provided.

What PGI lets you (the installer vendor) do is start from this known blank-slate state and handle only the interesting parts of the installation process, which consist primarily of configuration. Do you want the system to "just come up" with the GNOME or KDE desktop environments pre-installed? Is there a standard profile of Debian packages that you want present from the very start on the systems at your site? PGI gives you this power without requiring you to fuss with the bootstrapping stages of an operating system installation.


1.1. Features

PGI implements several existing technologies to ensure that it is both flexible enough to deal with a broad range of hardware, and compatible with the official Debian installation system. The latter point is important because it should not matter how the user gets Debian GNU/Linux onto his or her computer; what is important is that the resulting system is compatible with any other Debian GNU/Linux system at the infrastructural level.

  • PGI uses debootstrap, Debian's official means of retrieving and installing the core components of a Debian GNU/Linux system. Stage 1 of PGI (see Implementing the Second Stage) can be thought of as a "wrapper" around debootstrap; PGI gets the system into a state where debootstrap can be run successfully.

  • PGI features both text-mode and graphical user interfaces. The latter uses version 4.1.0 of the XFree86 X server, supporting a wide variety of video hardware at reasonable color depths and resolutions. In cases where the graphical interface is not desired or unsupported by XFree86, a text-mode interface is available and provides the user with the same functionality.

  • PGI's graphical user interface autodetects most pointing devices (mice, trackballs, etc.) and video hardware. In most cases, it is not necessary to answer any configuration questions to use the installer's graphical interface — it "just comes up". In situations where manual configuration is necessary, only a few easily-understood questions are asked of the user, to give the GUI the "push" it needs to get going. Alternatively, you can run the graphical interface even when the target machine's video hardware is not supported by the XFree86 X server; simply set the display boot parameter and run the installer on an X server elsewhere on your local network[2].

  • Even when the X Window System is unavailable, PGI's text mode spares the Linux novice the intimidation of a shell prompt. The dialog utility is used to provide a friendly, menu-and-button-driven interface to the text-mode installer.

  • PGI is largely independent of the Linux kernel version. PGI may be built around an extremely broad variety of kernels; only a few kernel configuration options or mandatory for PGI's proper operation (see Kernel and Module Selection). You can create lean-and-mean kernels for use with PGI, or large, featureful kernels for use on a range of hardware. You can also use PGI with the latest Linux kernel[3], or your own specially-patched version, in the event that the target hardware for installation is not supported to your satisfaction by the stock Debian kernel.

  • PGI uses Progeny's Discover hardware autodetection system to automatically detect the correct kernel module or XFree86 server driver to use with PCI, AGP, USB, and PCMCIA devices.

  • PGI provides and uses the GNU Parted library and utility for flexible and featureful disk partitioning. A graphical partitioner based on Progeny's Python bindings to the Parted library makes partitioning easy and intuitive[4].

  • PGI is architecture-independent. PGI has been designed for portability. In its first release, it supports the Intel x86 and IA-64 architectures. Hooks are in place for developers on other architectures to add support for their platforms without having to make infrastructural changes to PGI.

  • PGI is flexible. Not only are many aspects of its behavior customizable at build time (and even run time), but PGI supports the simultaneous development of different "profiles", which are referred to by code names that you select. You can choose between these profiles at build time with a command-line option.

    As an example, imagine that you're responsible for managing a pair of university computer labs. One lab is for general undergraduate use, so you want the machines to have a desktop environment and a large array of applications, like Mozilla, Gnumeric, KWord, Gaim, and Kontour. Another lab is used only by CS students taking Systems Programming courses; some of these guys eschew all windowing systems[5] and want to get straight into their text editors and debuggers. For this audience, you might not ship the X Window System at all, and ensure that Vim, Emacs, Gdb, and User-Mode Linux are present. Once you have set up the profiles for each, you can create ISOs for either at will without needing to shuffle files.

  • PGI is network-enabled. For GNU/Linux users in general and for Debian users in particular, the days of being restricted to installing your system from a fixed, physical medium and then having to hurriedly upgrade to the latest patches from your vendor are fast becoming a memory.

    debootstrap is network-aware, and can retrieve the base system from a local disk, a web server internal to your home or office, or directly from an official Debian mirror on the Internet. PGI goes still further, however. Only the earliest phases of installation (the booting of the Linux kernel, loading kernel modules necessary to support the target machine's hardware, and configuration of the network interface) need depend on the installation medium (CD or DVD). NFS can then be used to mount the "live" filesystem inside which the installer proper runs.

    These network installation options allow vendors to update PGI-based installers without replacing the existing CD images.

  • PGI is boot-loader agnostic. On the x86 platform, PGI uses GNU GRUB for a friendly, menu-driven boot loader. GNU GRUB also supports a powerful command-line interface at boot time, if the user elects to use it. On the IA-64 platform, elilo is used, and the Linux kernel's interface to EFI variables is used to update the boot menu in the system firmware.

  • PGI can generate ISO 9660 images that contain only a PGI-based installer, images that contain the installer plus the packages needed to support your installation profile, or the installer plus a complete snapshot of the Debian package archive. Multiple ISO images are generated as needed.

  • PGI-based installers are more than just installers. The installer can also be started in a system rescue/recovery mode, which loads the live filesystem and provides the user with a shell. The live filesystem can be configured to contain practically anything desired, from network diagnostic tools to a full XFree86 installation and even a web browser[6]. The PGI installation medium can also be used a simple boot disk, loading the kernel and getting out of the way, transferring control to the specified root filesystem device.


1.2. What PGI Won't Do (Without Your Help)

As stated above, PGI breaks the installation process down into two[7] stages. The first stage is concerned with establishing a bootable system on the computer. The second stage involves setting up that system; configuration of date and time, network interface card setup, and the XFree86 X server is typical.

Note

Using a network connection and graphical interface for the first stage is not unusual, so if the network card and X server are configured at that time, their parameters are stored and made available in the second stage.

PGI is designed to be agnostic about the second stage, and in fact does not provide one for you, except by way of example. See Implementing the Second Stage for further details.


Chapter 2. Procedure Highlights


Chapter 3. System Requirements

The process of building a PGI-based installer — running pgi-build — requires quite a bit of free disk space to work in, especially if a Debian package archive is included on the installation medium. On an Intel x86-based machine, using the --installer-only option, the stock configuration requires a little over 300 megabytes of disk space (including the approximately 90 megabyte ISO image). Note that this amount increases as, e.g., things are added to the live filesystem, the vendor-hook scripts are fleshed out, and so forth.

When including Debian package archives, the space requirements grow appreciably. At the time of this writing, including the complete Debian woody suite (both binary and source packages) occupies 7 ISO images (roughly 4.5 gigabytes). It is wise to take a conservative (some would say pessimistic) approach and budget an equal amount for temporary usage; thus, one would perform a PGI build with 9 gigabytes of free space on the disk partition containing the temporary directory. The temporary directory that is used by PGI is configurable, as is the directory where the ISO images are placed. Needless to say, when being selective about what packages are included, and when providing only binary packages, space requirements can fall dramatically[8].

Generating ISO images with Debian package archives also requires access to a mirror of the Debian suite being used (e.g., woody). HTTP access to a Debian APT repository in not sufficient, but an NFS-mounted mirror is.

Running pgi-build is not particularly CPU or memory-intensive; instead, it is mostly disk-bound. Therefore, as long as the disk space requirements are met, it is reasonable to run pgi-build on any system that is equivalent to or better than the target hardware in terms of processor horsepower and memory. Fast drives (and drive buses) will improve the speed of the pgi-build process.

PGI has extensive dependencies on underlying software; however, these are not particularly difficult to meet on a Debian system, since they are declared as dependencies of the PGI package.

(or the equivalent operation in your favorite APT frontend) is sufficient to satisfy these requirements.

Note

One requirement of pgi-build that cannot be expressed as a package dependency is its reliance on support for loopback-mounted filesystems in the running kernel. One way to determine whether your kernel has support for this feature is to run the following command:

If this kernel configuration variable is set to "y" or "m", you have the support; if it is set to "n", you do not.

The system requirements for the execution of the PGI installer itself are fairly easy to meet. The installer uses an eight megabyte initrd; this is memory that will be unavailable for conventional purposes. Contemporary machines ship with much more memory than PGI is likely to require. A graphical mode installation requires more memory than the text mode installer because of the memory footprint of the X server and graphics libraries. Recommended minimums for memory are 32 megabytes for text mode and 64 for graphical mode.

There is no fundamental reason why a PGI-based installer would have difficulty running on an Intel 80386 machine, as long as the computer has a math co-processor installed. Such an installation would be slow, as would the installation of any contemporary operating system. We do not suggest any minimum requirements for desktop computers in production at the time of this writing; PGI will not push such machines anywhere near their limits. The limiting factors for PGI-based installs in our experience are network bandwidth (in the case of network-based installations), and access times and transfer rates for optical drives and hard disks. The faster your drives (especially the CD- or DVD-ROM drive), the faster the install will go.

Disk space requirements for the installed system depend largely on the profiles you develop; a "plain vanilla" PGI build with no second stage at all fits comfortably in 500 megabytes of disk space. As with CPU requirements, hard drive capacities have managed to out-pace even Debian's ability to consume space.


Chapter 4. Kernel and Module Selection

The following functionality is needed for the kernel the installer uses. Each of the following items refers to a Linux kernel configuration option; a brief description of why that feature is needed is given, as well as a note on whether the functionality may be compiled as module (as opposed to be being built-in to the kernel binary), and whether the feature may be optional in some PGI-based installers.

RAM disk support

Mandatory; required by the initial RAM disk support (see below). Must be compiled-in, because initial RAM disk support is unavailable otherwise. (Leave the related "Default RAM disk size" parameter at its default.)

Initial RAM disk (initrd) support

Mandatory; enables the Linux kernel to boot without a root filesystem on the host machine. Must be compiled-in.

Second Extended (ext2) filesystem support

Mandatory; used for reading and writing to the initial RAM disk as well as the target disk(s). Must be compiled-in, because the installer's initrd is an ext2 filesystem.

ISO 9660 filesystem support

Mandatory on the x86 architecture[9]; optional but highly recommended on the IA-64 architecture. Used for reading the installation medium. If not enabled, only NFS-based installs will be possible. May be compiled as a module.

/proc filesystem support

Mandatory; the installer process requires the use of the /proc filesystem. Must be compiled-in, because the hardware autodetection program discover uses /proc to identify installed hardware.

VFAT filesystem support

Mandatory on the IA-64 architecture; optional but highly recommended on the x86 architecture. Used to support DOS/Windows partitions and (on IA-64) EFI partitions. May be compiled as a module.

Packet socket (Berkeley packet address family) support

Optional but highly recommended; used for DHCP support in the installation environment. May be compiled as a module.

Unix domain socket support

Mandatory; used to support the X server used by the graphical interface. May be compiled as a module.

TCP/IP networking support

Mandatory; used to support network-based live filesystems and installations, as well as many features of the installed system. Must be compiled-in.

NFS support

Optional but highly recommended; used for NFS-mounted live filesystem support in the installation environment. May be compiled as a module.

NLS Codepage 437 support

Used for filename recognition on DOS/VFAT filesystems. Same recommendations as VFAT support, above.

IDE block device, IDE disk, and IDE CD-ROM support

Mandatory; used for accessing the IDE bus and attached devices. May be compiled as modules. To support usage of the PGI installation disk as a boot disk, compile this functionality into the kernel for users whose root filesystem resides on an IDE disk partition.

Low-level SCSI drivers, SCSI disk, and SCSI CD-ROM support

Mandatory; Used for accessing SCSI controllers and attached devices. May be compiled as modules. Unless the hardware characteristics of the target machines are well-known, compile as many low-level SCSI drivers as possible. To support usage of the PGI installation disk as a boot disk, compile the low-level driver(s) and SCSI disk support into the kernel for users whose root filesystem resides on a SCSI disk partition.

SCSI emulation for IDE devices

Mandatory; PGI relies on the existence of this interface to simplify autodetection of the CD/DVD drive on the target system. May be compiled as a module.

USB support, UHCI support, OHCI support, USB mouse support

Optional; used by the graphical interface to communicate with USB-based input devices. May be compiled as modules.

AGP support

Optional; used by the graphical interface to support video cards with no dedicated video RAM. May be compiled as a module.

/proc/efi/vars support (IA-64 only)

Mandatory; used to update the EFI boot menu. May be compiled as a module.

Note

Also note that you may need to enable various kernel options for PCMCIA support, if you want your PGI-based installer to support PCMCIA devices on target systems. This caveat holds true for Debian stock kernels as well; some laptops supported by Debian's kernel-image-2.2.20 package are not supported by Debian's kernel-image-2.4.17-386 package, for instance. You may want to get into the habit of checking /boot/config-kernel-version before starting a pgi-build.


Chapter 5. Determining Package Placement on the Installer Media

There are three configurations with respect to package placement on the installer media; one approach is to have no packages at all in the ISO image, relying upon a network connection on the installing host to retrieve Debian packages. The second is to include on the ISO only those packages explicitly required by the PGI configuration, and the dependencies of those packages. The third is to include all Debian packages, a process that will result in the generation of several ISO images, since there are more packages in the Debian distribution than will fit on one CD-ROM disc.[10] By default, a set of ISOs containing Debian source packages will be created as well[11] In general, the number of source ISOs produced is approximately equal to the number of corresponding binary ISOs.


5.1. Creating Installer-Only PGI ISO Images

By invoking pgi-build with the --installer-only option, an ISO that contains nothing but the files actually implementing the PGI installer itself will be generated. This type of image is the quickest to generate, and will consume less than 100MB of space on the i386 architecture in pgi-build's default configuration. Another advantage of --installer-only builds is that they require no locally-mounted mirror of the Debian package archive.

Warning

Note that because the installed packages' dependencies are calculated at build time, not install time, debootstrap can fail if a package to be installed automatically has changed its dependencies by the time the install is run. For instance, if I create a PGI ISO with --installer-only and --suite=unstable, and am using a Debian mirror for package retrieval, my ISO will likely become outdated sooner or later. More specifically, the python2.1 package, for example, may not declare a dependency on libssl0.9.6 at the time I create my ISO — but a few days later, when using my ISO to install a system, if the version of python2.1 available in Debian's "unstable" tree depends on libssl0.9.6, I will be in trouble and the install will fail, becase debootstrap does not know how to resolve dependencies; it retrieves and installs exactly what you tell it to, no more and no less.

Therefore, it is wise to use the --installer-only option only in conjunction with a stable package archive, or for short-term and/or experimental purposes.

A future version of PGI may perform package dependency calculation at install time, and retrieve newly-required packages from the network.

The above situation is not a problem with the other approaches to package placement, since the packages that the installer requires will be retrieved from the ISO, not the network, and their dependency relationships will be static.


Chapter 6. Networking Requirements for the Installer

6.1. Pre-configuring Network Options

Helping Your Users Help Themselves

Under some circumstances, the user of a PGI-based installer may be required to provide network parameters when booting. As this can be one of the more complex tasks that the installer asks of the user, it is worth considering how to make the process less daunting.

It is important to recognize that if the installer disc includes all needed packages, no network connectivity is required by PGI itself. Even then, it is well worth documenting that fact so that the end user knows not to worry about the boot-time parameters.

If, on the other hand, no packages are included (pgi-build --installer-only), then a network connection will be required. PGI will attempt to contact a DHCP server by default if the user does not provide any networking information and --installer-only was specified by the installer creator.

If your installer image is targetted at a discrete set of users in a common network environment, pre-configuring any necessary HTTP proxy for package retrieval is one way to reduce the chance of user error. Note that it is not necessary to set up an HTTP proxy if your users have unrestricted outbound HTTP connectivity, or if you have configured PGI to use an internal Debian archive mirror that users don't require an HTTP proxy to access. Furthermore, we strongly recommend setting up a DHCP server to serve network configuration parameters to users' workstations. By preparing your network in this way, and by pre-configuring the HTTP proxy and/or archive mirror, users of installer-only PGI discs need not know anything about network configuration to perform an installation[12].


6.2. Documentation for the User

On the i386 architecture, syslinux provides help screens that can be customized.

Since the syslinux help screens are not universally available, and since there is limited room for comprehensive help text, a user manual is provided with the PGI package. You should customize this manual to describe the installer as your users will experience it.


Chapter 7. Implementing the Second Stage

There are two points at which the installer executes vendor-supplied code — if available — before proceeding with its business. These execution points ("vendor hooks") are the means by which a second stage is set up and run. An example vendor hook is provided with PGI to instruct the system to run base-config, just like Debian's own boot-floppies. Another example demonstrates usage of Progeny's Configlet configuration system, which is similar to that featured in the Progeny Debian distribution and is now part the of the Debian distribution.

To implement one's own second stage, any needed packages must be added to the list of extra packages (see Input Files), and the vendor hooks must be written to ensure that appropriate tasks are carried out in the init process (in the provided "configlets" example, this means launching the X server and starting the configlet druid).

The first vendor hook is run right before the installer scripts themselves. This, the preinst.sh script, permits you to perform any housekeeping that needs to be done before the target disk is partitioned, the base system unpacked, the boot loader set up, or your post-installation hook executed. To be honest, we can't think of many applications for the pre-installation hook, but it is present in the event that you are more imaginative than we.

The second vendor hook is postinst.sh and, as you might guess from the name, it runs after the installation proper has occurred. At this time, you can expect the target filesystem to be present and mounted at /target. We expect typical applications of the post-installation hook to consist of little more than copying over files from the live filesystem to the target, one of which would likely be a shell script to be placed in /target/etc/rcS.d to have the booting target system's init process transfer control to programs of the vendor's choosing. Note that it is not necessary to invoke apt-get from your post-installation vendor hook; instead, you may simply name the packages you wish to install in /etc/pgi/codename/extra_packages, and they will be present before your post-installation hook is executed.

Both vendor hooks must be POSIX shell scripts (no Bashisms, please). They will be sourced instead of executed, so do not turn on the -e shell option (unless you are extremely careful with the exit status of every command you run and turn it back off before the end of your script), and do not explicitly exit the script. With those caveats, you may do practically anything that can be done in a shell script, including, of course, execute any ELF programs that you may also have provided. Be conservative with usage of typical shell utilities, as many standard commands exist in the live filesystem in their BusyBox implementations. If you require a more featureful version of a utility, ship it on the live filesystem by editing live.files.list (see Input Files) or run the version in the target system.

You can expect several variables to be in the environment of your vendor hook scripts (see Other Files Under /etc/pgi/codename):

ARCH

This will always be set, and contains the name of the host machine architecture as used by Debian packages (i.e., "i386" for all 32-bit x86-compatible machines, "powerpc" instead of "ppc", and so forth).

DISPLAY

This will only be set if PGI's remote graphical installation feature is used. (A local X server will not be running at the time the vendor hook scripts are called.) If set, this will contain the name of an X display on a remote host.

DMESGLOG

This is always set and contains the absolute pathname to the a file containing the output of the dmesg command. (The file will be empty when your pre-installation hook runs, but not when the post-installation hook runs.)

IDENTLOG

This is always set and contains the absolute pathname to a file containing the RCS IDs of several files that form part of PGI. (The file will be empty when your pre-installation hook runs, but not when the post-installation hook runs.)

KERNEL_VERSION

This is always set and contains the output of uname -r.

LD_LIBRARY_PATH

This is always set and serves its usual purpose for the dynamic loader. Meddling with this variable can break the installer. If you must change it, store its value before you do so, and restore that value before your script finishes.

LIVE

This is always set and contains the absolute pathname of the mount point of the live filesystem. Always use this variable to locate files in the live filesystem, and your customizations will be robust if PGI changes this mount point.

LOGFILE

This is always set and contains the the absolute pathname to a file containing various human-readable data of interest concerning the progress of the installation. You are encouraged to append text to this file to debug your vendor hook scripts and/or provide feedback suitable for consumption by those who may be supporting users of your PGI-based installer. For instance, if your hooks interact with the user and give him or her options to choose from, it is a good idea to record their choices here so that you can trace the path they took through your code. Overwriting this file is highly discouraged and may render your product unsupportable. Also see the pgilog function described at the end of this chapter.

MIRROR

This is always set and contains a URI to the Debian package archive that debootstrap uses to install the base system. This may be an http URI or a file URI.

PATH

This is always set and serves its usual function. Like LD_LIBRARY_PATH, changing the contents of this variable can break the installer. If you must change it, store its value before you do so, and restore that value before your script finishes.

PGIDEBUG

This is set to a non-null value if the user indicated that he or she wanted to run the installer in a debugging mode. You may take advantage of this in your vendor hook to, for example, launch shells at strategic points so that developers or very advanced users can examine the system. Furthermore, you can use it to increase the verbosity level of your scripts to the console. Also see the pgilog function described at the end of this chapter.

PROMPTING

This is set to one of two recognized values, less and more. This is used to control the interactivity level of the installer. If this variable is set to more, you should not make assumptions about the user's desires or system configuration if you do not have to. We recommend testing this variable only against the string more.

PYTHONHOME

This is always set and tells the Python interpreter where to find its modules. PGI relies upon this variable being set reasonably; if you must change it, store its value before you do so, and restore that value before your script finishes.

SUITE

This is always set and contains the name of the Debian archive suite from which packages are downloaded. The suite name is the code name of the Debian release; e.g., potato, woody.

SYSLOG

This is always set and contains the absolute pathname of the system log file (as used by the syslog command) in the installer environment.

TARGET

This is always set and contains the absolute pathname of the mount point of the target root filesystem. Always use this variable to locate files in the target filesystem(s), and your customizations will be robust if PGI changes this mount point.

TEXTMODE

This is set to a non-null value if the user selected at boot time to perform the installation in text mode.

ip

This is set if networking is configured; if so, it contains the address of the configured interface in dotted-quad notation. This address may have been set by the user at boot-time, or by a DHCP server.

subnet

This is set if networking is configured; if so, it contains the subnet mask of the configured interface in dotted-quad notation. This mask may have been set by the user at boot-time, or by a DHCP server.

router

This is set if networking is configured; if so, it contains one or more addresses of gateway routers to be used in dotted-quad notation. These addresses may have been set by the user at boot-time (in which case there will be only one), or by a DHCP server (in which case there is typically only one).

broadcast

This is set if networking is configured; if so, it contains the broadcast address of the configured interface in dotted-quad notation. This address may have been set by the user at boot-time, or by a DHCP server.

dns

This is set if networking is configured; if so, it contains one or more addresses of DNS name servers to be used in dotted-quad notation. These addresses may have been set by the user at boot-time (in which case there will be only one), or by a DHCP server (in which case there is typically more than one).

http_proxy

This is set if it was specified at build time (see Running pgi-build) or by the user when the installer was booted. If set, it contains the URL of an HTTP proxy server.

When writing your vendor hook scripts, it is prudent to log anything interesting to the LOGFILE, even if PGIDEBUG is not set. For human-readable status messages, you can accomplish both of above by using the built-in shell function pgilog(), which works just like echo. You can give pgilog the -n option to suppress the newline at the end of the line.


Chapter 8. Preparing Your Files


8.3. Other Files Under /etc/pgi/codename

See Input Files for a list of the customizable files located here.


Chapter 9. pgi-build Cookbook

pgi-build sports a bewildering array of knobs, switches, and dials. This chapter provides some example invocations and solutions. For complete coverage, see Appendix A.


9.1. Selecting Debian Package Archive Mirrors

A Debian installer is fundamentally a delivery mechanism for Debian packages; PGI is no different. Debian packages are kept at many locations on the Internet. A large number of locations contain the official distribution; these sites are referred to as "mirrors", since they are clones of a central package archive server which is not publicly accessible[13]. There are also other, generally much smaller, repositories that are not run by or affiliated with the Debian Project, and are typically dedicated to providing Debian packages for a given piece of software or the products of a particular company. PGI uses Debian mirrors in two distinct ways; a mirror is used by the installer itself when a Debian package archive cannot be found on the live filesystem, and the pgi-build process uses a mirror that is mounted on the system used to build a set of PGI-based installation images. The former defaults to Progeny Linux Systems, Inc.'s Debian mirror, archive.progeny.com[14]; it is used if the installer can't find Debian packages on the live filesystem (when it's mounted via NFS, for example). The latter is necessary when running pgi-build without the --installer-only option. Use the --build-mirror option to specify the location of your Debian package mirror. The build mirror may be NFS-mounted.

Note

A local mirror must be available if you are not using the --installer-only option; there is a great deal of internal structure to a Debian package repository that is not accessible through the package retrieval methods used by, e.g., apt. pgi-build requires a local mirror to populate the ISO image(s), because those ISOs will themselves contain package repositories.


$ pgi-build --pgi-mirror=http://archive.progeny.com/debian
      --build-mirror=/archive/debian/ftp
      

9.2. Selecting the Kernel Version To Be Used by PGI

At the time of this writing, there are three versions of the Linux kernel that are both considered "stable" and actively maintained. The earliest, in the 2.0.x series, is nearly abandoned, and cannot be used with PGI since it lacks facilities that the PGI installer requires. The others are the 2.2.x series and the 2.4.x series. PGI supports both of these kernel versions on the Intel x86 architecture and continuing support for both is planned. On the IA-64 architecture, only the 2.4.x series is supported.

Debian makes multiple variants of each kernel version available in Debian packages; these are called "flavors". Each flavor has different configuration options. Some, like the stock 2.2.20 package (kernel-image-2.2.20), take a "kitchen sink" approach, compiling many IDE and SCSI device controllers directly into the kernel. Others lack SCSI support entirely. There are many flavors of Linux 2.4 available for Debian/i386, but only one of them will work with PGI: the -386 flavor. This flavor expects its initrd to be an ext2 filesystem, which is what PGI requires. Other versions use the CRAM (Compressed RAM) filesystem, which is small but not writable. The PGI installer demands a writable initrd. You can use the --kernel-version to specify a kernel version rather than the default (whichever kernel is running on your build system):

If Debian does not provide a kernel package flavor that suits your needs (or PGI's), you can always compile and package your own. For this we recommend the excellent kernel-package Debian package, which makes the process quite easy.


9.5. Controlling Cleanup and Setting up Live Filesystems for NFS Usage

By default, pgi-build does not clean any of the directories it uses by default; this is useful if you need to try to recover from a failed pgi-build and are interested in looking at some of the transient files produced by pgi-build or need to keep the live filesystem around for NFS export.

Warning

Be very careful when using the --clean and --post-clean options in conjunction with any of the --tmpdir, --misctmpdir, or --outdir options (or their corresponding option variables). The cleanup process can remove files that have nothing do with PGI if these directories are not chosen carefully. For example, it is unwise to specify --clean --outdir=/. The default temporary and output directory names that pgi-build uses are such that it is unlikely you will lose any data when specifying --clean or --post-clean.

--clean instructs pgi-build to remove everything in its temporary directories and output directory before going to work, and in its temporary directories after it finishes (the latter can be overridden with --no-post-clean. In general, after investigating the cause of a pgi-build failure, you should specify --clean so that any configuration changes you make are reflected from the beginning of the build process when you run pgi-build again. Otherwise, you run a good chance of producing a useless installer ISO.

--post-clean instructs pgi-build to not clean up its temporary directories after it finishes. This option will prove useful to those who are confident that their ISO builds are sound and useful, and who have no need to create NFS exports containing a live filesystem for use by PGI.

The live filesystem is found in a subdirectory of the temporary directory called misc/live (if the miscellaneous temporary directory was explicitly set, it is a subdirectory of that directory).

If the live filesystem for a given PGI build is located in the directory /home/frank/pgi/vanilla-2.4.17-386/misc/live on a host called margaret, then the administrator of margaret can add the following line to /etc/exports:

In the example above, we provide a read-only export to any machine with an address in the given range. The details of NFS server configuration and /etc/exports management are beyond the scope of this manual, but the corresponding PGI boot-time option to access this NFS export is not:

The above example assumes that a DHCP server will be available to supply the installing host with network configuration information, including a domain and DNS nameserver to use. Otherwise, the network will have to be configured by the user at install time.


Chapter 10. Wrapping It Up

When the scripts are finished building the installation image, you can then examine the image by loopback mounting it.


10.2. Creating CD/DVDs from ISO Images

There are several applications that will burn an ISO image to a recordable CD or DVD. One of these applications is cdrecord.

In order to use cdrecord, you will need to know the logical location of the recording device ("burner") in a specialized format. cdrecord has an option for locating the device. The following example shows the -scanbus option which identifies the burner as 0,0,0.

Note

cdrecord assumes that the burner is a SCSI device. If you have an IDE burner, you will need to use SCSI emulation by loading the ide-scsi module (modprobe ide-scsi) into the kernel.


# cdrecord -scanbus

Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
Linux sg driver version: 3.1.22
Using libscg version 'schily-0.5'
scsibus0:
        0,0,0     0) 'TEAC    ' 'CD-W512EB       ' '2.0A' Removable CD-ROM
        0,1,0     1) *
        0,2,0     2) *
        0,3,0     3) *
        0,4,0     4) *
        0,5,0     5) *
        0,6,0     6) *
        0,7,0     7) *
scsibus1:
        1,0,0   100) 'QUANTUM ' 'ATLAS V  9 WLS  ' '0201' Disk
        1,1,0   101) 'IBM     ' 'DDYS-T36950M    ' 'S80D' Disk
        1,2,0   102) *
        1,3,0   103) *
        1,4,0   104) 'SEAGATE ' 'ST336704LWV     ' '4301' Disk
        1,5,0   105) *
        1,6,0   106) *
        1,7,0   107) *
        

Once the burner is identified and the ISO image is available, you can record the image(s) to optical disc(s) using a command similar to the following example:

This example records the pgi-i386.iso image to device 0,0,0 at a maximum speed of 8x. cdrecord will provide verbose information about the burn and will eject the disc when the burn is complete.

Once the disc is finished you can then use it to boot a computer for installation.


Appendix A. Running pgi-build

pgi-build

Name

pgi-build -- generate ISO images containing the PGI Debian installer

Description

pgi-build (pronounced "piggy-build") is system for creating PGI-based installers for the Debian GNU/Linux operating system. PGI is derived from the installer used in the Progeny Linux Systems, Inc. distribution of Debian. Without customization, PGI produces a minimal Debian system installer on an ISO 9660 filesystem image suitable for burning to recordable CD or DVD media. pgi-build supports an extensive set of configuration options to support the tailoring of installer media to your needs.

Options and Environment

Several options have abbreviated, single-letter forms; when using an abbreviated option that takes an argument, the option argument should be specified after the option and a space character. For instance, the commands:

both do the same thing.

Note

Most of the defaults listed below are derived from the default options file provided with the PGI package. Furthermore, most command-line options are associated with a variable that is passed into the pgi-build process environment. For convenient reference, if such a variable is associated with a command-line option, it is listed at the beginning of the option's description.

-B | --builder=email-address

BUILDER; specifies the identity of the builder of this image; the address will be included in the helpfile for syslinux. Default: falls back to, in order: DEBEMAIL, EMAIL, USERID.

-C | --complete

COMPLETE; includes all available packages in the package archive on the generated ISO image(s). Default: off.

Warning

When applied against the full Debian archive, enabling this option can result in several ISO images.

-D | --dir=pgi-directory

PGI_DIR; identifies location of the PGI infrastructure. Default: /usr/share/pgi.

-M | --misctmpdir=miscellanous-temporary-directory

TDIR; specifies directory to use for transient temporary files. PGI uses loopback mounts in this directory, so it must be on a filesystem capable of handling those (i.e., not NFS). Default: subdirectory of BASETMPDIR called misc; see -t | --tmpdir.

-O | --official

OFFICIAL; marks the image as "official" for purposes of apt's CD methods. Default: off.

Warning

Do not use this option unless you are certain that you know what you are doing. Only those with legal rights to the Debian name, for instance, are authorized to create official Debian CD images for distribution. If you unsure as to whether you should be branding your product as official, see the --vendor and --product options, and seek the advice of counsel.

-P | --pgi-http-proxy=URL

PGI_HTTP_PROXY; identifies location of HTTP proxy server by URL. This option should be used when PGI-based installer media are being distributed in a controlled environment (e.g, within one company or organization) where an HTTP proxy is required for external web access. Note that an HTTP proxy URL often includes a port number, in which case the URL should be in the format: http://hostname:port/. Also note the trailing slash. Default: empty.

-V | --release-version=release-version

VERSION; specifies a version number for the product being generated. Default: 3.0 (for the Debian "woody" release).

-a | --additional-archives=additional-archives

OTHER_ARCHIVES; reserved for future expansion. Default: empty.

-c | --codename=release-code-name

CODENAME; designates a product code name for generated ISO images. This is used as the subdirectory of /etc/pgi within which to search for customization information, such as the options file to set default values for the PGI system. Default: custom.

Alphanumeric characters and underscores may be used, but the first character may not be a digit.

-d | --debian-version=debian-version

DEBVERSION; specifies the version number of underlying Debian distribution. Default: VERSION; see -V | --release-version.

-h | --help

Displays a brief usage message for pgi-build to standard output and exits.

-i | --installer-only

INSTALLER_ONLY; generates an ISO image including only the installer, and excluding Debian package archives. Default: off.

-k | --kernel-version=kernel-version

KERNEL_VERSION; indicates version of Linux kernel to use for installer and installed system. Default: the output of uname -r.

-m | --pgi-mirror=mirror-directory

PGI_MIRROR; specifies location of Debian package archives as used by the running installer (not pgi-build itself). Default: http://archive.progeny.com/debian.

-o | --outdir=output-directory

OUT; identifies location where generated ISO image(s) should be deposited. Default: subdirectory of BASETMPDIR called out; see -t | --tmpdir.

-p | --path=execution-path

PGI_PATH; set the environment variable PATH for use by the pgi-build process. Default: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.

-r | --gain-root-command=command

SU_CMD; indicates command with which to run the parts of the pgi-build process that require root privileges (e.g., loopback mounting of filesystems). Default: sudo.

Note

If running pgi-build as root, try /bin/sh.

-s | --suite=distribution-suite-name

SUITE; specifies name of Debian suite upon which the images are based (e.g., potato, woody). Default: woody.

-t | --tmpdir=temporary-directory

BASETMPDIR; specifies the directory where all files generated by pgi-build are written. Default: a subdirectory of TMPDIR (or the current directory) called pgi- followed by the username of the invoking user (also see -u | --username).

-u | --username=username

USERID; specifies the username used by the BUILDER and BASETMPDIR variables. Also see -B | --builder and -t | --tmpdir. Default: output of whoami.

-v | --version

Prints the version of pgi-build to standard output and exits.

--build-mirror

PGI_BUILD_MIRROR; specifies the location of a mounted filesystem containing a mirror of the Debian package archive to be used in the creation of Debian package archives on the ISO image(s). Note that HTTP or FTP access to a Debian mirror is insufficient for the purposes of this option. An actual mirror must be available, though it can be NFS-mounted. Default: /archive.

--clean

Indicates whether to clean the temporary directories before and after building the ISO image(s), and whether to clean the output directory before building. (Also see --post-clean.) Default: off.

Warning

Use this option with extreme care when specifying it in conjunction with the -t | -tmpdir, -M | --misctmpdir, or -o | --outdir options, or their corresponding variables. Specifying --clean will remove all files in these directories.

--include-nonfree

NONFREE; indicates that unofficial Debian packages that do not meet the Debian Free Software Guidelines should be included in the package archives on the ISO image(s). Default: off.

Warning

Much software that does not satisfy the Debian Free Software Guidelines is not licensed for commercial distribution; enable this option at your own legal risk.

--include-source

INCLUDE_SOURCE_PACKAGES; indicates that Debian source package archives should be included on the ISO image(s). Default: on.

--no-clean

Inverts --clean; see above.

--no-include-nonfree

Inverts --include-nonfree; see above.

--no-include-source

Inverts --include-source; see above.

--no-post-clean

Inverts --post-clean; see below.

--not-complete

Inverts -C | --complete; see above.

--not-official

Inverts -O | --official; see above.

--post-clean

Indicates whether to clean the temporary directories after building the ISO image(s). Overrides --clean at the end of the build process. Default: off.

Warning

Use this option with extreme care when specifying it in conjunction with the -t | --tmpdir or -M | --misctmpdir options, or their corresponding variables. Specifying --post-clean will remove all files in these directories.

--product=name of PGI-based product

PRODUCT; specifies the name of the PGI-based product being generated. Also see --vendor. Default: GNU/Linux.

--subdir=subdirectory

Invokes only a section of the pgi-build process; valid values are subdirectories of --dir. For advanced usage. Default: none.

--target=subdirectory Makefile target

Invokes a specific PGI Makefile target; valid values depend on the --subdir option argument. For advanced usage. Default: none.

--vendor=name of vendor/distributor

VENDOR; specifies the name of the PGI-based product vendor. Also see --product. Default: Debian.

--with-debian-debootstrap

DEBIAN_DEBOOTSTRAP; indicates that pgi-build should generate ISO images using the version of debootstrap installed on the system, instead of PGI's own forked version. Default: off.

--without-debian-debootstrap

Inverts ---with-debian-debootstrap; see above.

Other Environment Variables

Other environment variables of interest used by pgi-build but not directly accessible through command-line options include:

ETC_DIR

Automatically set to /etc/pgi/codename.

SYSLINUX_OPTIONS

Options to pass to syslinux. Only useful on the i386 architecture.

COPYLINK

Indicates whether files from the PGI_BUILD_MIRROR should be copied or hardlinked. If set to 1, copy; if set to 0, create hard links. Default: 1.

More advanced options are documented within the stock /etc/pgi/custom/options file. However, such options should be changed only with great caution.

Input Files

PGI is highly configurable through the editing of its configuration files. In addition to the variables set in the options file, documented above, there are several files that handle other aspects of the created installer, and permit customization of the installer's content. Many of these files contain internal documentation and commentary to aid you with your customizations.

Note

Keep in mind that all configuration files are specific to a codename; therefore, you will find them in /etc/pgi/codename.

extra_packages

This file contains a list of Debian package names, one per line, that should be retrieved and installed when the system is being bootstrapped. The packages are installed and set up on the target system after debootstrap runs, but before the target system is entered with the pivot_root() system call.

live.devices.list

This file contains a list of device names, one per line, that should exist in the live filesystem's environment (thus, the installer's environment). This does not affect the initrd or the target system, and the device must be in a format recognizable by MAKEDEV.

live.dirs.list

This file contains a list of octal file modes and directories, one per line, that should exist in the live filesystem's environment (thus, the installer's environment). The mode comes first, followed by a space, followed by the absolute path name of the directory desired.

live.files.list

This file contains a list of files that exist on the system hosting the PGI build, and which should be copied into the live filesystem. The live filesystem has no /usr directory, and is not FHS-compatible in general for space efficiency. The file format is one pair of filenames per line, with the source filename on the host system followed by a space and then the destination filename on the live filesystem.

logoicon.xpm

This file contains an X pixmap (XPM) which is to be used by the graphical installer for presentation in the GNOME Druid that is used in the user interface. It should be kept fairly small; 48 pixels square is a good size. XPM is a color image file format which supports transparency (but not alpha channel).

messages

This file contains the text that is to be shown to the user at the starting and ending screens of the first-stage installer. If this file is missing, some generic, hard-coded fallback text is used instead. The format of this file is the literal text to be used, surrounded by HTML-style tags. At present, the only defined tags are "start" and "end". For example:

package_list

This file contains a list of supplementary Debian packages, one per line, to be included in the Debian package archive on the ISO image(s). This file is ignored if the INSTALLER_ONLY or COMPLETE options are set. Note that it is not necessary to list here any packages that are already listed in extra_packages, depended upon by debootstrap, or depended upon by any of the packages in the aforementioned groups. Thus, it serves mainly as a convenience for the user. (Especially when the network is unavailable or unreliable, and the compelled installation of the packages named in this file is not desirable.)

postinst.sh

This file is a POSIX shell script containing whatever housekeeping and setup is necessary and desired to prepare the second stage (configuration stage) of the system installation. When this script is run, the target system has been initialized and all necessary packages for bootstrapping, as well as all packages from extra_packages have been unpacked and configured. This file is commonly used to write or copy an init script to the target system's /etc/rcS.d/ directory, which will take control of the system when the target system runs. Such an init script should ensure that is disables itself in some manner after running succesfully so that it does not run every time the system is booted.

preinst.sh

This file serves a similar function to postinst.sh, but runs before the target system has been installed; indeed, even before the installer proper has itself run. The target system is not initialized, and the target disk drive may not even be partitioned. Make no assumptions about the state of the system beyond what is known about the initrd and the live filesystem when writing this script.

root_window.xbm

This file contains an X bitmap (XBM) which is to be drawn on the screen when the graphical installer first initializes (i.e., when the X server launches). XBM is a monochrome image file format and does not support transparency. The file will be rendered with a white foreground and a black background, and will tile the root window. A good image size is 160x120, because it fits nicely into both possible resolutions that the graphical installer may come up in: 640x480 and 800x600. (At 160x120, the image's aspect ratio matches that of the display, and the image can be projected on both axes an integral number of times.)

root_window.extension

This file contains an image in any format supported by the xloadimage program. If the color depth of the root window is greater than four bits, this image will be drawn on the screen when the graphical installer first initializes (i.e., when the X server launches). The image will tile the root window. A good image size is 160x120, because it fits nicely into both possible resolutions that the graphical installer may come up in: 640x480 and 800x600. (At 160x120, the image's aspect ratio matches that of the display, and the image can be projected on both axes an integral number of times.)

sources.list.dist

This file contains an APT sources.list file for installation to the target system. It should include any desired Debian package repositories. See the source.list manual page for more information on the format of this file.

syslinux.screen*.txt.in

These files, numbered 01 through 10, correspond to the screens that the syslinux boot loader for the i386 architecture displays upon the press of the various function keys. Use the existing examples as a guide. Note that the strings @DATE@, @BUILDER@, @PGI_VERSION@, and @VERSION@ get expanded (the first to an ISO 8601 date string), and the value of the corresponding pgi-build variables described above, respectively, before these files are written to the emulated floppy image used for booting.

These files are not presently useful for the ia64 architecture.

Output Files

ISO image(s) whose names are dependent on how PGI was invoked, in OUTDIR. For example, when generating an installer-only ISO image, the codename and architecture are included; e.g., custom-installer-i386. When generating ISO image(s) with Debian package archives on them, the suite name, the machine architecture, and a disc number are included; e.g., woody-i386-1.iso.

Authors

PGI includes a derivative version of YACS, by Raphaël Hertzog, and a derivative version of debootstrap, by Anthony Towns.

PGI was written by Eric Gillespie, Jr.; Adam Lazur; Jeff Licquia; Ian Murdock; and Branden Robinson. John R. Daily, Steve Hunger, and Steven Schafer contributed to the documentation.


Appendix B. Example Configuration Files

PGI comes with two example flavors or code names, both in /etc/pgi. One, /etc/pgi/base-config, creates a second stage similar to Debian's. The other, /etc/pgi/configlets, creates a second stage using the configlets, similar to the original Progeny Debian installer.

Note

One fundamental limitation of base-config CDs, independent of PGI, is that either the CD set must be complete, or base-config must pull all packages from the network. This limitation may be addressed in a future version of base-config.

Notes

[1]

pronounced "piggy"

[2]

Actually, there is no reason you can't run the graphical installer on an X server thousands of miles distant — in some foreign country, perhaps — but we don't recommend this.

[3]

The 2.5.x kernel series is not explicitly supported, as it is inherently experimental software.

[4]

In text-mode installs, the parted command-line program is used for disk partitioning.

[5]

aside from, perhaps, screen

[6]

Note, however, that the environment is missing such things as swap space and a writeable /usr filesystem, since it consists of an eight-megabyte initial ramdisk, and the live filesystem is read-only. So don't get too carried away.

[7]

Behind the scenes, there are three stages; the first (stage 0) involves booting the Linux kernel, loading kernel modules for hardware support, and finding a live filesystem for installation.

[8]

Keep in mind that a great deal of the software in Debian GNU/Linux, including PGI itself, is licensed under the GNU General Public License (GPL). When distributing GPL'ed software, you must either provide source code or a written offer with a term of 3 years to provide the corresponding source code. A safe approach is to plan on providing at least as many source media as binary media.

[9]

On the Intel x86 architecture, ISO 9660 support is needed even if the live filesystem is mounted via NFS.

[10]

A recent calculation indicates that the Debian 3.0 ("woody") release's binary packages may barely fit on one 4.7GB DVD-ROM disc. It would, however, be a good idea to plan for two.

[11]

Source package ISOs are created by default due to the license terms of the GNU GPL and LGPL, under which a great deal of Debian software is licensed.

[12]

at least for the first stage; what happens in the second stage is up to you

[13]

due to overwhelming demand and limited bandwidth

[14]

Using the round-robin Debian mirrors in the United States can be problematic, since the Packages index file may be retrieved from one location, and the actual packages from another location which is less up-to-date. This sort of desynchronization will cause debootstrap to bomb.