RedHat Linux Free Tutorial

Web based School

Red Hat Linux rhl03

Previous Page TOC Next Page



3


Installing and Updating Linux


The process of installing Red Hat Linux is straightforward, although there are lots of little problems scattered throughout the process that can cause hassles. Red Hat Linux is much easier to install than many other versions of Linux, so you will find the installation goes quite easily. Common errors that you might make are handled nicely by the Red Hat installation program, and the system is versatile enough to handle most configuration requirements.

The essential steps for installing Red Hat Linux are as follows:

  1. Create boot and root disks.

  2. Boot Linux from floppies.

  3. Partition the hard disk.

  4. Create a swap file.

  5. Create a Linux file system.

  6. Install the Linux software.

  7. Configure the kernel.

  8. Set the boot process.

  9. Reboot into Linux from your hard disk.

The process is similar whether you are installing from a CD-ROM or from a diskette (which may have come from an FTP site, for example). Because the CD-ROM is the most common form of installation (and the one included with this guide), it is used as the example in this chapter.

If you are installing from a floppy and have downloaded the distribution files from an FTP site or copied them from a CD-ROM, you will need a DOS-formatted floppy for each disk in the distribution disk set. You can use standard DOS copy commands to copy the disk set files to the floppy, one floppy for each file in the distribution set. The files are all numbered so you know which floppy is in which set, and what their order should be.

Installing Red Hat Linux


Unlike some versions of Linux, Red Hat gives you a number of methods of installing its operating system that offer versatility and ease of use. For most people, installation will be a very simple task with most of the process automated by the Red Hat installation routines. Users with some special hardware or disk-layout problems will have to perform a more typical manual installation of Linux. This chapter covers all the steps you need to install Linux manually, as well as the brief instructions you need to allow an automated installation.

If you want to try an automated installation of Red Hat Linux, there are two ways to go. One is called floppyless, as it uses a routine on the CD-ROM to install itself. This step simply saves you the trouble of making floppy diskettes; the rest of the installation process is exactly the same.

The alternative to floppyless installation is to create boot and root floppies and use those to start up the system and access the CD-ROM. The following sections discuss both floppyless and floppy-based methods in more detail.

Floppyless Installation


If your hard disk already has an operating system like DOS, or one that produces a DOS window, you can try installing directly from the CD-ROM. Boot into your existing operating system, change to the CD-ROM drive, and issue the command


REDHAT

at the DOS prompt. You will be asked a series of questions by the program that help it determine the best images for the boot kernel. You can also provide any special startup installation commands during this stage.



Do not run the floppyless installation process from inside a Windows or OS/2 session. Boot your system into DOS or DOS emulation and run it from there.

The floppyless installation routine guides you through the kernel determination process by displaying all possible choices on menus and prompting you for your answers. The process is intuitive and can be used by anyone who knows the type of hardware installed on their system. If you are not exactly sure of hardware, you can still try the floppyless installation; the worst that can happen is you must try again with different settings.

If the installation process detects some hardware-configuration issues, it may offer you advice on setting parameters or making changes. These bits of advice are, for the most part, just that: advice. You don't have to heed the advice if you don't want. In some cases, the advice makes a lot of sense (such as resolving IRQ conflicts), in which case you should take care of the issue.

Floppy-Based Installation


A floppy-based installation requires you to produce three floppies: one for the boot (kernel) image, and two for the root or swap images. The following section, entitled "Boot and Root Floppies," looks at the production of these floppies in detail. After these disks have been produced, your system is booted with the boot floppy in drive A:. After the kernel has been read and some diagnostics have been performed, you are prompted for the first of the root or swap floppies, then the second floppy, and then the installation procedure is started.



A quick word of advice when using floppies: Red Hat Linux is particularly sensitive to fast floppy changes. If you hit the Return key too quickly and the floppy is not in the drive, you will probably get errors and have to start the boot process all over again. This occurs when booting and Red Hat asks for the first and second swap or root floppies. Make sure the diskette is in the drive, wait a few seconds, then hit Return to prevent any problems. The disk-change process is not as forgiving as DOS or Windows!

After the boot and root floppies have been loaded, the normal Red Hat Linux installation routine is started.

The Red Hat Installation Routine A Quick Guide




This section gives you a quick overview of the installation routine and can be used by those experienced with Linux or very simple hardware setups. If you run into any problems at all during the installation process, check the more detailed sections later in this chapter.

After you have successfully loaded your boot and root images either from disk or CD-ROM, you are launched into the installation routine. The Red Hat Linux distribution has a very useful menu-driven installation routine that is much more forgiving of errors than many other Linux versions. For the most part, you need only read the screens and make logical choices to have the installation process continue properly. Many of the steps are automated and occur without your intervention.

If something happens with the automated installation routine that causes an error, a warning on the screen is displayed and you will be dropped into a manual installation routine. This can be used just as easily as the automated routine; it just takes a little longer. Again, menu-driven options make the process painless.

