Creating UBLinux

  1. Selecting Packages
  2. Creating the Distribution
  3. Editing the Boot Disk
  4. Customizing Anaconda
  5. Creating the Kickstart
  6. Making the ISOs

Creating the Distribution

Now that you have all of the RPMs you want installed, updated and free of dependency issues, we are now ready to create our distribution. First, we stored the contents of RHEL WS CD1 in /home/ublinux/i386 (for the architecture of the machine). When we copied it we made sure to include every file, especially a .discinfo file which is necessary for the installer to load. Adding CDs 2-4 is unneccesary, as the only pertinent information they contain is additional RPMs. We then remove the following:

hdlists (these will be generated later)
rm /home/ublinux/i386/RedHat/base/hdlist*

RPMs
rm /home/ublinux/i386/RedHat/RPMS/*

TRANS.TBL files (trash files, every directory will have one)
find /home/ublinux/i386 -name TRANS.TBL -exec rm -f {} \;

We will also copy the following files out to edit at a later time. These are the Anaconda image and the Bootdisk image files. If you do not wish to alter these, it is safe to ignore this step.

Anaconda
mv /home/ublinux/i386/RedHat/base/stage2.img /home/ublinux/

BootDisk
mv /home/ublinux/i386/images/bootdisk.img /home/ublinux/

We are now ready to begin. First, we need to install anaconda-runtime and its packages. These will provide the scripts we need to build our own distro. These RPMS are included in RHEL WS 3 Update 2.

anaconda-9.1.2-2.RHEL.i386.rpm (Disc 4)
anaconda-help-9.1-3.RHEL.noarch.rpm (Disc 3)
anaconda-images-9.1-3.RHEL.noarch.rpm (Disc 3)
anaconda-runtime-9.1.2-2.RHEL.i386.rpm (Disc 3)

Make sure these are all installed on the build system.

cp /mnt/iso3/RedHat/RPMS/anaconda-* /home/ublinux/
cp /mnt/iso4/RedHat/RPMS/anaconda-* /home/ublinux/
sudo rpm -Uvh /home/ublinux/anaconda-*

Now, let's copy all the RPMs we want to install in our distro.

cp /home/ublinux/RPMS/* /home/ublinux/i386/RedHat/RPMS/

To prevent any errors with the subsequent scripts, we'll run the anaconda-runtimes scripts as root.

su -

Then, to prepare to run the anaconda-runtime scripts, we'll need to set the PYTHONPATH variable. If we don't do this, some scripts (such as pkgorder) will not be able to load required modules.

export PYTHONPATH=/usr/lib/anaconda

The first step in running these scripts is to regenerate the hdlist files from our current set of RPMS.

/usr/lib/anaconda-runtime/genhdlist /home/ublinux/i386

Please note the script requires the FULL path of the build directory. Using a relative path (such as /usr/lib/anaconda-runtime/genhdlist i386) will cause the script to fail with a "No such file or directory" error.

Next, we run a script to determine the order in which the packages will be installed, and we store that information in a file for later use.

/usr/lib/anaconda-runtime/pkgorder /home/ublinux/i386/ i386 > /home/ublinux/pkglist

Please note that if you forget to set the PYTHONPATH variable, you will receive the following error:

Traceback (most recent call last):
  File "/usr/lib/anaconda-runtime/pkgorder", line 10, in ?
    import whiteout

If we wanted to generate our own Anaconda, we could do so with anaconda-runtime's buildinstall script. However, we had some trouble doing that, namely we'd get an error stating

Traceback (most recent call last):
  File "/tmp/treedir.5588/instimage/usr/lib/anaconda-runtime/pkgorder", line 10, in ?
    import whiteout
      ImportError: No module named whiteout

even though the PYTHONPATH variable was already set. It was later concluded that the reason we received this error was that buildinstall believed that we were trying to build a non-WS3 distro on a WS3 machine. While this was not the case, it's possible that because we used a different RPM list than WS3, the script became confused and failed. Without proper documentation for these anaconda-runtime scripts, we were unable to resolve this issue. Instead, we opted to modify stage2.img directly. This is documented in "Customizing Anaconda".

Next, we need to split the distro into sizes friendlier for CD media. With UBLinux 2, we used the splitdistro script in conjunction with build_distro. However, with this version of anaconda-runtime, splitdistro has made way for splittree.py, and has made the build_distro obsolete. To use splittree.py, we run the command

/usr/lib/anaconda-runtime/splittree.py --arch=i386 --total-discs=3 --bin-discs=3 --release-string="UBLinux 3" --pkgorderfile=/home/ublinux/pkglist --distdir=/home/ublinux/i386 --src-discs=1 --srcdir=/home/ublinux/i386/SRPMS

Please note that you need to specify the --src-discs and --srcdir even if you don't intend to have any source discs in your distro.

We also received an error occasionally (though I was unable to replicate it for the purposes of this documentation). Most errors I received were due to extra carriage returns created by cutting and pasting the command, which were resolved by typing it out instead.

Please note that UBLinux 3.0 is on three CDs. If your distribution is on fewer (or more) CDs, please keep this in mind for the following commands, which are executed on every CD.

The CDs will be in folders inconveniently marked as -disc1, -disc2, -discX, etc, which makes them slightly difficult to target (often being misinterpreted as command line arguments). So it's a good idea to resolve this first

mv /home/ublinux/i386/-disc1 /home/ublinux/i386/disc1
mv /home/ublinux/i386/-disc2 /home/ublinux/i386/disc2
mv /home/ublinux/i386/-disc3 /home/ublinux/i386/disc3

The last command that needs to be done is to regenerate the hdlist files one more time, now that the RPMS are spread across multiple CDs. This will also allow hdlist to take into account the current package order.

rm -f /home/ublinux/i386/disc1/RedHat/base/hdlist*

/usr/lib/anaconda-runtime/genhdlist --withnumbers --fileorder /home/ublinux/pkglist /home/ublinux/i386/disc[123]

There you have it. You should now have a working customized distro of RHEL WS 3, if you have no intention of altering the bootdisk and anaconda. If this is the case, move forward to "Creating the Kickstart".

For UBLinux 3, however, we wanted to change all of the Red Hat images. We started first with "Editing the Boot Disk".


Back to Technical Documentation index

Send Questions and comments to ublinux-support@buffalo.edu.

Last Modified 9/02/04 1:16pm