[OpenBSD]

[FAQ 索引] [到 3 - 获得 OpenBSD] [到 5 - 从源代码构建系统]

4 - OpenBSD 4.2 安装指南


目录


4.1 - OpenBSD 安装过程概要

OpenBSD has a robust and adaptable text-based installation procedure, and can be installed from a single floppy disk. Most platforms follow a similar installation procedure; however there are some differences in the details. In all cases, you are urged to read the platform-specific INSTALL document in the platform directory on the CD-ROM or FTP sites (for example, i386/INSTALL.i386, mac68k/INSTALL.mac68k or sparc/INSTALL.sparc).

The OpenBSD installation process uses a special kernel with a number of utilities and install scripts embedded in a preloaded RAM disk. After this kernel is booted, the operating system is extracted from a number of compressed tar(1) (.tgz) files from a source other than this preloaded RAM disk. There are several ways to boot this install kernel:

Not every platform supports all boot options: All platforms can also use a bsd.rd to reinstall or upgrade.

Once the install kernel is booted, you have several options of where to get the install file sets. Again, not every platform supports every option.

4.2 - 安装前的检查列表

Before you start your install, you should have some idea what you want to end up with. You will want to know the following items, at least:

4.3 - 创建 OpenBSD 安装媒体

As examples, we will look at the installation images available for the i386 and sparc platforms.

The i386 platform has six separate installation disk images to choose from:

Yes, there may be situations where one install disk is required to support your SCSI adapter and another disk is required to support your network adapter. Fortunately, this is a rare event, and can usually be worked around.

The sparc platform has four separate installation disk images to choose from:

4.3.1 - 在 Unix 中创建引导软盘