You can probably install Red Hat Linux on your system based entirely on the automated installation routine. If this is the case, you can move on to other chapters in this guide. The rest of this chapter covers some of the most important steps in setting up and installing a Linux system in more detail. If you encounter problems during the installation, or want to make changes to your configuration, you can check the respective sections later in this chapter. For now, you can take a quick look at each of the steps in the automated installation process.

Choosing Text or Graphics Installation


Red Hat Linux gives you two choices for installation: text-based or X-based. If you have installed Linux before or are familiar with operating systems, you can use either with equal confidence. The graphical interface installation using X is a more visually pleasant installation process, and it is a neat aspect of Red Hat Linux.

On the other hand, the text-based installation process is more traditional and familiar to veteran Linux users. If you are unsure of how to use X, or not sure of your system configuration with respect to mouse and video card, you should stay with the text-based installation. It guides you through each step with full descriptions on the screen.

Setting Up Your Hard Drive


If you have not set up Linux on your system before, or you need to allocate partitions for Linux on your system, you will need to use a disk-partitioning scheme. Red Hat Linux gives you a choice of two disk partitioning utilities: fdisk and cfdisk. The fdisk utility is similar to the DOS FDISK program. It is covered in more detail later in this chapter, in the section entitled, "Installing the Linux Partitions."

The cfdisk utility is similar to fdisk but is a little more friendly. Many people find cfdisk easier to use than fdisk, as it uses simple mnemonic commands to perform each function. The choice of partitioning utility is entirely up to you: they both do the same job.

