Table of Contents
This chapter shows an example installation for a two common cases: installation from CD-ROM, and via FTP. The concepts are the same for all types of installation; 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.
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
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 disklabel 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 installation 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 floppies, 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, for
Windows there's a version in
The image files are
installation of a “normal” PC, and
a laptop. A number of other floppies are available that are
described in more detail in the
Before creating the installation disks always check that the floppies are good: this simple step is often overlooked and can save you a lot of trouble!
The procedure to write floppies is:
Format the floppy.
Go to the
of the CD-ROM.
program (or extract
if you're on a Windows system, and run the RAWRITE32 program
in that file). The “Source file”s are
BOOT2.FS (etc., see above) and the
“Destination drive” is A:
If you create the boot floppy in a Unix environment, you can use the dd command. For example:
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.
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 # NE000 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
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 NetBSD
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
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.
To make a choice, either use the cursor keys, the
“Ctrl+N” (next) and “Ctrl+P”
(previous) keys, or press one of the letters displayed left of
each choice, and confirm your choice by pressing the Return
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 “Yes”, 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 the example given in Figure 4.4, “Choosing a hard disk”, there are two disks, and NetBSD will be installed on “wd0”, the first IDE disk found. If you have SCSI disks, they will be named “sd0”, “sd1” and so on.
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. “Full installation” will install all sets; if you choose “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
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, “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” right-away.
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 as shown in Figure 4.10, “Partition options”.
To create a new partition the following information must be supplied:
the type (kind) of the new partition
the first (start) sector of the new partition
the size of the new partition
Choose the partition type “NetBSD” for the new partition (option “Kind”). The installation program will automatically try to guess option “Start”, by starting after the end of the preceding partition. Change this if necessary. The same thing applies to the “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 NetBSD 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 should be used in the boot menu. You can do this by selecting the “bootmenu” option, and filling in how NetBSD should appear in the bootmenu, e.g. “NetBSD”. It is a good idea to repeat this step for other bootable partitions so you can boot both NetBSD and Windows using the NetBSD bootselector. If you are satisfied with the partition options, you can confirm your choice by selecting “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 PCs: 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 fully understand 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”.
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 PC systems (i386), use (DOS-style) MBR partitions to separate filesystems. The NetBSD MBR partition you 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, which is stored at the start of NetBSD's MBR partition. In the next few steps you will be able to create a disklabel and set the sizes of NetBSD partitions, or use existing partition sizes, as shown in Figure 4.12, “Choosing if partitions should be edited”.
When choosing to set sizes of NetBSD partitions and 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.13, “Setting partition sizes”.
The default partition scheme of just using a big
/ (root) file system (plus swap) works
fine with NetBSD, and there is little need to change this.
/tmp to reside on a RAM disk
(mfs) for extra speed may be a good idea. Other partition
schemes may use separate partitions for
/home, but you may use your own
experience to decide if you need this.
The next step is to create a disklabel, as shown in Figure 4.14, “The disklabel editor”. If you predefined the partition sizes in the previous step, the resulting disklabel will probably fit your wishes. In these case you can complete the process immediately by selecting “Partition sizes ok”.
As you can see in Figure 4.14, “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.15, “The disklabel editor”
After defining all the data for the new disklabel, the last item is to enter a name for the NetBSD disk as shown in Figure 4.16, “Naming the NetBSD disk”. This can be used later to distinguish between disklabels of otherwise identical disks.
The NetBSD installer now has all the data to prepare the disk for the installation. Nothing has been written to the disk at this point, and now is the last chance to abort the installation process before actually writing data to the disk, as shown in Figure 4.17, “Last chance before hitting the disk”. Choose “no” to abort the installation process and return to the main menu, or bravely step ahead by selecting “yes”.
After confirming that sysinst should prepare the disk, it will run disklabel(8) to define NetBSD partition layout and newfs(8) to create the file systems on the disk, as shown in Figure 4.18, “Creating the filesystems”.
After preparing the partitions and filesystems, the next question shown in Figure 4.19, “Selecting a bootblock” is which bootblock to install. Usually you will choose the default to use the BIOS console, i.e. show boot messages on your PCs display.
If you run a farm of machines without monitor, it may be more convenient to opt for a serial console running on one of the serial ports. The menu also allows changing the serial port's baud rate from the default of 9600 baud, 8 data bits, no parity and one stopbit.
Halftime - you have finished the first and most difficult part of the installation!
The second half of the installation process consists of populating the filesystems with the NetBSD operating system's files by extracting the “sets” that you have selected before (base, etc, comp, etc.). For unpacking the sets, sysinst asks what information you would like to see during that process, as shown in (Figure 4.20, “Choosing the verbosity of the extraction process”). You can choose to let sysinst either show a progress bar, be quiet, or show the name of each extracted file.
Now sysinst needs to find the NetBSD sets
.tgz files) and you must supply this
The menu offers several choices as shown in Figure 4.21, “Installation media”.
The options are explained in detail in the
It is possible to install from an unmounted filesystem (provided that it is of a type recognised by the install kernel) so for example it is possible to copy all the sets to an existing MS-DOS partition and install from there.
When selecting “CD-ROM / DVD”,
sysinst asks the name of the CD-ROM
or DVD device and the directory in which the set files are
stored, see Figure 4.22, “CD-ROM/DVD installation”. The device is usually
cd0 for the first CD-ROM or DVD drive,
regardless if it is IDE or SCSI.
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 / DVD 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:
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 more:
Go back to the installation program with the command:
If you choose to install via FTP, sysinst will configure the system's network connection, download the selected set files to a temporary directory and extract them.
NetBSD 2.0 currently supports installation via ethernet, ethernet-over-USB and wireless LAN, installation via DSL (PPP over Ethernet) is not supported during installation and needs to be setup manually after installation.
The first step shown in Figure 4.23, “Which network interface to configure” consists of selecting which network card to configure. sysinst will determine a list of network interfaces available in your hardware, present them and ask which one it shall use.
The exact names of your network interfaces depends on the hardware you use, example interfaces are “fxp0” for Intel i8255x based ethernet cards, “tlp0” for TULIP-based ethernet cards, “wi0” for Lucent WaveLAN and “ath0” for Atheros based wireless cards. This list is by no means complete, and NetBSD supports many more network devices.
To get a list of network interfaces available on your system (or rather, a list of all the network interfaces which NetBSD detected), interrupt the installation process by pressing “Ctrl+Z”, then enter
ifconfig -afxp0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 address: 00:06:0d:c6:73:d5 media: Ethernet autoselect (10baseT) status: active inet 0.0.0.0 netmask 0xffffff00 broadcast 0.0.0.0 inet6 fe80::206:dff:fec6:73d5%fxp0 prefixlen 64 scopeid 0x1 lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 33196 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 ppp0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500 ppp1: flags=8010<POINTOPOINT,MULTICAST> mtu 1500 sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 296 sl1: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 296 strip0: flags=0 mtu 1100 strip1: flags=0 mtu 1100
for a list of all network interfaces (fxp0, lo0, ppp0, ...), and their current state (which is probably mostly unconfigured at this time). To get more information about all the devices found during system startup, including network devices, type
To only get information about a single device, for example “fxp0”, run:
grep ^fxp0 /kern/msgbuffxp0 at pci1 dev 8 function 0: Intel PRO/100 VE (MOB) Network Controller, rev 131 fxp0: interrupting at irq 11 fxp0: Ethernet address 00:06:0d:c6:73:d5
You can return to the NetBSD installation by typing
Next, here is a chance to configure options for your network medium as shown in Figure 4.24, “Choosing network media options”, like duplex settings for ethernet, and various settings for wireless LAN cards.
It is unlikely that you will need to enter anything other than the default here. If you experience problems like very slow transfers or timeouts, you may for example force different duplex settings for ethernet cards here. To get a list of supported media and media options for a given network device (say: “fxp0”), escape from sysinst by pressing “Ctrl+Z”, then enter:
ifconfig -m fxp0fxp0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 address: 00:03:0d:c6:73:d5 media: Ethernet autoselect (10baseT) status: active supported Ethernet media: media 10baseT media 10baseT mediaopt full-duplex media 100baseTX media 100baseTX mediaopt full-duplex media autoselect inet 0.0.0.0 netmask 0xffffff00 broadcast 0.0.0.0 inet6 fe80::206:dff:fec6:73d5%fxp0 prefixlen 64 scopeid 0x1
The various values given after “media” may be of interest here, including keywords like “autoselect” but also including any “mediaopt” settings.
Return to the installation by typing
The next question will be if you want to perform DHCP autoconfiguration as shown in Figure 4.25, “Using DHCP for network configuration”. Answer “Yes” if you have a server for the Dynamic Host Configuration Protocol (DHCP) running somewhere on your network, and sysinst will fetch a number of defaults from it. Answer “No”, and you will have to enter all the values manually.
To explain things, we will assume you answered “No” and go into all the questions asked in detail.
Figure 4.26, “Entering and configuring network data” shows the questions asked for the network configuration. The values asked for are:
This is the name of the domain you're in WRT the Domain Name System (and which has nothing to do with any NIS/YP domain you may be in!).
The name by which other machines can usually address your computer. Not really used during installation.
Enter your numerical Internet Protocoll address in “dotted quad” notation here.
The netmask for your network, either given as a hex value (“0xffffff00”) or also in dotted-quad notation (“255.255.255.0”).
Your default router's IP address. Do not use a hostname here.
Your (first) DNS server's IP address. Again, don't use a hostname here to avoid some nasty problems.
Please note that most of the network configuration parameters are not saved in the system you install. It can be argued that it should, but NetBSD was designed not to do so. Configuring network settings has to happen with other configuration works needed for NetBSD after installation, see Chapter 5, The first boot, Chapter 6, The second boot and basically the whole rest of this guide. Yes, NetBSD allows you a lot of choices!
After answering all questions for network configuration, they will be printed again with a chance to go back and re-enter them, see Figure 4.27, “Confirming network parameters”. When selecting “No”. Choose “Yes” if you are satisfied with your settings to proceed with the installation.
sysinst will now run a few commands (not displayed in detail here) to configure the network: flushing the routing table, setting the default route, and testing if the network connection is operational.
The next question asked is about the place where files should be stored during download, see Figure 4.28, “Which directory to use for downloading”. The default directory is usually ok, it is located on the NetBSD file system.
After the installer knows where to download files, what network connection to use for downloading them, and on which partition and file system to extract them, the last data missing is the place where to download the install sets from, which is what the next dialogue shown in Figure 4.29, “Defining the set's source place” allows to change. You can adjust the host where the sets are fetched from, the base directory of the NetBSD release you want to install and the set directory (relative to the base directory), which usually contains the architecture you want to install. You can also change the FTP user's login name (“user”) and password here, if needed. If you want to use a FTP proxy for downloading, enter its URL here as well.
When you're satisfied with your settings (the defaults work most of the time), choose “Get Distribution” to continue.
If you made an error and sysinst cannot fine a file, it will tell you so as shown in Figure 4.30, “An error happened during download” and you will have a chance to go back and adjust the place where it will download the sets from.
If the data given for the download was correct, the set files will be downloaded and stored in the directory given before, as shown in Figure 4.31, “Downloading installation sets”.
After all sets are available at this step - either from a CD-ROM/DVD or in a directory where the set files were downloaded into, they will be extracted into the new NetBSD file system next. Figure 4.32, “Extracting set files” shows an example extraction progress with a progress bar, as selected before.
After extracting all selected sets,
sysinst will create device nodes in
/dev directory and then displays a
message saying that everything went well.
If the set files were downloaded from the net, you can delete them after extraction, or keep them around. sysinst will ask and do as you please - select “No” to keep the files, and “Yes” to delete them, as shown in Figure 4.33, “Deleting sets after extraction?”.
Another message (see Figure 4.34, “Set extraction completed”) will let you know that the set extraction is now completed, and that you will have an opportunity to configure some essential things before finishing the NetBSD installation.
The first thing you can adjust is the timezone in which the system resides. It is Universal Time Coordinated (UTC) by default, and you can use the two-level menu of continents/countries and cities shown in Figure 4.35, “Selecting your system's time zone” to determine your timezone. If you are satisfied with your choice, press the Return key to update the display of your local time. Press “x” followed by Return to exit timezone selection.
The next thing that is asked is which algorithm shall be used to encrypt the password file (Figure 4.36, “Selecting a password encryption scheme”). While DES is the standard algorithm used on most Unix systems, MD5 and 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 are asked if you want to set the root password, see Figure 4.37, “Setting the root password now or later?”. NetBSD doesn't start any services when booting up after installation, yet it is still recommended to set a root password right here for security reasons.
When you agree to set a root password, sysinst will run the passwd(1) utility for you, and you should enter your new root password (twice). Please note that the password is not echoed, and if you enter a very simple password, the system will warn you about this, see Figure 4.38, “Setting the root password”. If you insist on entering the same simple password again, NetBSD will give in and let you have your will, providing you with all the rope you need to hang yourself (metaphorically speaking, of course).
Next item to tweak is to choose which command line interpreter - also known as “shell” in Unix - to use for the root account. As printed in Figure 4.39, “Choosing a shell for the root account”, the default is the C shell (csh), other choices are Korn shell (ksh) and the classic Bourne shell (sh). While BSD systems have traditionally shipped with “csh” as login shell for the system manager, modern systems tend to come with a Bourne shell (or variantes thereof, like ksh or bash), and it may be useful to chose this if you have experience on such systems. Else, the default will be fine, and it can always be changed later (see Section 5.6, “Changing the shell”).
At this point the installation is finished, see Figure 4.40, “Congratulations”.
After passing the dialog that confirms the installation, sysinst will return to the main sysinst menu. Remove any installation media (floppy, CDROM) from your drives, and choose “Reboot the computer” to boot your NetBSD installation as shown in Figure 4.41, “Reboot the system to finish installation”.