Notes for Week 1

The CD-ROM you have been given is a self-contained, bootable Linux distribution built by Professor Koehler and based on the Linux From Scratch Project. The goal for week 1 is to learn how to use it as a stand-alone operating system, without installing it on your hard drive.

You will find repeatedly that it is vitally important for you to know the details of your PC hardware. This distribution has been built for 32-bit Intel-compatible processors of Pentium II class or higher. It will not work on older processors (for instance, Pentiums or AMD K6s). It has been tested with the PCs in Muntz 265 (henceforward called "the lab PCs"); as is so often the case, your mileage may vary... There is no warranty of any kind, but bug reports will be cheerfully considered and possibly fixed. Expect problems to occur; it will make this course more like real life.

  1. In order to boot from the CD-ROM, two things are necessary: it must contain an El Torito Standard image of a bootable floppy, and you must make sure that your BIOS knows to boot from the CD-ROM drive before booting from the hard drive. The former has been built into the ISO image on the CD-ROM. For the latter, on the lab PCs, you access the BIOS Configuration Program by pressing the F2 key during boot. You must then ensure the boot sequence is correct.
    On some systems, you must change the order back to what it was to allow booting from the hard drive once more. Other systems are more intelligent...
  2. After booting from the CD-ROM, you will receive a "boot:" prompt. You may boot either the Linux kernel by entering "linux root=/dev/hda" or a memory tester by entering "memtest" (all entries are to be typed without the quotes) and then pushing the Enter key.
    The IDE ("Integrated Drive Electronics") interfaces on most modern motherboards provide for two cable connections: a "primary" and a "secondary". These interfaces have their own IRQs, and can function independently for a large degree of simultaneous operation. Each of the interfaces supports up to two drives (hard drives, CD-ROM drives, Zip drives, CD burners, etc.), one of which is responsible for controlling the other: the controlling drive is the "master", and the controlled drive is the "slave". Devices which support high usage rates (hard drives) or which can be subject to "data underruns" (where the drive can run out of data and ruin an output operation; for instance, a CD burner), should be masters. Less heavily accessed or important drives (CD-ROM and Zip drives) could be slaves.

    One of the things which makes Unix systems easily portable to new hardware architectures is the "device file" software interface for device drivers. Each hardware device is defined using a file in the /dev directory; the file occupies no space on the system (except for it's file information; see "inodes" in week 2). It serves to determine the device driver for the device, and (essentially) all device drivers interface to the kernel in the same way. Each device is defined as a "character" device or a "block" device, depending on whether the device transfers data one character at a time or in blocks of multiple bytes. It further has a "major" and "minor" device number (defined in the file /usr/src/linux-2.6.12.3/Documentation/devices.txt) which serve to identify the class of device and the specific driver in the class which controls the device.

    The primary master (the DVD drive on the lab PCs) is called /dev/hda; the primary slave is hdb, the secondary master is hdc and the secondary slave is hdd.

    If you boot the CD-ROM on a PC on which the CD-ROM drive is not the secondary master, you will need to supply a parameter so that the Linux kernel knows where to find the root filesystem (where the system software resides). If, for example, your CD-ROM drive is the primary slave, you would enter the following at the LILO prompt:

    linux root=/dev/hdb
    "linux" is the label of the compressed kernel image (the file which contains the kernel) on the El Torito floppy image. Our kernel version is 2.6.12.3, denoting major release 2, minor release 6 and revision 12.3.
    Many modern PCs also have "SATA" hard drives (as do the ones in the lab). SATA stands for "Serial AT Atachment", where AT refers to the original IBM PC which supported hard drives. SATA drives use the "ATAPI" (ATA Packet Interface), which use the "SCSI" (Small Computer System Interface) commands. For this reason, SATA drives are not described using "hd" device files, but rather "sd" device files. The hard drives in the lab are /dev/sda. In a similar vein, flash drives will be /dev/sdb, /dev/sdc, etc., in the order in which they are inserted after booting.
  3. As the startup process unfolds, a large number of status messages are displayed, far too quickly to read as they happen. To scroll up and down through the display, you can use "Shift-Page Up" and "Shift-Page Down".
  4. The startup process will ask for a device name for backup. If you have run this distribution previously from the CD-ROM, and at shutdown saved your changes on, for instance, a zip disk, you can incorporate those changes into this boot session so that the system is in the same state it was when you last used it. If not, just enter "none". If you want to use a Zip drive for this purpose, enter "hdd4"; in 265, if you want to use a flash drive, enter "sdb1".
    CD-ROM drives typically have access times 20-30 times slower than hard drives. Running off a CD-ROM is therefore usually a slow process, and you will definitely notice this. In addition, the CD-ROM is obviously read-only, so you can't modify any of its files. The startup process creates three RAM Disks, each of 16 MB in length, in order to speed up system operation, and provide you with a place to modify files.

    This requires 48 MB of free RAM over and above the kernel and any software you care to run. For this reason, this distribution will only run well on PCs with at least 128 MB of RAM.

  5. If you did not restore a backup, the startup process will now ask a series of questions to configure the system. The first is for the root password.
    "root" is the login name for the system administrator. root can do anything, and the system usually assumes that anyone logged in as root knows what they are doing. For this reason, you should create an ordinary (non-root) user using the useradd and passwd commands, which you will use to do most of your work. You can log in as the ordinary user, and use the su command to change to root temporarily if you need to do something privileged.

    In 265, the root password MUST BE "lab265". Throughout the course, I will connect to your system as root in order to check your progress, so everyone's root password must be the same. ANYWHERE ELSE you should choose a combination of upper and lower case letters and numbers, at least 8 characters long, which you can link to a phrase and/or date which you can remember. DO NOT WRITE IT DOWN - system administrators should be able to remember their passwords.

  6. The rest of the questions are for networking configuration. In 265, the questions and answers are as follows ("pnn" refers to the patch panel and port number your PC is connected to, and will be given to you by the instructor):
    QuestionAnswer
    hostnamecpnn.lab265
    IP address192.168.1.pnn
    IP of gateway192.168.1.1
    Network Mask255.255.255.0
    Broadcast Address192.168.1.255
    IP of DNS server10.228.64.106
    IP of Printer192.168.1.3
    If any of these are entered incorrectly, networking will not function properly. They can still be fixed, but you have to wait until week 5.

    If your PC is permanently connected to an Internet Service Provider, you may enter "DHCP" for the IP address and the next three answers will be discovered automatically during network startup. However, if your network interface card (NIC) is not a 3COM Vortex card (ie., 3C59x or 3C90x) or a RealTek RTL-8139, it will not initialize without intervention on your part. After logging in as root (below), determine the module name for the driver for your NIC (look in Kconfigs, which is a compendium of Kconfig files in the 2.6 kernel source; for instance, if you have an Intel EtherExpress PRO/100 PCI NIC, the module name is eepro100). Then execute the following commands, replacing "modulename" with the name for your NIC:

    echo "alias eth0 modulename" >> /etc/modules.conf
    modprobe modulename
    /etc/rc.d/init.d/network restart
    If you dial in to UC's network with a modem, this ppp perl script may help. Just make it executable (chmod 755) and run it from an xterm window. If you do this, answer "none" to the question about IP address during startup.
  7. At the "login:" prompt, enter "root"; at the password prompt, enter "lab265". You must first run the command "xconfig" to configure X Windows for your video card and monitor. Then enter "startx" to start X Windows.
    The xconfig command is not fool-proof, and the results may not be optimal, but they should work. Further details are also part of week 5.
    The window manager used in this distribution is called WindowMaker. It has a nice Preferences utility (right click on the desktop and look at the bottom of the "Appearance" menu). In general, try left-clicking, left-double-clicking, left-dragging, right-clicking and both-clicking (clicking both mouse buttons simultaneously, which emulates the third mouse button) on every window and desktop widget you can find (title bars, scroll buttons, etc.) and you will know everything there is to know about the window manager.
  8. Double click on the middle dock icon (in the upper left corner of the desktop) to examine the filesystem structure using Endeavour2.

    Note the file /root/installed, which contains a list of all files used in the build process for this distribution. If you right-click on any file, it will open that file in emacs for examination or editing. You can search for text by typing "Ctrl-s" and entering the text you wish to search for in the "minibuffer" at the bottom of the window.

    Also note the use of /var and the symbolic links in /. All subdirectories of the root directory (/) which contain files which are usually modifiable have been consolidated in /var, which is on one of the RAM disks.

    Note the difference between left and right clicking on the upper left corner of the Endeavour2 window.

  9. Right click on the desktop and start Mozilla. Right click on the title bar and choose "Maximize" from the popup menu. Note the presupplied bookmarks.

    To search for text within a web page, just click in the window and type the text you wish to find. You can find additional occurrences using "Ctrl-g".

  10. Use multiple Xterm windows (right-click on the desktop and choose "Xterm") to do several things at once at command prompts. Use the '&' suffix with shell commands to run them asynchronously with respect to the shell. Several xterm parameters of note are "-fg (color)" (changes the foreground color), "-bg (color)" (changes the background color) and "-sl (number)" (which increases the size of the display buffer, so that more previously displayed lines are available using the page up and down keys).

    The system is set up to use bash for the shell. Bash supports filename completion (type a partial file name and push the "Tab" key, and bash will attempt to find the correct file and fill in the rest of its name) and command history (accessed by using the up and down cursor arrows on the keyboard).

    You can copy and paste any text between windows by highlighting the text you wish to copy (which automatically copies that text into a paste buffer) and then, after positioning the cursor where you wish to paste the text, pushing both mouse buttons simultaneously.

    If you are used to using more to paginate output, try less instead. it supports the usual keys (up and down arrow, "space" to go down a page and "q" to quit), but it also allows paging backward using the "b" key. It also supports backward searching using "/(pattern)" and "N" for the next ("n" still works in the forward direction).

  11. xman can be used to examine which manual pages are available by section, and read those of interest. Sections of interest are 1 (user commands), 4 (devices), 5 (file formats) and 8 (administrative commands). apropos, man, whatis and which can also be used to interrogate the man pages, and info can be used to obtain more detailed information (in many cases).
    Nearly all commands have some default behavior (which takes place if options or parameters are left off). Be aware of the default behavior of the commands you use; as an example, if the user parameter is left off of the passwd command, the password of the user running the command is changed!
    Many of the man pages are "incomplete"; in these cases, the real documentation is in the "info" page. For instance, "man grub" produces a short summary of the grub command, while "info grub" is a small book on the subject. info navigation uses the following keys:

    • "space", up and down arrow and "q" all work like they do in more or less;
    • cursor to a line in the table of contents and "enter" takes you to that section;
    • "n" and "p" go to the next and previous sections, respectively, and
    • "u" goes up one level in the info structure.
  12. To quit X Windows, right click on the desktop and choose "Exit" (or in a pinch, type Ctrl-Alt-Backspace).

    If you will want to backup your session onto a flash drive, insert the drive BEFORE you shut down; then answer the backup question with "sdb1". The filesystem on the flash drive must be a VFAT filesystem for the backup to work properly.

    To shut down the system, enter either "shutdown -h now" or "reboot" or "Ctrl-Alt-Delete" at the command prompt (after exiting X-windows). NEVER TURN THE PC OFF WITHOUT FIRST SHUTTING DOWN OR REBOOTING.

    The single most common cause of PC problems is improperly-terminated software.


©2005, Kenneth R. Koehler. All Rights Reserved. This document may be freely reproduced provided that this copyright notice is included.

Please send comments or suggestions to the author.