LFS Project Grade

Due: April 19th

Given all the work you have poured into your LFS and how well you have done so far. I have decided to grade based on completing various tasks. The tasks are designed to have you create a more and more useful system. In other words, you will be graded based on getting a working system together. Graduate students are, as always, expected to preform at a higher level than undergraduates. This lead to two rubrics based on your classification.

Rubrics

Undergraduate Students (4360)
% GradeWhat to do
70Finish Chapter 7
75Finish Chapter 8
80Finish Chapter 9, i.e. system boots
90Install Xorg
95Install Openbox Window Manager
100Install Firefox

Graduate Students (5397)
% GradeWhat to do
60Finish Chapter 9, i.e. system boots
70Install Xorg
75Install Firefox
85Install A Desktop Environment
100 Fully Customized System

These, these are up-or-down, all-or-nothing grades. Each level must be completed successfully before you can move onto the next step. However, unlike previous chapters I will not grade it piecemeal. You will need to get as far as you can, and then I will assign your grade. Further I will only grade it once, so you only get one chance! Also, I will not accept the project late.

Chapters seven through nine are not nearly as difficult as chapters five and six. Chapter eight is the most difficult and finicky of the three. I recommend you try your best to finish chapters 7–9 by Friday, March 14th. That will give you plenty of time to work towards a higher grade.

Remember this project is worth 20% of your final grade! It is due on April 18th. There is no reason you should not get a 100%.

General Advice

Below you will find some advice that will make your time in our very limited environment much easier to deal with.

Make Use of The Virtual Terminals

Remember your system has several virtual terminals that can be accessed via Host-F* (where Host is the host key used by Virtualbox). I personally had one terminal for the batch build, one for the web browser, and one for building dependencies.

Using w3m

The w3m is the only web browser available on our new system. The w3m browser downloads files into the current directory. So before running it, change to the /sources directory. Also, w3m misinterprets patch files as plain text files that should be shown. So, you will need to use the Save Link function in order to download the patches. Below is a manual on how to use w3m.

It can be difficult to read web pages in the w3m web browser. I personally only used the browser for downloading and copy-paste operations. I had a browser open in my host environment that I used to actually read the book and these notes.

Mouse Issues

To use a mouse in a console only environment requires a special program to interpret the signals sent by the mouse device. This special program is called gpm. Unfortunately, gpm does not correctly recognize our mouse leaving and/or entering the captured area of the Virtualbox window. This means that your cursor quickly becomes out of whack. To fix this you need to turn Mouse Integration off. To do this press Host-I. You will now have to click in the window for the mouse to be captured. To release the mouse from the window, simply tap the Host key.

If you do not have a three button mouse, as is the case on most touch pads, you can make gpm pretend your right mouse button is the middle mouse button. Simply change the configuration file below:

/etc/sysconfig/mouse
# Begin /etc/sysconfig/mouse

MDEVICE="/dev/input/mice"
PROTOCOL="imps2"
GPMOPTS="-B 132"

# End /etc/sysconfig/mouse

If the mouse stops working issue this command to restart the daemon.

/etc/init.d/gpm restart

Creating The BLFS Environment

Before doing anything from the Beyond Linux From Scratch book you need to setup a little bit better environment. These environmental changes are necessary to setup certain environment variables and to get working boot scripts.

Clean Up The System

You do not have a lot of space on your hard-drive. So we need to get rid of files we are no longer going to use. This will free almost 1.5GB of space.

Start by deleting the /tools directory. This directory contains the packages we installed in chapter five which are no longer needed. We also need to clean out the /sources directory. Delete the contents of the /sources directory (not the directory itself). We are still going to build all the packages below in the /sources directory.

Download The Book

They sometimes update the book in March. This has caused students to accidentally break their systems. To solve this download and unpack the book in the root user's home directory. From then on you can use w3m to view the various web pages in the book.

wget http://www.linuxfromscratch.org/blfs/downloads/7.4/blfs-book-7.4-html.tar.bz2
mkdir blfs
tar xf blfs-book*.tar.bz2 -C ~/blfs

There is an error in the book. All of the URLs for the *.patch files are wrong. Needless to say this makes downloading the patch files difficult. Run the following mini-script to fix all of the URLs.