To create a formatted floppy, use the fdformat(1) command to both format and check for bad sectors.

  # fdformat /dev/rfd0c
  Format 1440K floppy `/dev/rfd0c'? (y/n): y
  Processing VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV done.

If your output is like the above example, then the disk is OK. However, if you do not see ALL "V"'s then the disk is most likely bad, and you should try a new one.

Note that some Unix-like systems have different commands for formatting floppies. Refer to your system's documentation for the exact procedure.

Once you have a clean, formatted floppy it is time to write the installation image to floppy. For this, you can use the dd(1) utility. An example usage of dd(1) is below:

  # dd if=floppy42.fs of=/dev/rfd0c bs=32k

Once the image is written, check to make sure that the copied image is the same as the original with the cmp(1) command. If the diskette is identical to the image, you will just see another prompt.

  # cmp /dev/rfd0c floppy42.fs

4.3.2 - 在 Windows 或 DOS 中创建引导软盘

This section describes how to write the installation images to floppy disk under Windows or DOS. You can get the tools mentioned below from the tools directory on any of the FTP mirrors, or from the 4.2/tools directory on CD1 of the OpenBSD CD set.

To prepare a floppy in MS-DOS or Windows, first use the native formatting tools to format the disk.

To write the installation image to the prepared floppy you can use rawrite, fdimage, or ntrw. rawrite will not work on Windows NT, 2000 or XP.

Note that FDIMAGE.EXE and RAWRITE.EXE are both MS-DOS applications, and thus are limited to MS-DOS's "8.3" file naming convention. As floppyB42.fs and floppyC42.fs have longer file names, you will have to find out how your system stored the file in "8.3 format" before using FDIMAGE.EXE or RAWRITE.EXE to make your boot floppies.

Example usage of rawrite:
  C:\> rawrite
  RaWrite 1.2 - Write disk file to raw floppy diskette

  Enter source file name: floppy42.fs
  Enter destination drive: a
  Please insert a formatted diskette into drive A: and press -ENTER- : Enter

Example usage of fdimage:
  C:\> fdimage -q floppy42.fs a:

Example usage of ntrw:
  C:\> ntrw floppy42.fs a:
  3.5", 1.44MB, 512 bytes/sector
  bufsize is 9216
  1474560 bytes written

4.3.3 - 创建引导 CD

You can create a CD-ROM using the cd42.iso or install42.iso files. The exact details here are left to the reader to determine with the tools they have at their disposal.

Some of the tools in OpenBSD are:

4.4 - 使用 OpenBSD 安装媒体启动

Booting i386/amd64

Booting an install image on the i386 and amd64 PC platforms is nothing new to most people. If you are using a floppy disk, simply insert the floppy into the floppy drive and boot the system. The install image will then load, provided floppy boot is enabled in your BIOS. If you want to boot from CD, you must go into your system's BIOS and set the boot options to allow booting from CD. Some older BIOSes do not have this option, and you must use a floppy for booting your installation image. Don't worry though; even if you boot from floppy you can still install from the CD.

You can also install by booting bsd.rd from an existing OpenBSD partition, or over the network using the PXE boot process.

Booting sparc/sparc64

NOTE: On the sparc64 platform, only the SBus machines (Ultra 1, Ultra 2) are bootable from floppy.

To boot from floppy, place the floppy disk with the OpenBSD installation image on it into the floppy drive. Then use the following command to boot from the floppy:

  ok boot floppy

To boot from CD-ROM, place the OpenBSD CD-ROM disk into the drive. If your Sun only has one CD-ROM drive, then just go to the boot prompt, where you can 'boot cdrom':

  ok boot cdrom

Of course, this will only work in new command mode. If you are at the old command mode prompt (a right arrow), type 'n' for the new command mode. (If you are using an old sparc that is pre-sun4c, you probably don't have a new command mode. In this case, you need to experiment.) If you have multiple CD-ROM devices, you need to boot from the correct one. Try probe-scsi from the new command mode.

  ok probe-scsi

  Target 0
    Unit 0   Disk     QUANTUM LIGHTNING 365S
  Target 1
    Unit 0   Removable Disk     QUANTUM EMPIRE_1080S
  Target 3
    Unit 0   Removable Disk     Joe's CD-ROM

Figure out which disk is the CD-ROM you want to boot from. Note the target number.

  ok boot /sbus/esp/sd@X,0

4.5 - 执行安装

4.5.1 - 开始安装

Whatever your means of booting is, it is now time to use it. During the boot process, the kernel and all of the programs used to install OpenBSD are loaded into memory. The most common problem when booting is a bad floppy disk or a drive alignment problem. The boot floppy is quite tightly packed -- any bad spot will cause problems.

At almost any point during the OpenBSD install process, you can terminate the current install attempt by hitting CTRL-C and can restart it without rebooting by running install at the shell prompt.

When your boot is successful, you will see a lot of text messages scroll by. This text, on many architectures in white on blue, is the dmesg, the kernel telling you what devices have been found, and where. Don't worry about remembering this text, as a copy is saved as /var/run/dmesg.boot.

Then, you will see the following:

  root on rd0a swap on rd0b dump on rd0b
  erase ^?, werase ^W, kill ^U, intr ^C, status ^T
  (I)nstall, (U)pgrade or (S)hell? i

And with that, we reach our first question. Most of the time, you have the three options shown:

On occasion, you will not see the "Upgrade" option listed. After a flag day event, it is not possible to directly upgrade; one must reinstall the system from scratch.

In this example, we will do an install, but the upgrade process is similar.

  Welcome to the OpenBSD/i386 4.2 install program.

  This program will help you install OpenBSD. At any prompt except password
  prompts you can escape to a shell by typing '!'. Default answers are shown
  in []'s and are selected by pressing RETURN.  At any time you can exit this
  program by pressing Control-C, but exiting during an install can leave your
  system in an inconsistent state.

  Terminal type: [vt220] Enter
  kbd(8) mapping? ('L' for list) [none] Enter

In most cases, the default terminal type is appropriate; however if you are using a serial console for install, don't just take the default, respond appropriately.

If you do not select a keyboard encoding table, a US keyboard layout will be assumed.

  IS YOUR DATA BACKED UP? As with anything that modifies disk contents, this
  program can cause SIGNIFICANT data loss.

  It is often helpful to have the installation notes handy. For complex disk
  configurations, relevant disk hardware manuals and a calculator are useful.

  Proceed with install? [no] y

If you take the default here, the install process will terminate and drop you to a shell prompt.

The installation notes referred to here are on the install CDs and FTP servers, in the file INSTALL.<plat>, where <plat> is your platform, for instance, i386.

4.5.2 - 配置磁盘

Important Note: Users with a large hard disk (larger than was commonly available when your computer was made) will want to see this section before going any further.

Setting up disks in OpenBSD varies a bit between platforms. For i386, amd64, macppc, zaurus and armish, disk setup is done in two stages. First, the OpenBSD slice of the hard disk is defined using fdisk(8), then that slice is subdivided into OpenBSD partitions using disklabel(8).

Some users may be a little confused by the terminology used here. It will appear we are using the word "partition" in two different ways. This observation is correct. There are two layers of partitioning in the above OpenBSD platforms, the first, one could consider the Operating System partitioning, which is how multiple OSs on one computer mark out their own space on the disk, and the second one is how the OpenBSD partition is sub-partitioned into individual filesystems. The first layer is visible as a disk partition to DOS, Windows, and any other OS that uses this disk layout system, the second layer of partitioning is visible only to OpenBSD and those OSs which can directly read an OpenBSD filesystem.

  Cool!  Let's get to it...

  You will now initialize the disk(s) that OpenBSD will use. To enable all
  available security features you should configure the disk(s) to allow the
  creation of separate filesystems for /, /tmp, /var, /usr, and /home.

  Available disks are: wd0.
  Which one is the root disk? (or done) [wd0] Enter

The root disk is the disk the system will boot from, and normally where swap space resides. IDE disks will show up as wd0, wd1, etc., SCSI disks and RAID devices will show up as sd0, sd1, and so on. All the disks OpenBSD can find are listed here -- if you have drives which are not showing up, you have unsupported or improperly configured hardware.

  Do you want to use *all* of wd0 for OpenBSD? [no] Enter

If you say "yes" to this question, the entire disk will be allocated to OpenBSD. This will result in a standard Master Boot Record and partition table being written out to disk -- one partition, the size of the entire hard disk, set to the OpenBSD partition type, and flagged as the bootable partition. This will be a common choice for most production uses of OpenBSD; however, there are some systems this should not be done on. Many Compaq systems, many laptops, some Dell and other systems use a "maintenance" or "Suspend to Disk" partition, which should be kept intact. If your system has any other partitions of any type you do not wish to erase, do not select "yes" to the above question. On the other hand, if your system has a brand new disk that has never been used, you will probably want to say "yes" here (or use the "update" option of fdisk), so you do get a valid master boot record and signature in place.

For the sake of this example, we will assume the disk is to be split between OpenBSD and a pre-existing Windows 2000 partition, so we take the default of "no", which will take us into the fdisk(8) program. You can also get more information on fdisk(8) here.

Note: If you say "Y" to "Do you want to use *all* of wd0 for OpenBSD?" question, or if you are using a platform which does not use fdisk (for example, sparc64), you will not go through this step, but will rather jump directly to creating a disklabel

  You will now create a single MBR partition to contain your OpenBSD data. This
  partition must have an id of 'A6'; must *NOT* overlap other partitions; and
  must be marked as the only active partition.

  The 'manual' command describes all the fdisk commands in detail.

  Disk: wd0       geometry: 2586/240/63 [39100320 Sectors]
  Offset: 0       Signature: 0xAA55
           Starting       Ending       LBA Info:
   #: id    C   H  S -    C   H  S [       start:      size   ]
  ------------------------------------------------------------------------
  *0: 0B    0   1  1 -  202 239 63 [          63:     3069297 ] Win95 FAT-32
   1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
   2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
   3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
  Enter 'help' for information
  fdisk: 1> help
          help            Command help list
          manual          Show entire OpenBSD man page for fdisk
          reinit          Re-initialize loaded MBR (to defaults)
          setpid          Set the identifier of a given table entry
          disk            Edit current drive stats
          edit            Edit given table entry
          flag            Flag given table entry as bootable
          update          Update machine code in loaded MBR
          select          Select extended partition table entry MBR
          swap            Swap two partition entries
          print           Print loaded MBR partition table
          write           Write loaded MBR to disk
          exit            Exit edit of current MBR, without saving changes
          quit            Quit edit of current MBR, saving current changes
          abort           Abort program without saving current changes
  fdisk: 1>

A few commands are worthy of elaboration: A few commands are worthy of elaboration:

It is worth pointing out once again, an error here will result in significant data loss. If you are going to do this on a drive with important data, it might be worth practicing on a "disposable" drive, in addition to having a good backup.

Our drive here has a 1.5G partition for Windows 2000 (using the FAT filesystem). Looking at the info from the above display, we can see that the Windows partition occupies through cylinder 202 on the drive. So, we are going to allocate the rest of the disk to OpenBSD, starting at cylinder 203. You could also calculate OpenBSD's starting sector of 3069360 by adding the existing partition's starting sector (63) and its size (3069297).

You can edit the drive layout in either Cylinder/Heads/Sectors form or just raw sectors. Which is easier depends upon what you are doing; in this case, working around an existing partition, using CHS format will probably be easier. If you are creating the first partition on the disk, just using raw sectors may be easier.

  fdisk: 1> e 1
           Starting       Ending       LBA Info:
   #: id    C   H  S -    C   H  S [       start:      size   ]
  ------------------------------------------------------------------------
   1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
  Partition id ('0' to disable)  [0 - FF]: [0] (? for help) a6
  Do you wish to edit in CHS mode? [n] y
  BIOS Starting cylinder [0 - 2585]: [0] 203
  BIOS Starting head [0 - 239]: [0] Enter
  BIOS Starting sector [1 - 63]: [0] 1
  BIOS Ending cylinder [0 - 2585]: [0] 2585
  BIOS Ending head [0 - 239]: [0] 239
  BIOS Ending sector [1 - 63]: [0] 63
  fdisk:*1> p
  Disk: wd0       geometry: 2586/240/63 [39100320 Sectors]
  Offset: 0       Signature: 0xAA55
           Starting       Ending       LBA Info:
   #: id    C   H  S -    C   H  S [       start:      size   ]
  ------------------------------------------------------------------------
  *0: 0B    0   1  1 -  202 239 63 [          63:     3069297 ] Win95 FAT-32
   1: A6  203   0  1 - 2585 239 63 [     3069360:    36030960 ] OpenBSD
   2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
   3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
  fdisk:*1> p m
  Disk: wd0       geometry: 2586/240/63 [19092 Megabytes]
  Offset: 0       Signature: 0xAA55
           Starting       Ending       LBA Info:
   #: id    C   H  S -    C   H  S [       start:      size   ]
  ------------------------------------------------------------------------
  *0: 0B    0   1  1 -  202 239 63 [          63:        1499M] Win95 FAT-32
   1: A6  203   0  1 - 2585 239 63 [     3069360:       17593M] OpenBSD
   2: 00    0   0  0 -    0   0  0 [           0:           0M] unused
   3: 00    0   0  0 -    0   0  0 [           0:           0M] unused
  fdisk:*1>

On platforms which use fdisk, it is important that the first partition skips the first track of the disk, in this case, starting on sector 63. This will vary from machine to machine and disk system to disk system. If an OpenBSD partition is created starting at offset 0, this partition table will end up being overwritten by the OpenBSD partition's Partition Boot Record. The system may still be bootable, but it will be very difficult to maintain, and this configuration is not recommended or supported.

Note that the prompt changed to include an asterisk ('*') to indicate you have unsaved changes. As we can see from the output of p m we have not altered our Windows partition, we have successfully allocated the rest of the drive for OpenBSD, and the partitions do not overlap. We are in business. Almost.

What we haven't done is flagged the partition as active so the machine will boot OpenBSD on the next reboot:

  fdisk:*1> f 1
  Partition 1 marked active.
  fdisk:*1> p
  Disk: wd0       geometry: 2586/240/63 [39100320 Sectors]
  Offset: 0       Signature: 0xAA55
           Starting       Ending       LBA Info:
   #: id    C   H  S -    C   H  S [       start:      size   ]
  ------------------------------------------------------------------------
   0: 0B    0   1  1 -  202 239 63 [          63:     3069297 ] Win95 FAT-32
  *1: A6  203   0  1 - 2585 239 63 [     3069360:    36030960 ] OpenBSD
   2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
   3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
  fdisk:*1>

And now, we are ready to save our changes:

  fdisk:*1> w
  Writing MBR at offset 0.
  wd0: no disk label
  fdisk: 1> q

Creating a disklabel

The next step is to use disklabel(8) to slice up the OpenBSD partition. More details on using disklabel(8) can be found in FAQ 14, disklabel.

  Here is the partition information you chose:

  Disk: wd0       geometry: 2586/240/63 [39100320 Sectors]
  Offset: 0       Signature: 0xAA55
           Starting       Ending       LBA Info:
   #: id    C   H  S -    C   H  S [       start:      size   ]
  ------------------------------------------------------------------------
   0: 0B    0   1  1 -  202 239 63 [          63:     3069297 ] Win95 FAT-32
  *1: A6  203   0  1 - 2585 239 63 [     3069360:    36030960 ] OpenBSD
   2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
   3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

  You will now create an OpenBSD disklabel inside the OpenBSD MBR
  partition. The disklabel defines how OpenBSD splits up the MBR partition
  into OpenBSD partitions in which filesystems and swap space are created.

  The offsets used in the disklabel are ABSOLUTE, i.e. relative to the
  start of the disk, NOT the start of the OpenBSD MBR partition.

  disklabel: no disk label
  WARNING: Disk wd0 has no label. You will be creating a new one.

  # using MBR partition 1: type A6 off 3069360 (0x2ed5b0) size 36030960 (0x225c9f0)

  Treating sectors 3069360-39100320 as the OpenBSD portion of the disk.
  You can use the 'b' command to change this.

  Initial label editor (enter '?' for help at any prompt)
  > ?
  Available commands:
          ? [cmnd]  - this message or command specific help.
          a [part]  - add new partition.
          b         - set OpenBSD disk boundaries.
          c [part]  - change partition size.
          D         - set label to default.
          d [part]  - delete partition.
          e         - edit drive parameters.
          g [b|d|u] - use [b]ios, [d]isk or [u]ser geometry.
          M         - show entire OpenBSD man page for disklabel.
          m [part]  - modify existing partition.
          n [part]  - set the mount point for a partition.
          p [unit]  - print label.
          q         - quit and save changes.
          r         - recalculate free space.
          s [path]  - save label to file.
          u         - undo last change.
          w         - write label to disk.
          X         - toggle expert mode.
          x         - exit without saving changes.
          z         - zero out partition table.
  Numeric parameters may use suffixes to indicate units:
          'b' for bytes, 'c' for cylinders, 'k' for kilobytes, 'm' for megabytes,
          'g' for gigabytes or no suffix for sectors (usually 512 bytes).
          '%' for percent of total disk size, '&' for percent of free space.
          Non-sector units will be rounded to the nearest cylinder.
  Entering '?' at most prompts will give you (simple) context sensitive help.
  >

Again, a few of these commands could use a little elaboration:

Slicing up your disk properly is important. The answer to the question, "How should I partition my system?" is "Exactly how you need it". This will vary from application to application. There is no universal answer. If you are unsure of how you want to partition your system, see this discussion.

In this system, we have over 17G available for OpenBSD. That's a lot of space, and it isn't likely we will need most of it. So, we will deliberately not use absolute minimum sizes. We would rather have a few hundred megabytes of unused space than a kilobyte too little.

On the root disk, an 'a' partition must be created for the root filesystem (/). The installation process can not proceed without it. Generally, you will want to have a swap partition, 'b', as well, though if you are sure your system will never exhaust real memory, you can leave it off. If a 'b' partition exists on the root disk, it will automatically be used for swap. Swap partitions on other disks will have to be manually added to /etc/fstab.

After a little thought, we decide to create just enough partitions to allow the creation of the recommended separate filesystems (/, /tmp, /var, /usr, /home) along with a swap partition:

Now, if you add those up, you will see over 6G of space is unused! Unused space won't hurt anything, and it gives us flexibility to enlarge things in the future if need be. Need more /tmp? Create a new partition in the unused space, format the new partition with newfs(8), and change /etc/fstab to mount the new partition onto /tmp. Problem solved.

  > p m
  device: /dev/rwd0c
  type: ESDI
  disk: ESDI/IDE disk
  label: ST320011A
  bytes/sector: 512
  sectors/track: 63
  tracks/cylinder: 16
  sectors/cylinder: 1008
  cylinders: 16383
  total sectors: 39102336
  free sectors: 36030960
  rpm: 3600

  16 partitions:
  #             size        offset  fstype [fsize bsize  cpg]
    a:      17593.2M       1498.7M  unused      0     0
    c:      19092.9M          0.0M  unused      0     0
    i:       1498.7M          0.0M  MSDOS
  > d a
  > a a
  offset: [3069360] Enter
  size: [36030960] 150m
  Rounding to cylinder: 317520
  FS type: [4.2BSD] Enter
  mount point: [none] /
  > a b
  offset: [3386880] Enter
  size: [35713440] 300m
  Rounding to cylinder: 619920
  FS type: [swap] Enter
  > a d
  offset: [4006800] Enter
  size: [35093520] 120m
  Rounding to cylinder: 257040
  FS type: [4.2BSD] Enter
  mount point: [none] /tmp
  > a e
  offset: [4263840] Enter
  size: [34836480] 80m
  Rounding to cylinder: 166320
  FS type: [4.2BSD] Enter
  mount point: [none] /var
  > a g
  offset: [4430160] Enter
  size: [34670160] 6g
  Rounding to cylinder: 12594960
  FS type: [4.2BSD] Enter
  mount point: [none] /usr
  > a h
  offset: [17025120] Enter
  size: [22075200] 4g
  Rounding to nearest cylinder: 8391600
  FS type: [4.2BSD] Enter
  mount point: [none] /home
  > p m
  device: /dev/rwd0c
  type: ESDI
  disk: ESDI/IDE disk
  label: ST320011A
  bytes/sector: 512
  sectors/track: 63
  tracks/cylinder: 240
  sectors/cylinder: 15120
  cylinders: 2586
  total bytes: 19092.9M
  free bytes: 6681.4M
  rpm: 3600

  16 partitions:
  #             size        offset  fstype [fsize bsize  cpg]
    a:           155.0M          1498.7M  4.2BSD   2048 16384   16 # /
    b:           302.7M          1653.8M    swap
    c:         19092.9M             0.0M  unused      0     0
    d:           125.5M          1956.4M  4.2BSD   2048 16384   16 # /tmp
    e:            81.2M          2082.0M  4.2BSD   2048 16384   16 # /var
    g:          6149.9M          2163.2M  4.2BSD   2048 16384   16 # /usr
    h:          4097.5M          8313.0M  4.2BSD   2048 16384   16 # /home
    i:          1498.7M             0.0M   MSDOS
  > q
  Write new label?: [y] Enter

You will note there is a c partition we seem to have ignored. This partition is your entire hard disk; don't attempt to alter it. You will also note the i partition wasn't defined by us; this is the pre-existing Windows 2000 partition. Partitions are not assigned any particular letters -- with the exception of a (root), b (swap) and c (entire disk), the rest of the partitions (through letter p) are available for use as you desire.

If you look closely at the output of the disklabel, you will note that your drive RPM rating is probably wrong. This is historical; the drive speed is not used in any way by the system. Do not worry about it.

Configuring your mount points and formatting your filesystems

Now comes the final configuration of your mount points. If you configured the mount points through disklabel(8), this step consists of just verifying your selections; otherwise, you can specify them now.

  Mount point for wd0d (size=128520k)? (or 'none' or 'done') [/tmp] Enter
  Mount point for wd0e (size=83160k)? (or 'none' or 'done') [/var] Enter
  Mount point for wd0g (size=6297480k)? (or 'none' or 'done') [/usr] Enter
  Mount point for wd0h (size=4195800k)? (or 'none' or 'done') [/home] Enter
  Mount point for wd0d (size=128520k)? (or 'none' or 'done') [/tmp] done
  No more disks to initialize.

  OpenBSD filesystems:
  wd0a /
  wd0d /tmp
  wd0e /var
  wd0g /usr
  wd0h /home

  The next step *DESTROYS* all existing data on these partitions!
  Are you really sure that you're ready to proceed? [no] y
  newfs: reduced number of fragments per cylinder group from 19840 to 19760 to enl
  arge last cylinder group
  /dev/rwd0a: 155.0MB in 317520 sectors of 512 bytes
  5 cylinder groups of 38.59MB, 2470 blocks, 4992 inodes each
  newfs: reduced number of fragments per cylinder group from 16064 to 15992 to enl
  arge last cylinder group
  /dev/rwd0d: 125.5MB in 257040 sectors of 512 bytes
  5 cylinder groups of 31.23MB, 1999 blocks, 4096 inodes each
  newfs: reduced number of fragments per cylinder group from 10392 to 10344 to enl
  arge last cylinder group
  /dev/rwd0e: 81.2MB in 166320 sectors of 512 bytes
  5 cylinder groups of 20.20MB, 1293 blocks, 2688 inodes each
  /dev/rwd0g: 6149.9MB in 12594960 sectors of 512 bytes
  31 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
  /dev/rwd0h: 4097.5MB in 8391600 sectors of 512 bytes
  21 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
  /dev/wd0a on /mnt type ffs (rw, asynchronous, local, ctime=Tue Oct 23 00:55:20 2
  007)
  /dev/wd0h on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid, ctime=T
  ue Oct 23 00:55:20 2007)
  /dev/wd0d on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid, ctime=Tu
  e Oct 23 00:55:20 2007)
  /dev/wd0g on /mnt/usr type ffs (rw, asynchronous, local, nodev, ctime=Tue Oct 23
   00:55:20 2007)
  /dev/wd0e on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid, ctime=Tu
  e Oct 23 00:55:20 2007)

You may wonder why the installer again asks for mount points. This allows you to recover from any errors or omissions in the mount points specified during the creation of the disklabel. For instance, the installation process will automatically delete any duplicate mount points you enter during the configuration of the disklabel. The disklabel program will allow you to enter such duplicates, and thus they must be checked for after the disklabel program exits. The deleted duplicate mount points will result in partitions without mount points, that you must assign new mount points for if you wish to use the space.

Notice the "Are you really sure that you are ready to proceed?" question defaults to no, so you will have to deliberately tell it to proceed and format your partitions. If you chose no, you would simply be dropped into a shell and could start the install again by typing "install", or just by rebooting again with your boot disk.

At this point all filesystems will be formatted for you. This could take some time depending on the size of the partitions and the speed of the disk.

4.5.3 - 设置主机名称

Now you must set the system hostname. This value, along with the DNS domain name (specified below), will be saved in the file /etc/myname, which is used during normal boot to set the hostname of the system. If you do not set the domain name of the system, the default value of 'my.domain' will be used.

It is important to set this name now, because it will be used when the cryptographic keys for the system are generated during the first boot after installation. This generation takes place whether the network is configured or not.

  System hostname (short form, e.g. 'foo'): puffy

4.5.4 - 配置网络

Now it is time to configure your network. The network must be configured if you are planning on doing an FTP or NFS based install, considering it will be based upon the information you are about to enter. Here is a walk through of the network configuration section of the install process. In our example, we will attach one interface (fxp0) to a cable modem, which will be configured using DHCP, the other will be to our internal network, and configured statically.

  Configure the network? [yes] Enter
  Available interfaces are: fxp0 xl0.
  Which one do you wish to initialize? (or 'done') [fxp0] xl0
  Symbolic (host) name for xl0? [puffy] Enter
  The media options for xl0 are currently
          media: Ethernet autoselect (100baseTX full-duplex)
  Do you want to change the media options? [no] Enter
  IPv4 address for xl0? (or 'dhcp') 192.168.1.254
  Netmask? [255.255.255.0] Enter
  IPv6 address for xl0? (or 'rtsol' or 'none') [none] Enter
  Available interfaces are: fxp0.
  Which one do you wish to initialize? (or 'done') [fxp0] Enter
  Symbolic (host) name for fxp0? [puffy] Enter
  The media options for fxp0 are currently
          media: Ethernet autoselect (10baseT half-duplex)
  Do you want to change the media options? [no] Enter
  IPv4 address for fxp0? (or 'none' or 'dhcp') dhcp
  Issuing hostname-associated DHCP request for fxp0.
  DHCPDISCOVER on fxp0 to 255.255.255.255 port 67 interval 1
  DHCPOFFER from 73.34.136.1
  DHCPREQUEST on fxp0 to 255.255.255.255 port 67
  DHCPACK from 73.34.136.1
  bound to 69.241.244.76 -- renewal in 1800 seconds.
  IPv6 address for fxp0? (or 'rtsol' or 'none') [none] Enter
  No more interfaces to initialize.
  DNS domain name? (e.g. 'bar.com') [my.domain] example.com
  DNS nameserver? (IP address or 'none') [68.87.77.130 68.87.72.130] Enter
  Use the nameserver now? [yes] Enter
  Default route? (IP address, 'dhcp' or 'none') [dhcp] Enter
  Edit hosts with ed? [no] Enter
  Do you want to do any manual network configuration? [no] Enter

NOTE: Only one interface can easily be configured using DHCP during an install. If you attempt to configure more than one interface using DHCP you will encounter errors. You have to manually configure the additional interfaces after the installation.

Now, we set the password for the root account:

Password for root account? (will not echo) pAssWOrd
Password for root account? (again) pAssWOrd

Use a secure password for the root account. You will create other user accounts after the system is booted. From passwd(1):

    The new password should be at least six characters long and not purely
    alphabetic.  Its total length must be less than _PASSWORD_LEN (currently
    128 characters).  A mixture of both lower and uppercase letters, numbers,
    and meta-characters is encouraged.

4.5.5 - 选择安装媒体

After your network is set up, the install script will give you a chance to make manual adjustments to the configuration.

Next, you will get a chance to choose your installation media. The options are listed below.

  Let's install the sets!
  Location of sets? (cd disk ftp http or 'done') [cd] Enter
  Available CD-ROMs are: cd0.

In this example we are installing from CD-ROM. This will bring up a list of devices on your computer identified as a CD-ROM. Most people will only have one. If you need to, make sure you pick the device which you will use to install OpenBSD from.

NOTE: Not all platforms support all installation options. In this case, the OpenBSD/i386 platform does not support NFS installs, so they are not shown on this list.

  Available CD-ROMs are: cd0.
  Which one contains the install media? (or 'done') [cd0] Enter
  Pathname to the sets?  (or 'done') [4.2/i386] Enter

Here, you are prompted for which directory the installation files are, which is 4.2/i386/ on the official CD-ROM or a CD built from install42.iso.

4.5.6 - 选择文件集

Now it's time to choose which file sets you will be installing. You can get a description of these files in the next section. The files that the install program finds will be shown to you on the screen. Your job is just to specify which files you want. By default all the non-X file sets are selected; however, some advanced users may wish to limit this to the bare minimum required to run OpenBSD, which would be base42.tgz, etc42.tgz and bsd. Most people will want to install the default file sets or all file sets. The example below is that of a full install.

  Select sets by entering a set name, a file name pattern or 'all'. De-select
  sets by prepending a '-' to the set name, file name pattern or 'all'. Selected
  sets are labeled '[x]'.

          [X] bsd
          [X] bsd.rd
          [ ] bsd.mp
          [X] base42.tgz
          [X] etc42.tgz
          [X] misc42.tgz
          [X] comp42.tgz
          [X] man42.tgz
          [X] game42.tgz
          [ ] xbase42.tgz
          [ ] xetc42.tgz
          [ ] xshare42.tgz
          [ ] xfont42.tgz
          [ ] xserv42.tgz
  Set name? (or 'done') [bsd.mp] all

          [X] bsd
          [X] bsd.rd
          [X] bsd.mp
          [X] base42.tgz
          [X] etc42.tgz
          [X] misc42.tgz
          [X] comp42.tgz
          [X] man42.tgz
          [X] game42.tgz
          [X] xbase42.tgz
          [X] xetc42.tgz
          [X] xshare42.tgz
          [X] xfont42.tgz
          [X] xserv42.tgz

You can do all kinds of nifty things here -- "-x*" would remove all X components, if you changed your mind. In this case, we are going to load all the sets. While the system will run with fewer sets, either the starting default or installing all sets is recommended. More details on selecting sets here.

Once you have successfully picked which file sets you want, you will be prompted to make sure you want to extract these file sets and they will then be installed. A progress bar will be shown that will keep you informed on how much time it will take. The times range greatly depending on what system it is you are installing OpenBSD on, the file sets installed, and the speed of the source media. This part may take from a few minutes to several hours.

  Set name? (or 'done') [done] Enter
  Ready to install sets? [yes] Enter
  Getting bsd ...
  100% |**************************************************|  6083 KB    00:06
  Getting bsd.rd ...
  100% |**************************************************|  4949 KB    00:03
  Getting bsd.mp ...
  100% |**************************************************|  6130 KB    00:04
  Getting base42.tgz ...
  100% |**************************************************| 41604 KB    00:37
  Getting etc42.tgz ...
  100% |**************************************************|  1211 KB    00:01
  Getting misc42.tgz ...
  100% |**************************************************|  2239 KB    00:02
  Getting comp42.tgz ...
  100% |**************************************************| 76957 KB    01:04
  Getting man42.tgz ...
  100% |**************************************************|  7477 KB    00:08
  Getting game42.tgz ...
  100% |**************************************************|  2547 KB    00:02
  Getting xbase42.tgz ...
  100% |**************************************************| 11702 KB    00:10
  Getting xetc42.tgz ...
  100% |**************************************************| 75398       00:00
  Getting xshare42.tgz ...
  100% |**************************************************|  2488 KB    00:04
  Getting xfont42.tgz ...
  100% |**************************************************| 34745 KB    00:27
  Getting xserv42.tgz ...
  100% |**************************************************| 10108 KB    00:08
  Location of sets? (cd disk ftp http or 'done') [done] Enter

At this point, you can pull additional files from other sources (including custom file sets) if desired, or hit 'done' if you have installed all the file sets you need.

4.5.7 - 结束

Next, you get asked a few questions about settings for your installed system. First is whether sshd(8) should be started on boot. Usually, you will want sshd(8) running, but occasionally you may not. If your application has no need for sshd(8), there is a small theoretical security advantage to not having it running.

  Start sshd(8) by default? [yes] y

(If you change your mind later, alter /etc/rc.conf.local or /etc/rc.conf.)

You will be given the option to run OpenNTPD on boot. OpenNTPD is a low-impact way to keep your computer's clock accurately synchronized, and the default configuration is sufficient for many people's use.

  NTP server? (or 'none' or 'default') [none] default

If you have a local time server, you can specify it here, if you chose "default", OpenNTPD will use pool.ntp.org, a huge collection of free access time servers. (If you change your mind later, alter /etc/rc.conf.local and/or /etc/ntpd.conf.)

On some platforms, you will now be asked if you plan to run X on this system. If you answer 'Y', /etc/sysctl.conf will be modified to include the line machdep.allowaperture=1 or machdep.allowaperture=2, depending on your platform. Some platforms will not ask this question at all. If you do not intend to run X on this system or are not sure, answer 'N' here, as you can easily change it by editing /etc/sysctl.conf should you need to later. There is a potential security advantage to leaving this aperture driver xf86(4) disabled, as the graphics engine on a modern video card could potentially be used to alter memory beyond the processor's control.

  Do you expect to run the X Window System? [no] y

Next, you are asked if you are wanting to use a serial console with this computer, rather than a standard keyboard and monitor. If you chose "yes" and answer a couple other simple questions, /etc/boot.conf and /etc/ttys will be edited appropriately for you. Most users will take the default, no here.

  Change the default console to com0? [no] Enter

Your last task is to enter the time zone. Depending on where your machine lives, there are may be several equally valid answers for the question. In the example that follows, we used US/Eastern, but could also have used EST5EDT or US/Michigan and had the same result. Hitting ? at the prompts will guide you through your choices.

  Saving configuration files......done.
  Generating initial host.random file ......done.
  What timezone are you in? ('?' for list) [Canada/Mountain] ?
  Africa/      Chile/       GB-Eire      Israel       NZ-CHAT      UCT
  America/     Cuba         GMT          Jamaica      Navajo       US/
  Antarctica/  EET          GMT+0        Japan        PRC          UTC
  Arctic/      EST          GMT-0        Kwajalein    PST8PDT      Universal
  Asia/        EST5EDT      GMT0         Libya        Pacific/     W-SU
  Atlantic/    Egypt        Greenwich    MET          Poland       WET
  Australia/   Eire         HST          MST          Portugal     Zulu
  Brazil/      Etc/         Hongkong     MST7MDT      ROC          posix/
  CET          Europe/      Iceland      Mexico/      ROK          posixrules
  CST6CDT      Factory      Indian/      Mideast/     Singapore    right/
  Canada/      GB           Iran         NZ           Turkey       zone.tab
  What timezone are you in? ('?' for list) [Canada/Mountain] US
  What sub-timezone of 'US' are you in? ('?' for list) ?
  Alaska          Central         Hawaii          Mountain        Samoa
  Aleutian        East-Indiana    Indiana-Starke  Pacific
  Arizona         Eastern         Michigan        Pacific-New
  Select a sub-timezone of 'US' ('?' for list): Eastern
  Setting local timezone to 'US/Eastern'...done.

If you are concerned about very precise time, you may wish to read this.

The last steps are for the system to create the /dev directory (which may take a while on some systems, especially if you have a small amount of RAM), and install the boot blocks.

  Making all device nodes...done.
  Installing boot block...
  boot: /mnt/boot
  proto: /usr/mdec/biosboot
  device: /dev/rwd0c
  /usr/mdec/biosboot: entry point 0
  proto bootblock size 512
  /mnt/boot is 3 blocks x 16384 bytes
  fs block shift 2; part offset 3069360; inode block 24, offset 3624
  using MBR partition 1: type 166 (0xa6) offset 3069360 (0x2ed5b0)
  done.

  CONGRATULATIONS! Your OpenBSD install has been successfully completed!
  To boot the new system, enter halt at the command prompt. Once the
  system has halted, reset the machine and boot from the disk.
  # halt
  syncing disks... done

  The operating system has halted.
  Please press any key to reboot.

OpenBSD is now installed on your system and ready for its first boot, but before you do...

Before you reboot

At this point, your system is installed and ready to be rebooted and configured for service. Before doing this, however, it would be wise to check out the Errata page to see if there are any bugs that would immediately impact you.

A trick you can use for some "before first boot" configuration is to run:

    # /mnt/usr/sbin/chroot /mnt
at the shell prompt. This will set your mount points to be what they will be on a normal reboot of your newly installed system. You can now do some basic system configuration, such as adding users, changing mount points, etc.

After you reboot

One of your first things to read after you install your system is afterboot(8).

You may also find the following links useful:

One last thing...

The OpenBSD developers ask you to Send in a copy of your dmesg. This is really appreciated by the developers, and ultimately, all users.

4.6 - 安装时需要什么文件?

The complete OpenBSD installation is broken up into a number of separate file sets. Not every application requires every file set. Here is an overview of each:

The etc42.tgz and xetc42.tgz sets are not installed as part of an upgrade, only as part of a complete install, so any customizations you make will not be lost. You will have to update your /etc, /dev and /var directories manually.

Even if you have no intention of running X, some third party packages require the graphic libraries in xbase42.tgz to be installed on your system. These applications can usually be satisified simply by installing xbase42.tgz, the rest of X is not needed.

4.7 - 安装 OpenBSD 需要多大空间?

Obviously, the answer to this question varies tremendously based on your use of the system. However, these numbers can be used as a starting point:

(root)             60MB
/usr               420MB (no X) or 550MB (with X)
/var               25MB
/tmp               50MB
swap               32MB
Those are minimum suggested filesystem sizes for a full system install. The numbers include enough extra space to permit you to run a typical home system that is connected to the Internet, but not much else.

Keep the following facts in mind, however:

There are several reasons for using separate filesystems, instead of shoving everything into one or two filesystems:

Some additional thoughts on partitioning:

4.8 - OpenBSD 与多启动

Multibooting is having several operating systems on one computer, and some means of selecting the which OS is to boot. It is not a trivial task! If you don't understand what you are doing, you may end up deleting large amounts of data from your computer. New OpenBSD users are strongly encouraged to start with a blank hard drive on a dedicated machine, and then practice your desired configuration on a non-production system before attempting a multiboot configuration on a production machine. FAQ 14 has more information about the OpenBSD boot process.

Only one of the four primary MBR partitions can be used for booting OpenBSD (i.e., extended partitions will not work).

Here are several options to multibooting:

Setting active partitions

This is probably the most overlooked, and yet, sometimes the best solution for multibooting. Simply set the active partition in whatever OS you are currently using to be the one you want to boot by default when you next boot. Virtually every OS offers a program to do this; OpenBSD's is fdisk(8), similar named programs are in Windows 9x and DOS, and many other operating systems. This can be highly desirable for OSs or systems which take a long time to shut down and reboot -- you can set it and start the reboot process, then walk away, grab a cup of coffee, and come back to the system booted the way you want it -- no waiting for the Magic Moment to select the next OS.

Boot floppy

If you have a system that is used to boot OpenBSD infrequently (or don't wish other users of the computer to note anything has changed), consider using a boot floppy. Simply use one of the standard OpenBSD install floppies, and create an /etc/boot.conf file (yes, you will also have to create an /etc directory on the floppy) with the contents:
     boot hd0a:/bsd
to cause the system to boot from hard drive 0, OpenBSD partition 'a', kernel file /bsd. Note you can also boot from other drives with a line like: "boot hd2a:/bsd" to boot off the third hard drive on your system. To boot from OpenBSD, slip your floppy in, reboot. To boot from the other OS, eject the floppy, reboot.

In this case, the boot(8) program is loaded from the floppy, looks for and reads /etc/boot.conf. The "boot hd0a:/bsd" line instructs boot(8) where to load the kernel from -- in this case, the first HD the BIOS sees. Keep in mind, only a small file (/boot) is loaded from the floppy -- the system loads the entire kernel off the hard disk, so this only adds about five seconds to the boot process.

Windows NT/2000/XP NTLDR

To multiboot OpenBSD and Windows NT/2000/XP, you can use NTLDR, the boot loader that NT uses. To multi-boot with NT, you need a copy of your OpenBSD Partition Boot Record (PBR). After running installboot, you can copy it to a file using dd(1), following a process similar to:
    # dd if=/dev/rsd0a of=openbsd.pbr bs=512 count=1
Note: this is a really good time to remind you that blindly typing commands in you don't understand is a really bad idea. This line will not work directly on most computers. It is left to the reader to adapt it to their machine.

Now boot NT and put openbsd.pbr in C:. Add a line like this to the end of C:\BOOT.INI:

    c:\openbsd.pbr="OpenBSD"

When you reboot, you should be able to select OpenBSD from the NT loader menu. There is much more information available about NTLDR at the NTLDR Hacking Guide.

On Windows XP you can also edit the boot information using the GUI; see the XP Boot.ini HOWTO.

Programs that do much of this for you are available, for example, BootPart. This program can be run from Windows NT/2000/XP, and will fetch the OpenBSD PBR, place it on your NT/2000/XP partition, and will add it to C:\BOOT.INI

Note: The Windows NT/2000/XP boot loader is only capable of booting OSs from the primary hard drive. You can not use it to load OpenBSD from the second drive on a system.

Other boot loaders

Some other bootloaders OpenBSD users have used successfully include GAG, OS-BS, The Ranish Partition Manager and GRUB.

OpenBSD and Linux (i386)

Please refer to INSTALL.linux, which gives in depth instructions on getting OpenBSD working with Linux.

Time zone issues

OpenBSD expects the computer's real-time clock to be set to UTC (Universal Coordinated Time). Some other OSs expect the real-time clock to be set to local time. Obviously, this can create a bit of a problem if you are using both OSs on the same computer. One or the other is most likely going to have to be adapted. More info on doing this is in FAQ 8 - Why is my clock off by several hours?

4.9 - 安装后将你的 dmesg 发送到 dmesg@openbsd.org

Just to remind people, it's important for the OpenBSD developers to keep track of what hardware works, and what hardware doesn't work perfectly.

A quote from /usr/src/etc/root/root.mail

If you wish to ensure that OpenBSD runs better on your machines, please do us
a favor (after you have your mail system configured!) and type something like:
 # dmesg | mail -s "Sony VAIO 505R laptop, apm works OK" dmesg@openbsd.org
so that we can see what kinds of configurations people are running.  As shown,
including a bit of information about your machine in the subject or the body
can help us even further.  We will use this information to improve device driver
support in future releases.  (Please do this using the supplied GENERIC kernel,
not for a custom compiled kernel, unless you're unable to boot the GENERIC
kernel.  If you have a multi-processor machine, dmesg results of both GENERIC.MP
and GENERIC kernels are appreciated.)  The device driver information we get from
this helps us fix existing drivers. Thank you!

Make sure you send email from an account that is able to also receive email so developers can contact you if they have something they want you to test or change in order to get your setup working. It's not important at all to send the email from the same machine that is running OpenBSD, so if that machine is unable to receive email, just

$ dmesg | mail your-account@yourmail.dom
and then forward that message to
 dmesg@openbsd.org
where your-account@yourmail.dom is your regular email account.

NOTES

The method above is very easy, but if you have chosen not to configure mail on your OpenBSD system, you should still send your dmesg to the developers. Save your dmesg output to a text file.

$ dmesg > ~/dmesg.txt
Then transfer this file (using FTP/scp/floppydisk/carrier-pigeon/...) to the system you normally use for email. Since the dmesg output you send in is processed automatically, be sure to check the following when using alternate email clients/systems:

4.10 - 安装后增加文件集

"Oh no! I forgot to add a file set when I did the install!"

Sometimes, you realize you really DID need comp42.tgz (or any other system component) after all, but you didn't realize this at the time you installed your system. Good news: There are two easy ways to add file sets after the initial install:

Using the upgrade process

Simply boot your install media (CD-ROM or Floppy), and choose Upgrade (rather than Install). When you get to the lists of file sets to install, choose the sets you neglected to install first time around, select your source, and let it install them for you.

Using tar(1)

The install file sets are simply compressed tar files, and you can expand them manually from the root of the filesystem:

  # cd /
  # tar xzvphf comp42.tgz

Do NOT forget the 'p' option in the above command in order to restore the file permissions properly!

One common mistake is to think you can use pkg_add(1) to add a missing file sets. This does not work. pkg_add(1) is the package management tool to install third party software. It handles package files, not generic tar files like the install sets.

If you are installing the xbase file set on your system for the first time using tar(1) and without rebooting, the shared library cache must be updated after the installation using ldconfig(8). To add all the X libraries to the cache:

# ldconfig -m /usr/X11R6/lib
Alternatively, you can just reboot your system, and this will be done automatically by the rc(8) startup script.

4.11 - “bsd.rd” 是什么?

bsd.rd is a "RAM Disk" kernel. This file can be very useful; many developers are careful to keep it on the root of their system at all times.

Calling it a "RAM Disk kernel" describes the root filesystem of the kernel -- rather than being a physical drive, the utilities available after the boot of bsd.rd are stored in the kernel, and are run from a RAM-based filesystem. bsd.rd also includes a healthy set of utilities to allow you to do system maintenance and installation.

On some platforms, bsd.rd is actually the preferred installation technique -- you place this kernel on an existing filesystem, boot it, and run the install from it. On most platforms, if you have a running older version of OpenBSD, you can FTP a new version of bsd.rd, reboot from it, and install a new version of OpenBSD without using any removable media at all.

Here is an example of booting bsd.rd on an i386 system:
  Using Drive: 0 Partition: 3
  reading boot.....
  probing: pc0 com0 com1 apm mem[639k 255M a20=on]
  disk: fd0 hd0+
  >> OpenBSD/i386 BOOT 2.10
  boot> boot hd0a:/bsd.rd
. . . normal boot to install . . .
As indicated, you will be brought to the install program, but you can also drop to the shell to do maintenance on your system.

The general rule on booting bsd.rd is to change your boot kernel from /bsd to bsd.rd through whatever means used on your platform.

4.12 - 常见安装问题

4.12.1 - 我的 Compaq 只能识别 16M 内存

Some Compaq systems have an issue where the full system RAM is not detected by the OpenBSD second stage boot loader properly, and only 16M may be detected and used by OpenBSD. This can be corrected either by creating/editing /etc/boot.conf file, or by entering commands at the "boot>" prompt before OpenBSD loads. If you had a machine with 64M RAM, but OpenBSD was only detecting the first 16M, the command you would use would be:
     machine mem +0x3000000@0x1000000
to add 48M (0x3000000) after the first 16M (0x1000000). Typically, if you had a machine with this problem, you would enter the above command first at the install floppy/CD-ROM's boot> prompt, load the system, reboot, and create an /etc/boot.conf file with the above line in it so all future bootings will recognize all available RAM.

It has also been reported that a ROM update will fix this on some systems.

4.12.2 - 我的 i386 安装后不能启动

Your install seemed to go fine, but on first boot, you see no sign of OpenBSD attempting to boot. There are a few common reasons for this problem:

4.12.3 - 我的(老而慢的)机器启动后,在 ssh-keygen 进程挂起

It is very likely your machine is running fine, just taking a while to do the ssh key generation process. A SPARCStation2 or a Macintosh Quadra may take several hours to complete the three ssh-keygen(1) steps. Just let it finish; it is only done once per install.

Note that the default key size was increased for OpenBSD 3.8, so the generation times are much longer than they used to be. Users of very slow machines may wish to generate their keys on another computer, place them in a site42.tgz file, and install them with the rest of the file sets.

4.12.4 - 安装期间出现信息“改变目录失败”

When doing an FTP install of a snapshot during the -beta stage of the OpenBSD development cycle, you may see this:

  Do you want to see a list of potential FTP servers?  [yes] Enter
  Getting the list from 192.128.5.191 (ftp.openbsd.org)... FAILED
  Failed to change directory.
  Server IP address or hostname?
This is normal and expected behavior during this pre-release part of the cycle. The install program looks for the FTP list on the primary FTP server in a directory that won't be available until the release date, so you get the above message.

Simply use the FTP mirror list to find your favorite FTP mirror, and manually enter its name when prompted.

Note: You should not see this if you are installing -release or from CD-ROM.

4.12.5 - 我的分区表乱七八糟或空白!

Occasionally, a user will find a system will work, but when doing an fdisk wd0, they see a completely blank (or sometimes, garbage) partition table. This is usually caused by having created a partition in fdisk(8) which had an offset of zero sectors, rather than the one track offset it should have (note: this is assuming the i386 or amd64 platform. Other platforms have different offset requirements, some need NO offset). The system then boots using the PBR, not using the MBR.

While this configuration can work, it can be a maintenance problem and should be fixed. To fix this, the disk's file systems must generally be recreated from scratch (though if you REALLY know what you are doing, you may be able to recreate just your disklabel and MBR, and only lose and have to rebuild the first OpenBSD partition on the disk).

4.12.6 - 我的 i386 不能用官方 CDROM 启动!

It has been found that some older computers are unable to boot the official CD1 disk. This problem does not impact CDs made from install42.iso, cd42.iso or cdemu42.iso; only the official CD set. An easy work-around for this problem is to use the amd64's boot loader available on CD2:
  1. Insert CD2 and tell your computer to boot it;
  2. When the boot> prompt appears, stop the automatic boot by pressing the space bar;
  3. Remove CD2 and insert CD1;
  4. Erase the character you typed to stop the boot, type
    boot /4.2/i386/bsd.rd
    then press Enter.
Yes, this really does work on non-amd64 machines for 4.2!

4.13 - 定制安装过程

siteXX.tgz file

The OpenBSD install/upgrade scripts allow the selection of a user-created set called "siteXX.tgz", where XX is the release version (e.g. 42). The siteXX.tgz file set is, like the other file sets, a gzip(1) compressed tar(1) archive rooted in '/' and is un-tarred like the other sets with the options xzphf. This set will be installed last, after all other file sets.

This file set allows the user to add to and/or override the files installed in the 'normal' sets and thus customize the installation or upgrade.

You can also create and use hostname-specific install sets, which are named siteXX-<hostname>.tgz, for example, "site42-puffy.tgz". This allows easy per-host customized installations, upgrades, or disaster recovery.

Some example uses of a siteXX.tgz file:

install.site/upgrade.site scripts

As the last step in the install/upgrade process, the scripts look in the root directory of the newly installed/upgraded system for install.site or upgrade.site, as appropriate to the current process, and runs this script in an environment chrooted to the installed/upgraded system's root. Remember, the upgrade is done from a booted file system, so your target file system is actually mounted on /mnt. However, because of the chroot, your script can be written as if it is running in the "normal" root of your file system. Since this script is run after all the files are installed, you have almost full functionality of your system (though, in single user mode) when your script runs.

Note that the install.site script would have to be in a siteXX.tgz file, while the upgrade.site script could be put in the root directory before the upgrade, or could be put in a siteXX.tgz file.

The scripts can be used to do many things:

The combination of siteXX.tgz and install.site/upgrade.site files is intended to give users broad customization capabilities without having to build their own custom install sets.

Note: if you will be doing your install from an http server, you will need to add your site*.tgz file(s) to the file index.txt in the source directory in order for them to be listed as an option at install time. This is not needed for FTP or other installs.

4.14 - 如何简化安装多个相似系统的工作?

Here are some tools you can use when you have to deploy a number of similar OpenBSD systems.

siteXX.tgz and install/upgrade.site files

See the above article.

Restore from dump(8)

On most platforms, the boot media includes the restore(8) program, which can be used to restore a backup made by dump(8). Thus, you could boot from a floppy, CD, or bsd.rd file, then fdisk, disklabel, and restore the desired configuration from tape or other media, and install the boot blocks. More details here.

Disk imaging

Unfortunately, there are no known disk imaging packages which are FFS-aware and can make an image containing only the active file space. Most of the major disk imaging solutions will treat an OpenBSD partition as a "generic" partition, and can make an image of the whole disk. This often accomplishes your goal, but usually with huge amounts of wasted space -- an empty, 10G /home partition will require 10G of space in the image, even if there isn't a single file in it. While you can typically install a drive image to a larger drive, you would not be able to directly use the extra space, and you would not be able to install an image to a smaller drive.

If this is an acceptable situation, you may find the dd command will do what you need, allowing you to copy one disk to another, sector-for-sector. This would provide the same functionality as commercial programs without the cost.

4.15 - 如何获得 dmesg(8) 报告安装问题?

When reporting a problem, it is critical to include the complete system dmesg(8). However, often when you need to do this, it is because the system is working improperly or won't install so you may not have disk, network, or other resources you need to get the dmesg to the appropriate mail list. There are other ways, however:

[FAQ 索引] [到 3 - 获得 OpenBSD] [到 5 - 从源代码构建系统]


[back] www@openbsd.org
$OpenBSD: faq4.html,v 1.2 2008/05/01 10:01:51 tobias Exp $