If you have set new partitions on your hard disk for Linux, you will have to reboot your system to make them effective (don't forget to write the partition table to disk when you exit either fdisk or cfdisk!). After a reboot, start the installation process again either from your boot floppies or the CD-ROM, and the new disk partitions will be recognized by Linux.

Formatting the Partitions


After the disk partitions are set, Red Hat will try to detect your swap partition. The installation routine will display a window with the device names of all your swap partitions listed. To format the swap partition, choose one of the partitions listed (or the only entry if you set up only one swap partition) and choose Yes from the menu to start the formatting. The process takes about a minute, depending on the size of the swap partition.

After the swap partition has been formatted and made available to the kernel, the installation routine detects any Linux data partitions. These are displayed with the option to format them. For a new installation, you should format the Linux partition using this screen.

Setting Up Ethernet


During the swap and Linux data-formatting process, Red Hat asks if you want to install Ethernet now. If you have an Ethernet card in your machine and want to set it up while the installation process is running, you can do so. If you don't have an Ethernet card or want to delay the installation for later, that's fine, too; you can skip a few steps.

If you elect to set up Ethernet now, you are asked for a machine name and a domain name. After that, you are asked for the IP address of your machine and the subnet mask (which is generated automatically and probably doesn't need changing). A few other configuration settings based on the IP address may be displayed. Again, the default settings are fine for almost every system.

You will be asked if your machine uses a gateway. If you use a separate machine to access the Internet or another network, answer Yes. If you use a gateway, you will be asked for its identification.

You will also be asked if there is a nameserver to be used by this machine. If your network has a DNS (Domain Name System) server that performs IP address conversions, answer Yes and supply its identification. Otherwise, answer No. You can always add a nameserver later, after the system is up and running.

Setting Up the Mouse


After a message about the Metro-X server supplied with Red Hat Linux and a selection of the type of graphics card to use (if in doubt, select standard VGA or SVGA), you are asked for the type of mouse attached to your system. Select the entry that matches the type of mouse you use, or one that is compatible with your mouse.

You are then asked which device your mouse is attached to. In most cases, the mouse is attached to COM1 (/dev/ttyS0) or COM2 (/dev/ttyS1). Select the proper entry. If you are not sure which port your mouse uses, select COM1; it is the most common configuration.

Configuring X


If you have selected the X-based installation routine, Red Hat Linux tries to determine your video system so it can start X. If you are using the text-based installation routine, this process is skipped for now.

In most cases, Red Hat Linux will try to set up the X system by checking the type of video card you have. You will probably see a message asking if you want the installation routine to "autoprobe," which means it will try to determine the type of video card and video chipset installed on your machine. If you have a particular reason for not autoprobing (some video cards will hang if they are sent the wrong sequence), you will have to manually supply the configuration information. If you are unsure whether or not autoprobing should be allowed, let it go ahead and try. The worst that can happen (usually) is that the system will hang and you have to reboot.

After autoprobing, the installation routine displays the type of video chipset it found and the amount of memory it thinks is on the card. For most systems, accept the defaults unless you know exactly what type of chipset and on-board RAM you have.

After answering all the questions properly, X will start and you will see the X-based installation procedure.

Selecting Packages to Install


Whether you are using X or text-based installation, you will see a screen that lists all the packages on the Linux CD-ROM. You can select which packages are to be installed during the setup process. You can install as many or as few of these packages as you want. You can delay the installation of many of them until later, if you want.

After selecting the packages to be installed, you will see a message asking if you want to have individual package contents displayed for selection. This lets you select only portions of the more generic packages for installation. If you select this option, you will have to wait by your screen and provide input at regular intervals. If you want Linux to install all the components in a package, answer No to this prompt and you can leave the system to install by itself.

After you have selected the packages to be installed, Red Hat's installation routine will start installing the software. You will see status messages on the screen as the process goes along.

Using LILO


After the installation process has formatted the drive partitions and copied all the software packages you selected to the data partition, you are asked if you want to run LILO to set up the boot system for this drive. If you have a disk drive devoted only to Linux, or it is a split DOS/Linux drive, you can run LILO and set the drive to boot into either operating system.

If you are running another operating system, such as UNIX or OS/2, you may elect not to use LILO and create a boot floppy instead. LILO is covered in much more detail in Chapter 4, "LILO."

Boot and Root Disks


Even if you are installing from CD-ROM, you need three high-capacity floppies (either 1.2MB or 1.44MB). These are a single-boot floppy and two root (also called swap) floppies. The boot floppy holds the kernel used to start Linux the first time. The root or swap floppies hold a small file system that includes utilities needed for the installation.

In most cases, the boot and root floppies are copied from existing files that are called images. The image is a precompiled version of the system that you duplicate onto the floppies, eliminating the need to start from scratch. CD-ROM and FTP distributions will have directories for several boot and root images. You must select the image that matches your hardware as much as possible, copy them to the diskettes, and start your system with the diskettes.

You can do most of these steps from DOS, although you can't use the DOS copy command to create the boot and root floppies. The floppies must be created with a utility that ignores DOS formatting. This utility, commonly called RAWRITE.EXE, is included with most Linux software distributions.

Selecting a Boot Kernel and Root Image


The Red Hat Linux CD-ROM has a directory under the root directory called images which contain the boot and root images. You should run DOS either from a floppy or a partition on your hard disk to examine the CD-ROM. If you are copying your files from an FTP site, you can select the boot and root images you need while connected to the remote FTP machine and transfer only the images you need to your local machine.

The types of boot kernels usually available are described in a file in the kernel image directories. The Red Hat Linux CD-ROM accompanying this guide has a number of directories under the images directory:

  • 1213—Contains the standard boot images

  • 1357—Contains experimental boot images with a new kernel

  • custom—Contains boot-disk images of a specialized nature

Under the images directory there is also a directory called floppies, which contains mirror images of the floppy distribution set for Red Hat Linux. Among the three subdirectories that hold images, there are many hundreds of images. If you are not familiar with Linux or don't want to play around with special kernels and hardware configurations, stick to the 1213 directory. It has boot images that will handle most systems.

In the \images\1213 directory there is a file called IMAGE.TXT, which lists the makeup of each image. A typical entry looks like this:


image # 0021:

SCSI : Adaptec, Buslogic

Ethernet: SMC

CD-ROM : IDE/ATAPI or SCSI

For each image in the 1213 directory the IMAGE.TXT file lists the image name (the file for the preceding entry is called BOOT0021.IMG), the type of controller card used for the disk drives (a SCSI controller made by, or compatible with those by, Adaptec or Buslogic), the type of Ethernet card (SMC in this example), and the type of CD-ROM drive on the system (an IDE or SCSI CD-ROM drive, in this case).

After you have selected the proper image that most closely matches your hardware setup, you can copy it to a floppy. You will also need the two root-disk images, which are in the \images\1213 directory as RAMDISK1.IMG and RAMDISK2.IMG. If you choose the boot image incorrectly, don't worry. All that will happen is you won't be able to install Linux, and you can start the process again.

If you obtained your boot and root images from an FTP or BBS site, the files may be compressed and archived. If they are, they will end with the file type .gz. Before you can install the images to a floppy, they must be uncompressed with the gzip utility.

Creating the Boot and Root Floppies


You can create the boot and root floppies either from DOS or from a running UNIX or Linux system. If you don't run DOS yet, or don't have a DOS boot disk, you will have to use another machine to create the floppies. Because the DOS-based floppy creation is the most common, we can deal with it first. This uses a utility called RAWRITE.EXE, which is included on the CD-ROM in the \DOSUTILS directory.

To create the boot and root floppies, you must use a utility program to write the image to diskette. If your image files are compressed (they will have a .gz) extension, they must first be uncompressed with the gzip utility. If you are working from CD-ROM, you will have to copy the files to a DOS hard disk since you can't write the uncompressed image to the CD-ROM. To uncompress a .gz file, issue the command


gzip -d filename

where filename is the name of the compressed file (including the .gz extension). The -d option tells gzip to decompress the file. When it is completed, the .gz file will have been erased and only the uncompressed file will remain (with the same filename, less the .gz extension). You should uncompress the boot and root images.

The three floppies you need for Red Hat Linux don't have to be blank, as the RAWRITE utility used to copy the image to the floppies doesn't respect DOS formatting conventions. The two floppies must be high density. The disks must be formatted using the DOS format program. The boot diskette must be the correct size for your system's boot floppy drive (A: in DOS terms).

To use the RAWRITE program, enter its name at the DOS prompt with the full path to the utility, such as:


D:\DOSUTILS\RAWRITE

if your CD-ROM is drive D (or you can copy the files to a directory on your hard disk). RAWRITE will prompt you for the name of the file to copy and then destination drive letter. RAWRITE will then copy the images. Label the disks when the process is finished.

If you have access to a UNIX or Linux system, you can create the boot disks from within that operating system. You will need to put the image files on the UNIX or Linux system and use the dd utility to copy them to floppy. First, make sure the images are uncompressed (no .gz extension). If they are not, uncompress them with the gunzip utility.

To uncompress files in UNIX or Linux, issue the command


gunzip filename

where filename is the name of the image file, with its .gz extension. The gunzip utility will erase the compressed file and leave an uncompressed version in its place.

To copy the images to a floppy, you need to know the device name of the floppy within the operating system. For most systems, the first floppy drive is /dev/fd0 and the second floppy drive is /dev/fd1. (Some systems treat the floppy drives as a raw device, which have the names /dev/rfd0 and /dev/rfd1.) Copy image files to the floppy with the command


dd if=filename of=/dev/fd0 obs=18k

where filename is the name of the uncompressed image. The dd command converts file formats. The if and of parts of the command indicate the input and output filenames or devices. The obs portion of the command indicates the output block size (in this case, 18KB).

For example, to copy the BOOT0023.IMG image to the first floppy (3.5-inch 1.44MB), issue the command:


dd if=boot0023.img of=/dev/fd0 obs=18k

If you already have a Linux system, an easy way to make the boot and root floppies for Red Hat Linux is with a utility supplied on the CD-ROM. There is a Perl program called MKFLOPPIES.PL in the IMAGES subdirectory that can do the entire task for you. A series of questions will help you determine the proper images.

Partitioning the Hard Disk


Hard disks are divided into partitions or areas dedicated to an operating system. A hard disk can have up to four primary partitions, with some partitions being further divided into more logical drives by the operating system software.

Linux prefers to have two partitions: one for the Linux swap space, and one for the Linux software file system itself. The swap space is used as an extension of your machine's physical RAM and can be quite small. The Linux file-system partition tends to be quite large, as it must hold all the Linux software. You can have several Linux file-system partitions, although one must be designated as the boot partition (where the kernel and primary utilities are located).

If you are using an existing hard disk that has an operating system already installed on it, you will have to repartition your hard disk to make room for Linux. This tends to be a destructive process, meaning that anything on your hard disk will be destroyed. Make backups of your existing data if you want to keep it!

Partitioning of a hard disk is done with the fdisk utility from DOS or Linux, or interactively during the Red Hat Linux installation. You don't need to partition the drives before installing Red Hat Linux, but if you do partition during the installation routine you will have to reboot to make the changes effective. If you have used fdisk in DOS, the Linux version does the same task (although the menus are completely different and much more complicated). Many PC-based UNIX systems also use fdisk to partition hard drives.



A DOS utility called FIPS sometimes allows nondestructive changes to your partitions, assuming no data is on the areas that will be repartitioned. FIPS is available from many sources, including most of the Linux FTP sites and some Linux CD-ROMs. However, you should make backups, just in case!

You must decide how much space to allocate to the different partitions before you start, as changing your mind later will mean destroying all the data you have saved to disk. The Linux swap-space partition size will depend on the amount of RAM in your system, the number of users you expect, and the type of development you will do.

If you are going to maintain a DOS partition on the same disk, you will have to balance the disk-space requirements of both operating systems against your total disk capacity. A minimum Linux file-system partition will be about 20MB, although closer to 200MB is needed for a full X-based installation.

Linux Swap-Space Partition


How big should the swap-space partition be? No single number works for all installations, unfortunately. Generally, because the swap space is used as an extension of physical RAM, the more RAM you have, the less swap space is required. You can add the amount of swap space and the amount of RAM together to get the amount of RAM Linux will use. For example, if you have 8MB of RAM on your machine's motherboard, and a 16MB swap-space partition, Linux will behave as though you had 24MB of total RAM.

Linux uses the swap space by moving pages of physical RAM to the swap space when it doesn't need that page at the moment, and vice versa when it needs the memory page. So why not make a very large swap space and let Linux think it's in heaven? Because the swap space is much slower in access time than RAM, and there is a point at which the size of the swap space acts against your Linux system's efficiency, instead of for it.

Swap space may not be needed if you have lots of RAM. For example, if you have 16MB of physical RAM and don't intend to do any application development or run X, you won't make much use of the swap space because Linux can fit everything it needs into the 16MB. (You still should have a small swap space, just in case.)

If you are running X, developing applications, or running memory-hog applications like databases, swap space is crucial even if you have lots of physical RAM. Even 16MB RAM is not enough for X, so you need swap space.

A good rule is to create a swap space with a size of 16MB. Unless you have a very small capacity hard disk, this won't be a major drain on your resources and it does give Linux plenty to work with. If you don't want to allocate this much space, a good rule is to have a total of 16MB RAM (swap space plus physical RAM). Don't eliminate the swap space completely, though, unless you really have a lot of RAM. At a minimum, set up a 4MB swap space. Running out of RAM can cause Linux to totally lock up or crash, which isn't a pretty sight!

Setting Up Partitions


Because the versions of fdisk in DOS, OS/2, UNIX, and Linux all differ, all the steps aren't explained here. The fdisk utility is very easy to use, so if you have used PC machines for a while this will not be a problem for you. Remember, though, that fdisk will destroy existing data on your disk! You can set up your Linux disk partitions either from DOS or from within Linux. It really doesn't matter which approach you use, although the DOS fdisk program is a little easier to use than the Linux version. If you are using DOS fdisk to repartition a DOS area on your drives, you may as well use it to set up the Linux swap space and file-system partitions, too. The DOS version of fdisk has one problem, though: it can't set the partition type numbers. Linux's fdisk lets you set the partition types to be recognized more easily (type 82 for Linux swap and type 83 for Linux data).

To set up partitions for Linux, remove any existing partitions first (unless you want to keep them as they are). If you intend to use DOS on the same system as Linux, DOS should be the first partition on the disk so it can boot. (There are a few ways to get by this using LILO, but it is still a good rule to leave DOS as the first partition.) If you are keeping an existing DOS partition, it should be the first partition.

You should create a DOS boot disk that can reformat and transfer the DOS kernel to the hard drive, regardless of whether you are leaving an existing DOS partition or creating a new one. To create the boot diskette, use the DOS command


format a: /s

(assuming A: is the drive the diskette is in). The /s option transfers the operating system kernel. Next, copy the utilities FDISK, FORMAT, SYS, and CHKDSK to the boot floppy. You should also copy an editor, such as EDIT, and your existing CONFIG.SYS and AUTOEXEC.BAT files (although you could rename them). This disk will let you format any new DOS partitions. Alternatively, if you are starting from scratch with a new DOS partition, you can simply reload DOS from the original diskettes when ready to format the DOS partition.

If you are removing an existing DOS partition and re-creating a smaller one (as you would if your entire disk was DOS before Linux came into your life), follow these steps (after making a backup of your DOS data):

  1. Remove the existing DOS partition.

  2. Create a new primary DOS partition as the first partition.

  3. Make the DOS partition active.

  4. Reboot the system from your boot floppy (or DOS disks).

  5. Format the DOS partition and transfer the DOS kernel (COMMAND.COM) and hidden .SYS files by using the DOS SYS command or using FORMAT /S.

  6. Restore your backup files to the DOS partition (this can be done at any time).

Next, set up the Linux swap-space partition by creating a partition of the proper size. You can do this step either from DOS or when you have booted Linux from the boot and root floppies. For the sake of this chapter, we'll assume you are setting up the partitions from DOS (although the process is the same either way).

Most versions of fdisk enable you to enter the size of the partition in MB, with the utility calculating the sector numbers that apply to it. Set the size of the Linux swap space to whatever size you decided. Don't make the partition active or format it! You can set up the swap-space partition in an extended disk partition, but a primary partition is a better choice if your disk can support it.

Finally, create the Linux file-system partition to be whatever size you want, or the rest of the disk if that's the only partition missing. Again, don't activate or format the partition. When you are running the Linux installation routine, you will identify and format the swap space and file-system partitions properly.

Install the Linux Partitions


One of the first steps you are asked to do by the installation routine is to set up disk partitions. Red Hat Linux has two disk-partitioning utilities: fdisk and cfdisk. Both perform the same tasks, but cfdisk is a little easier to use. The fdisk utility, though, will be familiar to users of other Linux versions.

If you have more than one hard drive, you can place your Linux partitions on either drive. If you are planning on keeping a DOS partition, though, make sure it is the first partition on the first drive. Linux isn't so picky. If you want to boot Linux cleanly, place a Linux file system on the first drive. You can also create Linux file systems on the second drive. Linux swap partitions can be on either drive. If you have two drives, putting the swap space on the second drive and the bootable Linux data partition on the first should provide better performance.

Linux's fdisk


Linux's fdisk program is different from the one in DOS, so you should check the menus frequently to determine the proper commands. During the installation process the disk partitions are detected automatically, and you are placed in the fdisk program.

Alternatively, you can run fdisk at any time from a Linux prompt. You invoke the Linux fdisk in the same manner as that in DOS. If you don't specify a drive, fdisk will assume the first one in the system. Otherwise, you can specifically indicate which disk drive to partition by giving the device name on the command line, as in


fdisk /dev/hdb

which will invoke fdisk for the second drive. If your system has IDE, ESDI, or RLL drives, the first is /dev/hda and the second /dev/hdb. SCSI drives are /dev/sda, /dev/sdb, and so on. Because seven SCSI drives can be supported on a single controller, you could have up to /dev/hdg. (You can go even higher with another controller card, but few Linux systems will require this!)

As mentioned previously, Linux fdisk commands are different from the fdisk commands for DOS. Essentially, the commands you need to run the Linux fdisk utility are the following:

  • d—Deletes an existing partition

  • l—Lists all known partition types

  • n—Creates a new partition

  • p—Displays the current partition table

  • q—Quits fdisk without saving changes

  • t—Changes a partition's type code

  • v—Verifies the partition table

  • w—Writes current partition table to disk and exits

The process for setting up a partition is to first examine the partition table to make sure any existing partitions are correct. If you have a DOS partition on your drive, it should show in the partition table. If you created Linux swap and file-system partitions when you were in DOS's fdisk, they should appear in the partition table too, although the partition types will be incorrect.

Setting Up Linux Partitions


To create the Linux swap space, use the n command and give the starting sector number. Usually, this will be immediately after any existing DOS partition (or other operating systems you have installed). Linux's fdisk lets you specify the size of the partition either by supplying an end sector number or by giving a size in MB. The latter is much easier to work with, so just enter the number of MB you want to set your Linux swap-space partition to. The format is usually +XXM, where XX is the number of megabytes (such as +16M). You can also specify kilobytes, but you don't want to create a swap partition that is less than 1MB in size.



Most PC BIOSs cannot handle more than 1024 cylinders on a disk drive. You may not be able to create DOS or Linux partitions or file systems that go beyond the 1,023th cylinder (numbering starts at zero). Some other operating systems, such as SCO UNIX, enable you to use anything beyond the 1,024 limit. Linux can use partitions beyond the 1,024 limit, but it can't boot from them. If you have a disk drive that has more than 1,023 cylinders, make sure your primary Linux partition ends before 1,023. You can create extra partitions following that cylinder and mount them as second file systems.

The fdisk program will ask you if you want to create a primary or an extended partition. If you are creating a primary partition it wants the number (one to four—remember a DOS partition has to be number 1 to boot). In most cases you should create only primary partitions, unless you have a large disk drive. Extended partitions can be used to add logical drives inside them, as DOS creates logical drives. In Linux, extended partitions are not the same as extended file systems!

After you have created the Linux partition, you should assign its type. Some versions of fdisk prompt for this right away, whereas others let you select the option to assign file-system types from the fdisk menu. In either case, the letter l will display all known file-system types. Choose the one that designates a Linux swap space (number 82), and check the partition table. Your Linux swap-space partition should have the correct size and partition type displayed. Actually, Linux doesn't care about the partition-type numbers and ignores them completely, although it can make autodetection of the Linux partitions a little easier during installation. Some other operating systems do note them, though, so it's a good practice to label them correctly to prevent future problems. It also helps you keep the partition table nicely organized!

Next, create your primary Linux file-system partition in the same manner. If you want to use the rest of the disk drive for that partition, you can enter the end sector number of your drive (Linux's fdisk will tell you the range you can use). This would be the usual default if your hard drive has a DOS, Linux swap space, and Linux file-system partition on it. After you have created the Linux file system, you should identify its file type as 82, which is a "Linux native" type.

You should note the size of the swap-space and file-system partitions in blocks; you will need this information later. You can read this straight from the partition table.

After you've created the Linux partitions and are satisfied with the partition-table layout, save and exit fdisk. If you don't save the information, you will have to repeat the process again.

Enabling the Swap Space For Installation


When you have set up the disk partitions through the automated installation routine, you don't have to worry about enabling the swap space; it is performed automatically. If you are doing these steps manually, you will have to enable the swap space so Linux can use it.

If you have 4MB of RAM or less, you will have problems installing Linux unless you have the kernel use the swap space. (If you have only 4MB or less of RAM in your system, you should have a swap space of at least 8MB—preferably 16MB.) If you try to install Linux and get memory error messages, it's because there is not enough RAM and the swap space is needed.



If you've turned the swap space on and still get error messages, you need either more physical RAM or a larger swap space. To increase the size of a swap-space partition, you may have to remove the existing Linux partitions and re-create them with fdisk.

If you have a small amount of RAM, you should enable the swap space to help the installation process. Even if you have lots of RAM, there's no reason not to enable the swap space now, anyway. To enable the swap space, issue the command


mkswap -c partition size

where partition is the name of the partition and size is the size of the partition in blocks. You may have noted this number earlier when setting up the partition table. If not, you can start fdisk again and read the size in blocks from the partition-table display.

For example, if you have set up the Linux swap space on partition /dev/hda2 (the second primary partition on the first non-SCSI drive) and it has a size of 13,565 blocks, you would issue the command


mkswap -c /dev/hda2 13565

The -c option in the command line tells the mkswap utility to check for bad blocks in the partition. If this option is on, it will take a little longer to create the swap partition; however, a bad block in the swap partition can cause your entire system to crash, so it's worth the delay. If mkswap finds any errors in the swap space, it will generate an error message. However, because mkswap flags bad blocks to be left alone, you can ignore the messages unless there are a considerable number of them, in which case your hard drive has too many bad blocks!

When the swap partition has been formatted, you enable the Linux swap-space partition with the command swapon. Usually you will have to specify the partition, although some versions can figure the partition out automatically from the partition table. It never hurts to be explicit, though. To enable the swap partition just formatted, enter the command


swapon /dev/hda2

You will have to repeat the format and swapon commands for each swap partition, if you created more than one. As soon as the swapon command is executed, the Linux kernel will start to use the new swap space as an extension of the physical RAM.

Creating the Linux File-System Partition


When you have a swap space configured and working, you can set up the Linux file system. This step may be automated by some Linux installation scripts, or you may have to execute it yourself. Either way, this section explains what is going on.

You will have already allocated the partition table to support a Linux file system. Now you can create the file system with the mkfs (make file system) command. The exact format of the command depends on the type of file system you are setting up. The most popular file system (for reasons of speed and flexibility) is called the Second Extended file system (which has nothing to do with extended partitions on a hard disk). To create a Second Extended file system, issue the command


mke2fs -c partition size

where partition is the device name and size is the size of the partition in blocks (taken from the partition display in fdisk). The size doesn't have to be specified with mke2fs as it can figure it out from the partition information. For example, to create a file system in /dev/hda3, the command would be


mke2fs -c /dev/hda3


When specifying the size of a partition, make sure you use blocks and not sectors or cylinders. Using the wrong value will result in errors or only a fraction of your partition being used.

The mke2fs utility will check the partition for bad blocks (the -c option) then set the file system up properly in that partition. If you are setting up a large partition, the disk check can take a few minutes—but you should not ignore it unless you know your disk is good.

The other file systems available to Linux are the Xia file system, the Extended file system, and the Minix file system. The Xia file system is good, but not as popular as the Second Extended. The Extended file system is an older version of Second Extended, whereas the Minix file system is compatible with the old Minix operating system. You can create these file systems with the following commands:

  • Extended—mkefs

  • Minix—mkfs

  • Xia—mkxfs

All three commands take the same arguments as the Second Extended file-system command. The Minix file system is limited to 64MB.

None of the mkfs commands format the filesystem—they simply set it up. You are prompted for a file-system format during the installation process.

Troubleshooting


There are many different problems that can occur while setting up and installing a Linux system, although most of them will be self-explanatory from error messages. A few commonly encountered problems can be easily dealt with, though, so we'll look at them briefly.

Software Installation


You may encounter a few errors when installing Linux. If you get the message device full, it means you have run out of disk space and need to install fewer components or allocate more hard disk space. If you haven't installed the basic system, you will need more disk space. You will have to delete your partitions and start the installation process again, allocating more to Linux.

Errors such as read error, file not found, and tar: read error are indicative of a problem with either the disk medium you are installing from, or an incomplete Disk Set. These problems usually occur with floppies, and they tend to indicate a bad diskette. All you can do in most cases is replace the diskette with a new one.

Hard Disk and Disk Controller


When Linux boots it displays a few messages, one of the most important being a partition check. You will see messages like this:


Partition check:

hda: hda1 hda2 hda3

hdb: hdb1 hdb2

In this example, the first non-SCSI disk has three partitions and the second disk has two. Your system's output will probably be different, of course. If you don't see any partition information, either the hard disk controller is not recognized properly, or the disk drives themselves are not accessible. There are a number of potential causes for these problems, including the obvious:

  • Check the cables inside the computer. The hard-disk cable should run from the adapter card to each drive's connector. Make sure the cables are connected in the proper manner (the red strip on the cable is at pin 1 on the connector).

  • Confirm that the power connector is attached to each disk drive. Without power, your drive won't spin up and Linux can't touch it.

  • Check the partition table to make sure you created a Linux partition properly.

After that, if the drive is not working properly with Linux but works fine when you boot DOS, a kernel driver for the hard disk is probably at fault. Some IDE drives, for example, are not as well-behaved (that is, conforming to the IDE standards) as others, and your IDE kernel driver may not be able to talk to your drives. Try using a different kernel image and see if the problem solves itself. If you are using a SCSI kernel and adapter and the drives are not recognized, use the utilities that came with the SCSI adapter card to force a check of the hard drives. They may have a SCSI ID set incorrectly.

Device Conflicts


One of the most commonly encountered problems is hardware not recognized properly. This can happen to a CD-ROM, a network card, and even a hard disk. Most of the time this is caused by a conflict in the IRQ (interrupt), DMA (Direct Memory Address), or I/O address settings. When two devices have the same settings on any one of the three characteristics, Linux and the BIOS may not be able to communicate with the device properly.

A symptom of this problem may be Linux hanging when it tries to find a specific device, as explained on the boot messages. When Linux boots up, it generates verbose messages on the console that explain what it is doing. If you see a message that it is trying to connect to the network card, for example, and it never gets past that point, chances are that the network card has a conflict with another device. (Totally failed cards are very rare and don't usually stop the boot process; Linux ignores devices it can't access. The problem with a working card with conflicting settings is that Linux is getting messages from two devices that don't act the same.)

To check for conflicts, you can run a diagnostic utility under DOS such as MSD or Norton Info. Windows 95 users can use the System icon in the Control Panel to obtain this information. These diagnostics can show you the current IRQ, DMA, and I/O addresses and pinpoint any conflicts. They can also be used for finding available settings.

Alternately, you will have to check the settings of every device in your system for conflicts. Usually, network cards will conflict with sound boards, non-SCSI tape driver cards, video cards, and similar add-on cards. Most cards use DIPs or jumpers to set these parameters, so check them against the documentation. To help isolate the problem, remove cards that are not necessary, such as a sound card, and see if the boot process moves past the device that caused the hang-up.

Another problem that can occur is with SCSI devices (and a few others, although much rarer) that must have specific settings in the kernel image. Some kernels were compiled with settings that are default values for adapters or disk drives; if the settings have been changed, the kernel will hang up. This is often the case with special-purpose kernels that have been developed for non-mainstream adapters. To check for this type of problem, you should investigate any documentation that came with the kernel image.

The most common devices in a PC (COM ports, parallel ports, and floppies) and their IRQ, DMA, and I/O addresses are shown in Table 3.1. These are the default values for a PC, but they may be changed by users. Because only two COM ports (serial ports) are usually supported by DOS, they share IRQ values. The I/O addresses are different, though. Both floppy disks share the same I/O addresses, IRQ, and DMA.

Table 3.1. Common IRQ, DMA, and memory address settings.

Device IRQ DMA I/O Address (Hex)
COM 1 (/dev/ttyS0) 4 N/A 3F8
COM 2 (/dev/ttyS1) 3 N/A 2F8
COM 3 (/dev/ttyS2) 4 N/A 3E8
COM 4 (/dev/ttys3) 3 N/A 2E8
LPT 1 (/dev/lp0) 7 N/A 378-37F
LPT 2 (/dev/lp1) 5 N/A 278-27F
Floppy A (/dev/fd0) 6 2 3F0-3F7
Floppy B (/dev/fd1) 6 2 3F0-3F7

Network cards, SCSI adapters, sound boards, video cards, and other peripherals all must have unique IRQ, DMA, and I/O addresses, which can be difficult to arrange with a fully loaded system. For more information on available values, you should check your device or card-installation manual for recommended values and potential conflicts.

SCSI Problems


SCSI is one of the most versatile interfaces, and it pays for that versatility in potential problems. Linux is usually good about reporting problems with SCSI devices, although the error messages may leave you wondering about the real cause of the problem.

Table 3.2 lists many of the common SCSI errors and their probable causes. Find the message that closely matches the error message Linux displays in this table to determine your corrective steps.

Table 3.2. Common SCSI problems and their solutions.

Problem Probable Solution
SCSI device at all possible IDs One or more devices are at the same SCSI ID as the controller. Check and change device IDs. Controllers should be ID 7.
Sense errors Probably caused by bad termination. Check that both ends of the SCSI chain are terminated. If that is not the problem, the cable is likely at fault.
Timeout errors Usually caused by a DMA, IRQ, or I/O-address conflict. See the preceding section for more information.
SCSI adapter not detected The BIOS is disabled or the SCSI adapter is not recognized by the kernel. Check the drivers.
Cylinders Beyond 1024 Your disk has more than 1,024 cylinders, which the PC BIOS can't handle. Linux can use more than 1,024 cylinders, but it can't boot from a partition that extends across that cylinder boundary.
CD-ROM drive not recognized Some CD-ROMs require a CD in the drive to be recognized properly. Insert a CD and reboot.

Booting Linux


If you have installed Linux and the system won't boot properly from your hard disk, it may be a problem with LILO or with the partitions. If you created a boot floppy, boot from that. If that boots without a problem, check the partition table by executing fdisk. Make sure the Linux partition is active. If it is and you still can't boot from the hard disk, boot from the floppy and run LILO again to configure the boot sector. See Chapter 4 for more information on LILO.

A problem will sometimes occur when Linux can't find the main Linux partition. Boot from the floppy and hold down Shift or Ctrl. This produces a menu that enables you to specify the boot device explicitly. This problem can usually be corrected with LILO.

Summary


Much of this chapter will be familiar to you if you have installed Linux before, although some users really don't know what goes on during the automated installation script. Knowing the process, and staying on top of it, helps prevent problems with the Linux installation.

The next step is using LILO to properly configure the boot system—a commonly misunderstood and misused process. The next chapter looks at LILO.

Previous Page Page Top TOC Next Page