Table of Contents
The remaining part of this chapter deals with a real installation example for a common case: installation from CD-ROM. The concepts are the same for all types of installation (e.g. ftp); the only difference is in the way the binary sets are found by sysinst. Please note that some details of the installation differ depending on the NetBSD release: this example was created with release 2.0.
For the sake of teaching, in the following example the most “difficult” options will always be chosen.
BIOS partition table full: one or more existing partitions will be deleted to make room for NetBSD.
fdisk partitioning using sectors instead of MB.
manual modification of the disklabel created by sysinst, also using sectors.
“custom” installation (meaning that you can select one by one the binary sets that you want to install).
This set of choices gives the impression that the installation is very complicated and requires a lot of work: remember that if you accept the defaults everything is much simpler. On the other hand, a tutorial which explains only the “easy” parts is not very useful (except from the marketing point of view...)
Before installing it is a good idea to make a detailed plan of the steps that you will need to perform. First, read the INSTALL file (I promise it's the last time that I say it) reading the description of the installation and checking the hardware compatibilities. Next, if there is already something on the hard disk, think how you can free some space for NetBSD; if NetBSD will share the disk with other operating systems you will probably need to create a new partition (which you will do with sysinst) and, maybe, to resize an existing one. It is not possible to resize an existing partition with sysinst, but there are some commercial products (like Partition Magic) and some free tools (FIPS, pfdisk) available for this.
The installation is divided logically in two steps. In the first part you create a partition for NetBSD and you write the diklabel for that partition. In the second part you decide which binary sets you want to install and extract the files in the newly created partitions. The first part is independent of the intallation method (CD-ROM, ftp, NFS, ...); at the end of the first part nothing has yet been written to the hard disk and you are prompted to confirm the installation. If you confirm, the installation goes on, else you are brought back to the main menu and the hard disk remains unchanged.
if you have a bootable NetBSD CD-ROM you don't need to create an installation floppy: enable the “boot from CD-ROM” in your BIOS settings, insert the CD and reboot the machine. This option is probably not available on older machines.
Before installing you need to create the installation floppy, i.e. to copy the floppy image from the CD-ROM to a diskette. To perform this operation in DOS you can use the rawrite program in the i386/installation/misc directory. The image file is i386/installation/floppy/boot.fs.
Format the floppy.
Go to the I386\INSTALLATION\FLOPPY directory of the CD-ROM.
Run the ..\MISC\RAWRITE program. The “Source file” is BOOT.FS and the “Destination drive” is A:
If you create the boot floppy in a Unix environment, you can use the dd command. For example:
# cd i386/installation/floppy # dd if=boot.fs of=/dev/fd0a bs=36b
dd copies blocks of 512 bytes: the bs=36b option copies 36 blocks at a time, effectively making the operation faster.
a 1440K floppy contains 1474560 bytes and is made up of 80 cylinders, 2 tracks, 18 sectors and 512 bytes per sector, i.e. 80 * 2 * 18 = 2880 blocks. Thus bs=36b copies one cylinder (18 * 2 blocks) at a time and repeats the operation 80 times instead of 2880.
Everything is now ready for the installation but, before beginning, it is better to gather some information on the hardware of the PC.
The most important thing to check is the type of hard disk (IDE, SCSI) and its geometry. You can find this information on the hard disk manual or using a diagnostic program. Some hard disks have a label on which this data is written. Another option is to connect to the web site of the producer of your disk and look for the product info.
If you install via ftp or NFS remember to check your network card settings: if the installation kernel expects your card to be on an IRQ but the card's settings are different you won't be able to install. For example, the install kernel can recognize an NE2000 compatible network card with one of the following two settings:
ne0 at isa? port 0x280 irq 9 # NE[12]000 ethernet cards ne1 at isa? port 0x300 irq 10
If your NE2000 network card has different settings it will not be detected. (After the installation you will be able to compile a customized kernel with your own settings.)
While you are at it you should check some other hardware details like, for example, the number of serial and parallel ports, etc.; this is not required for installation but it can turn out useful later. Check your settings (IRQ, I/O ports, ...) against the ones written in the INSTALL file.
you can install even if you don't know the hard disk geometry as well as any of the other details. In this case you must trust sysinst, which automatically determines the geometry and (usually) gets it right.
Insert the newly created installation floppy in drive A: and reboot the computer (or boot from CD-ROM). The kernel on the floppy is booted and starts displaying a lot of messages on the screen, most of which say something about hardware not being found or not being configured. This is normal: the kernel on the floppy tries to detect almost all the hardware supported by NetBSD; you probably (!) don't have all these devices in your machine.
When the boot procedure is over you will find yourself in the installation program, sysinst, shown in Figure 4.1, “Selecting the language”. Don't be deceived by the spartan look of sysinst: it is a rather powerful and flexible program. From here on you should follow the instructions displayed on the screen, using the INSTALL document as a reference. The sysinst screens all have more or less the same layout: the upper part of the screen shows a short description of the current operation or a short help message; the central part of the screen shows the current settings as detected by NetBSD; the bottom part displays a menu of available choices. You can now go ahead, and select the language you prefer to do the installation in.
This will bring you to in the main menu of the installation program, as shown in (Figure 4.2, “The main menu of the installation program”. Choosing the Install option brings you to the next screen (Figure 4.3, “Confirming you want to install NetBSD”), where you can confirm the operation.
After choosing to continue with option “b”, it is time to select on which hard disk you want to install NetBSD. If more than one disk is available, sysinst displays a list of disks from which you can pick one. In this example there is only one hard disk and the installation program only displays an informational message, shown in Figure 4.4, “Choosing a hard disk”.
the information in this screen will be different depending on the type and number of hard disks installed on the system.
Sysinst will then ask whether you want to do a full installation, or a custom installation. NetBSD is broken into a collection of distributions sets. If you choose “b: Custom installation” you can choose which sets you would like to have installed. This step is shown in Figure 4.5, “Full or custom installation”.
If you chose to do a custom installation, sysinst allows you to choose which distribution sets to install, as shown in Figure 4.6, “Selecting distribution sets”. You will at least need a kernel, “Base” and “System (/etc)” for a functional installation.
The first important step of the installation has come: the partitioning of the hard disk. First you must specify if NetBSD will use a partition (suggested choice) or the whole disk (“dangerous” choice). In the former case it is still possible to create a partition that uses the whole hard disk (Figure 4.7, “Choosing the partitioning scheme”) so we recommend to select this option which keeps the BIOS partition table in a format compatible with other operating systems.
The next step, depicted in Figure 4.8, “Choosing a unit of measure”, is the selection of a unit of measure to be used for hard disk partitioning: sectors give the most flexibility and precision (note that it is usually better to align partition on cylinder boundaries for performance reasons, at least on older hard disks.) Megabytes are easier to use because they don't require manual calculations and are more “intuitive”.
For most people option “a” (Megabytes) will be the most logical choice, because it is the unit to specify partition sizes. After making a choice you are taken to the fdisk interface screen.
Figure 4.9, “fdisk” shows the current situation of the hard disk before the installation of NetBSD; there are four primary partitions, as you can see this disk is currently empty.
If you do have other partitions you can leave them around, and install NetBSD on a partition that is currently unused, or you can wipe out a partition for NetBSD. Deleting a partition is simple; after selecting the partition a menu with options for that partition appears (Figure 4.10, “Partition options”), change the partition kind to “Delete partition” to remove the partition. Of course, if you want to use the partition for NetBSD you can set the partition kind to “NetBSD” rightaway.
You can create a partition for NetBSD by selecting the partition you want to install NetBSD to. The partition names “a” to “d” correspond to the four primary partitions on other operating systems. After selecting a partition a menu with options for that partition will show up (Figure 4.10, “Partition options”).
To create a new partition the following information must be supplied:
the type of the new partition
the first sector of the new partition
the size (in sectors) of the new partition
Choose the partition type “NetBSD” for the new partition (option “a: Kind”). The installation program wil automatically try to guess option “b: Start”, by starting after the end of the preceding partition. Change this if necessary. The same thing applies to the “c: Size” option; the installation program will try to fill in the space that is available till the next partition or the end of the disk (depending on which comes first). Change this value if it is incorrect, or if you do not want to use the suggested space.
After you have set up the partition kind, start and size, it is also a good idea to set the name that is to be used in the boot menu. You can do this by selecting the “g: bootmenu” option, and filling in how should appear in the bootmenu, e.g. “NetBSD”. It is a good idea to repeat this step for other bootable partitions. If you are satisfied with the partition options, you can confirm your choice by selecting “x: Partition OK”. You can choose the same option in the fdisk interface when you have finished partitioning your disk.
If you have made an error in partitioning (for example you have created overlapping partitions) sysinst will display a message and suggest to go back to the fdisk menu (you are also allowed to continue). If the data is correct but the NetBSD partition lies outside the range of sectors which is bootable by the BIOS, sysinst warns you and asks if you want to proceed anyway. This could lead to problems on older PC's: the PC used in the example received this warning but boots perfectly. It is not possible to give a general rule (it is BIOS dependent); if the PC is not very old I suggest to ignore the warning and continue.
this is not a limitation of NetBSD; some old BIOSes cannot boot a partition which lies outside the first 1024 cylinders. To understand fully the problem you should study the different type of BIOSes and the many addressing schemes that they use (physical CHS, logical CHS, LBA, ...). These topics are not described in this guide.
With the most recent BIOS, supporting int13 extensions, it is possible to install NetBSD in partitions that live outside the first 8 GB of the hard disk, provided that the NetBSD boot selector is installed.
If the data is correct sysinst will offer to install a boot selector on the hard disk. This screen is shown in Figure 4.11, “Installing the boot selector”.
if the arrow keys don't work you can scroll the menu options using the < and > keys.
At this point, the first part of the installation, namely disk partitioning, is over.
The BIOS partitions, also called slices by BSD, have been created. It's time to define the BSD partitions.
Some platforms, like i386 systems, use (DOS-style) partitions to separate filesystems. NetBSD uses a disklabel to that. The NetBSD partition you optionally created earlier in the installation process exists to make sure other operating systems do not overwrite the diskspace that you allocated to NetBSD. NetBSD uses its own partition scheme, named a disklabel. In the next few steps you will be able to create a disklabel.
Before editing the disklabel you can predefine what partitions you would like to create. The installation program will generate a disklabel based on these settings. This installation screen is shown in Figure 4.12, “Setting partition sizes”.
Unless you have size constraints it is usually a good idea to make partitions for /, /var, /tmp, /home and /usr. This will make it easier to recover the system in the event of a crash, and it will allow you to make fine-grained settings per filesystem.
The next step is to create a disklabel, as shown in Figure 4.13, “The disklabel editor”. If you predefined the partition sizes in the previous step, the resulting disklabel will probably fit to your wishes. In these case you can complete the process immediately by selecting “x: Partition sizes ok”.
As you can see in Figure 4.13, “The disklabel editor” there are two reserved partitions, “c” (representing the NetBSD partition), and “d” (representing the whole disk). You can edit all other partition by selecting it using the cursor keys and pressing the return key. You can add a partition by selecting an unused slot, and setting parameters for that partition. The partition editing screen is shown in Figure 4.14, “The disklabel editor”
The difficult part (creating the BIOS and the BSD partitions) is now over; the remaining part of the installation is much simpler. Now you can choose a name for the hard disk (the default name is mydisk) and confirm the operations that you have done.
all that was done until now has not yet been committed to disk: it is still possible to change your mind and go back to the main sysinst menu leaving the disk unchanged.
sysinst will now create the partitions and the file systems with fdisk, newfs, fsck and installboot and then we will install the NetBSD sets.
You have finished the first and most difficult part of the installation.
sysinst then asks what information you would like to see during the extraction process (Figure 4.15, “Choosing the verbosity of the extraction process”). You can choose to let sysinst: (a) show a progress bar, (b) be quiet, or (c) show the filename of each extracted file.
Now sysinst needs to find the NetBSD sets (the .tgz files) and you must supply this information. The menu offers several choiches:
The options are explained in detail in the INSTALL document. It is also possible to install from an unmounted filesystem (provided that it is of a type recognised by the install kernel): this means that, for example, it is possible to copy all the sets to an existing MS-DOS partition and install from there.
Selecting “cdrom”, sysinst asks the name of the device (for example cd0) and mounts it automatically. You should also input the pathname to the installation sets on the CD-ROM if it is different from the default value. You can do this with the “Set directory” item.
if you are using a non US keyboard you'll have to be careful when you type the “/” character. See Section 3.3.1, “Keyboard”.
if you don't know the name of the CD-ROM device, you can find it in the following way:
Press Ctrl-Z to pause sysinst and go to the shell prompt (that's a nice feature!)
Type the command:
# cat /kern/msgbuf
This will show the kernel startup messages, including the name of the CD-ROM device (for example cd0).
If the display scrolls too quickly, you can also use the ed editor.
# ed /kern/msgbuf
Go back to the installation program with the command:
# fg
At the end of the installation sysinst displays a message saying that everything went well. After selecting the option "a: ok" the device files are created.
The sysinst program will then ask you to configure some aspects of the operating system. The first thing that is asked is which algorithm shall be used to encrypt the password file (Figure 4.19, “Set extraction completed”). MD5 en Blowfish allow longer passwords than DES, which only uses the first eight characters of the password that is entered. DES is still useful for interoperability with other operating systems (e.g. for NIS).
After choosing the password cipher you can set the root password (Figure 4.20, “Setting the root password”.
At this point the installation is finished (Figure 4.21, “Congratulations”). After passing the dialog that confirms the installation sysinst will return to the main sysinst menu. Choose “Reboot the computer” to boot your NetBSD installation.