for d in ~/blfs/*/ ; do
    sed -i 's|/patches/blfs/svn|/blfs/downloads/7.4/patches|g' $d/*.html
done

Basically, the script goes through all of the HTML files and replaces the incorrect URL path with the correct one. You will get two errors that it could not find *.html files inside two of the directories, this is fine.

The Bash Shell Startup Files

Before starting on the Xorg build, do the The Bash Shell Startup Files section in chapter three of the BLFS book. This step is necessary in order to setup some needed Xorg build environment variables.

~/blfs/postlfs/profile.html

At one point during this section they will have you create the /etc/profile.d/i18n.sh file. You will need to specify your language setting. Our system uses en_US.iso88591.

You can also make your life easier by adding a these aliases. These aliases allow you run the configure-make-make-install with only a few keystrokes. Put them at the end of ~/.bash_profile file.

alias cmi='./configure --prefix=/usr --sysconfdir=/etc --disable-static && make && make install'
alias mi='make && make install'
alias xc='./configure $XORG_CONFIG'
alias xcmi='./configure $XORG_CONFIG && make && make install'

After completing this section log out then log back in. That way your new settings will take effect.

Xorg Notes

Xorg is a software system and network protocol that provides a basis for graphical user interfaces. Xorg must be installed from your LFS system not the LiveCD. Basically, installing Xorg consists of following the steps found in the Beyond LFS book. The basic system is much like chapter six, except with a lot of downloading. You must install Xorg-7.2, a.k.a The X Window System. Only do chapter 24, a link to this chapter can be found below.

~/blfs/x/installing.html

When given a choice about what version of Python to install, choose 2.7.5. You will also need to install the optional animated png functionality in libpng (required later by Firefox).

Build Advice

Batch Builds

Some of the Xorg builds can be done using a batch system. These types of builds require you to create a md5sums file and use wget to download the file. The BLFS book assumes you will be building stuff as a non-root user. For us this just adds unneeded complications. You do not need to install sudo.

Create the following function. It will allow you to use the directions as is. The function basically just runs any commands given it. It only exists so we do not need to alter the book's directions.

cat > /etc/profile.d/as_root.sh <<EOF
as_root() {
    $*
}
export -f as_root
EOF

Required and Recommended Packages

Xorg is dependent on a lot of individual packages. The book lists out theses packages. They come in three types.

  1. Optional. These packages must be ignored.
  2. Required. Without these packages you cannot succeed. So they must be installed.
  3. Recommended. These packages are technically optional. However, you will need to alter the build system if you do not install them and some of the packages will not work as expected. In other words, you must install these packages.

You will have to drill down through the dependencies. Many packages depend on other packages, which depend on yet more packages. These packages are installed much the same way you installed the packages in chapter six. However, you will have to download and install them by hand. This is by far the most time consuming part of the build. Frequently, a package depends on another package that you have already installed. Be careful that you do not end up installing the same package twice as it wastes time. I ended writing each package name down on paper to make sure I did not do this.

$XORG_PREFIX

The introduction section will ask you to create a variable that will hold the future installation directory. Be sure to specify /usr as the installation (prefix) directory. Note, you only need to do about half the directions, the rest are only applicable if you are installing Xorg somewhere besides /usr.

After finishing the introduction, be sure to log out and then log back in so the variables will take effect.

The Drivers Package

You only need to install two of the available drivers: the Evdev and the VESA drivers. The kernel options needed for these drivers have already been enabled in chapter eight. Make sure you compile the mtdev package before making the Evdev driver.

Perl Modules

One module will be dependent on a Perl module having been installed. Lucky for us the Perl language has it own built in package manager called cpan. If you look at the bottom of the page in the section on Perl modules, the book has a brief description on how to install a module using cpan. I highly recommend you use this method to install Perl modules because it calculates and installs dependencies for you.

Build Time

To install Xorg and all of its dependencies will take you a lot long time. This is a really complex build. It took me six and a half hours to do it. Take your time because it is really easy to forget to install one of the dependencies.

Testing Xorg

At the end of the chapter, the book is going to have you test if you installed Xorg correctly by issuing the command startx. If it works it will automatically switch you to virtual terminal seven and show you a black desktop with some xterms and a clock running. This desktop by itself is really terrible. To exit the desktop change back to the virtual terminal you issued startx from and press Ctrl-C. Xorg hates being closed this way, so it may print some errors, do not worry about them.

startx

If your windows are arranged differently, or are overlapping do not worry about it. It is not an error.

OpenBox

This build is fairly straight forward. Just follow the directions outlined in the book, that is all you need to do. Remember to drill down the through the dependencies. The pertinent section in the book is below.

~/blfs/x/openbox.html

You can start programs by right-clicking on the desktop area. You will immediately notice that the menu is bonkers. The menu is drawn based on an XML file.

To fix the menu you will need to hand edit the XML file. The menu is in /etc/xdg/openbox/menu.xml file. If you are going to install Firefox be sure to leave its entry in the menu. Undergraduate students, this menu must be correct in order for Openbox to count towards your grade.

You can exit Xorg using the Log Out menu item. Below is a screen shot of what the desktop looks like with the crazy menu.

Openbox Desktop

Firefox Web Browser

Build takes up too much space

Last year we did this build and it only used up 3.5GB of space. But one year latter, and the build will no longer fit on our 4GB build disk. We are going to have to do something "clever" to fix this.

What you need to do is create a new hard-disk that is 10GB in size. Why that number? I found some documentation that hints we need at least 8GB. We are using an inflated size as a cushion.

To create the disk and make it usable do the following:

  1. Turn off the VM. You can do this using the halt command.
  2. Open the settings dialog for your VM.
  3. Select the storage pane. Click on the Controller SATA item and click the Add Hard Disk button.
  4. Click create new disk. Proceed through the dialog, just be sure to make the drive's size equal to 10GB. If you are using a FAT32 formated USB drive, save the VDI file onto the actual computer's hard drive.
  5. Start your VM.
  6. You new hard drive should be /dev/sdc. Partition the disk such that the disk only has one big partition.
  7. Create an ext4 filesystem on our new partition.
  8. Mount the partition.
    mount -v -t ext4 /dev/sdc1 /mnt

Now instead of downloading and building in the /sources directory, build Firefox in the /mnt directory.

I know this is a kludge. I did not discover this until you were about to turn in chapter 4. So rather than have you redo chapters 1-4, I created this work around.

Build Advice

To build this package simply follow the directions laid out in the BLFS book. Unlike the Xorg build you need to skip the recommended dependencies with one exception. The configure script has a bug in it. To work around the bug you must install the optional yasm package. You will still need to build the recommended packages for Firefox's dependencies.

Be sure to carefully read the directions concerning the mozconfig file. This file will require editing. Improperly editing this file is the number one reason the build fails. Otherwise, just follow the directions in the book.

~/blfs/xsoft/firefox.html

The URL for downloading the Firefox tar-ball in the book is wrong. Mozilla is in the middle of moving their primary server to a new URL. The URL listed in the book refers to the old address. The URL below should be the correct one.

http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/23.0.1/source/firefox-23.0.1.source.tar.bz2

Making A Complete Distro

This exercise is for graduate students only. Undergraduate students should skip this section.

Throughout the semester I have asked graduate students to perform assignments that often require some level of research. I do this because it simulates real life, where the solutions to problems are not found in textbooks. In this case, you have to use your ingenuity to install, properly configure, and use complex pieces of software. The goal of this part of the project is for you to get a working distro with a GUI interface.

You are free to choose any of the desktop environment's listed in the BLFS book (KDE, Gnome, Xfce). You will need to figure out how to install them on your own. Warning, Gnome is really hard to install, I would recommend you install one of the other two.

I recommend that you install Openbox and Firefox before starting this section. Firefox is required anyway. Desktop environments require the installation of many packages. It is easier to navigate the book if you looking at it in Firefox rather than w3m.

Fully Customized System

To qualify for the full 100% grade you have to make a Fully Customized System. What does this mean? Your system will have to have the following properties for a newly created user:

  1. It boots directly the display manager, not the console.
  2. A newly created user can log in.
  3. The new user's desktop uses a non-default background.
  4. The new user's desktop is completely configured with working icons.
  5. The environment must have a text editor and a terminal emulator besides xterm.

Known Issues

These are known problems encountered by students as they were competing this section of the build. They are listed here to help you avoid the pitfalls other students fell into.