Notes for Week 1

The DVD-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 DVD-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 DVD-ROM drive before booting from the hard drive. The former has been built into the ISO image on the DVD-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 DVD-ROM, you will receive a "boot:" prompt. You may boot either the Linux kernel by entering "linux" (or, if your DVD-ROM drive is the secondary IDE master, "hdc"), 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, DVD-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 (DVD-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.16.27/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 DVD-ROM on a PC on which the DVD-ROM drive is not the primary or 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 DVD-ROM drive is the primary slave, you would enter the following at the IsoLinux 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.16.27, denoting major release 2, minor release 6 and revision 16.27.
    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 DVD-ROM, and at shutdown saved your changes on, for instance, a flash drive, 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". In 265, if you want to use a flash drive, enter "sdb1".
    DVD-ROM drives typically have access times 20-30 times slower than hard drives. Running off a DVD-ROM is therefore usually a slow process, and you will definitely notice this. In addition, the DVD-ROM is obviously read-only, so you can't modify any of its files. The startup process creates two RAM Disks, each of 32 MB in length, in order to speed up system operation, and provide you with a place to modify files.

    This requires 64 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 256 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
    Number of bits in network portion of IP address24
    Broadcast Address192.168.1.255
    IP of DNS server10.228.64.129
    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 four answers will be discovered automatically during network startup. 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 "Xorg -configure" to configure X Windows for your video card and monitor. Xorg will create a file "xorg.conf.new"; you may wish to add a line
    Modes "1024x768"
    to the Display Subsections of the configuration file (these quotes are necessary!). Then install the configuration using
    install -m755 -D xorg.conf.new /etc/X11/xorg.conf
    and enter "startx". There is a small bug in the window manager and the menu configuration is not very useful as shipped; to fix them, right-click on the desktop and choose "Exit", making sure to check the "save state" box. Then run "krkfixwm" and enter "startx" again to run X Windows.

    The window manager used in this distribution is called WindowMaker. It has a nice Preferences utility (right click on the desktop and choose "wprefs" from the "programs" menu). Start it up and see what it can do. Before you quit it, go to the last control panel and click "save state on exit", and save your configuration. That way the desktop will always look the same way it did the last time you ran X.

    Right-clicking on the title bar of a window drops a useful menu; the "Attributes" item opens a control window that allows you to tailor the original window. For instance, under "Window Attributes", you can disable the title bar of the clock, and under "Application Specific" you can disable its icon.

    In general, try left-clicking, left-double-clicking, left-dragging, right-clicking and scroll-wheel-clicking 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. Open an xterm window (right-click on the desktop and choose "Xterm") and enter "endeavour2 &". Endeavour is a file manager; use it to examine the filesystem structure. You may "dock" its icon by dragging it to the dock.

    Note the files /root/lfs-6.2.in and /root/blfs-6.2.in, which contain all of the commands used in the build process for this distribution. If you right-click on any file, it will open that file in vi for examination or editing.

    emacs is a much more useful editor than vi (in this author's humble opinion), and you can tell endeavour to use emacs instead of vi, by choosing "Settings/Options" from the menu bar, choose the "Programs" tab, and change the Default Viewer entry to '/usr/bin/emacs "%paths"'. You can search for text in emacs by typing "Ctrl-s" and entering the text you wish to search for in the "minibuffer" at the bottom of the window.

    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.

    Also 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 seamonkey. Right click on the title bar and choose "Maximize" from the popup menu. Make a bookmark for www.rwc.uc.edu/koehler.

    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 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), "-fs (number)" (changes the font size, for instance, to 14) 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. If you want to print, you will have to "mkdir -p /var/spool/lpd/lp". We will return to this subject in much more detail later.
  13. 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.


©2007, 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.