OpenBSD FAQ - Installation Guide [FAQ Index]



Overview of the installation procedure

The OpenBSD installer is actually just a special kernel, available via a few different methods: Not every platform supports all boot options. All platforms can use bsd.rd to reinstall or upgrade, however. The above options are also available for the file sets, regardless of how you booted the system.

Pre-installation checklist

You may want to consult your platform's installation notes, INSTALL.i386 or INSTALL.amd64 for example. They contain detailed installation instructions and any possible caveats. Before you start, you should have some idea what you want to end up with. A few things worth considering beforehand:

Downloading OpenBSD

There are numerous international mirror sites offering access to OpenBSD releases and snapshots. You should always use a nearby site for the best speed.
minirootXX.fs
A disk image that can be written to a USB flash drive or similar device. The file sets are not included, but they can be pulled down from the internet or another local disk.
installXX.fs
The same as above, but also includes the file sets.
cdXX.iso
An ISO 9660 image that can be used to create an install CD. The file sets are not included.
installXX.iso
The same as above, but also includes the file sets.
floppyXX.fs
Supports some older machines that lack other booting options.
In the same directory as the installation files, each mirror includes an SHA256 file that contains checksums of the images. You can confirm that none of the downloaded files were mangled in transit using the sha256(1) command.
$ sha256 -C SHA256 miniroot*.fs
(SHA256) minirootXX.fs: OK
However, this only checks for accidental corruption. You can use signify(1) and the SHA256.sig file to cryptographically verify the downloaded image.
$ signify -Cp /etc/signify/openbsd-XX-base.pub -x SHA256.sig miniroot*.fs
Signature Verified
minirootXX.fs: OK
The installXX.iso and installXX.fs images do not contain an SHA256.sig file, and the installer will complain that it can't check the signatures. It is not possible for the installer to verify the sets with these images. After all, if someone were to make a rogue installXX.iso file, they could certainly change the installer to say the files were legitimate. Thus, you must verify those installer downloads separately.

Creating install media

Flash drives

A bootable USB flash drive can be created by attaching the target device and copying over the image with dd(1).

Using OpenBSD, assuming the device was recognized as sd6:

# dd if=install*.fs of=/dev/rsd6c bs=1m
Details of this will vary on other platforms. Note that the raw I/O device is used in its entirety: rsd6c rather than sd6c. If you're using dd on a different OS, be sure to select the appropriate device name.

CD-ROMs

You can create a bootable CD-ROM on OpenBSD by using cdio(1).
# cdio tao cd*.iso

Performing a simple install

The installer is designed to install OpenBSD in a very usable default configuration with a minimum of user intervention. In fact, you can often just hit <Enter> to get a good OpenBSD install, moving your hands to the rest of the keyboard only to enter the root password and to reboot at the end.

The installer will create a partitioning plan based on the size of your hard disk. While this will not be a perfect layout for all people, it provides a good starting point for figuring out what you need.

If you need instructions on booting from your preferred media, check the relevant platform page of your machine. Whatever your means of booting is, it is now time to use it. After the dmesg(8) is shown, you will see the first installer question:

...
root on rd0a swap on rd0b dump on rd0b
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/amd64 X.X installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?
Choose (I)nstall and follow the instructions.

File sets

The complete OpenBSD installation is broken up into a number of file sets:
bsd
The kernel (required)
bsd.mp
The multi-processor kernel (only on some platforms)
bsd.rd
The ramdisk kernel
baseXX.tgz
The base system (required)
compXX.tgz
The compiler collection, headers and libraries
manXX.tgz
The man pages
gameXX.tgz
Text-based games
xbaseXX.tgz
The base libraries and utilities for X11 (requires xshareXX.tgz)
xfontXX.tgz
Fonts used by X11
xservXX.tgz
X11's X servers
xshareXX.tgz
X11's man pages, locale settings and includes
New users are recommended to install all of them.

Adding a file set after install

If you chose to skip some file sets at install time, you might realize later that you really do need them after all. Simply boot bsd.rd from your root file system and choose (U)pgrade. When you get to the list of file sets, select the ones you need.

Why do I have to install X for my non-graphical application?

Some libraries from xbaseXX.tgz, like freetype or fontconfig, can be used outside of X by programs that manipulate text or graphics. Such programs will usually need fonts, either from xfontXX.tgz or font packages. For the sake of simplicity, the developers decided against maintaining a minimal xbaseXX.tgz set that would allow most non-X ports to run. The xservXX.tgz set is rarely needed if you don't intend to run X.

Disk partitioning

OpenBSD can be installed in as little as 512MB, but using a device that small is something for advanced users. Until you have some experience, 8GB or more disk space is recommended.

Unlike some other operating systems, OpenBSD encourages users to split their disk into a number of partitions, rather than just one or two large ones. Some of the reasons for doing so are:

Security:
Some of OpenBSD's default security features rely on filesystem mount(8) options such as nosuid, nodev, noexec or wxallowed.
Stability:
A user or a misbehaved program can fill a filesystem with garbage if they have write permissions for it. Your critical programs, which hopefully run on a different filesystem, do not get interrupted.
Integrity:
If one filesystem is corrupted for some reason, then your other filesystems are most likely still OK.
fsck(8):
You can mount partitions that you never or rarely need to write to as readonly most of the time, which will eliminate the need for a filesystem check after a crash or power interruption.
Read about disklabel's defaults for automatic disk allocation and the hier(7) man page before making decisions about custom partitioning schemes.

Sending your dmesg after the install

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; sysctl hw.sensors) | \
   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!
Alternatively, save your dmesg output to a text file and send us its contents:
$ (dmesg; sysctl hw.sensors) > ~/dmesg.txt
Please configure your email client to use plain text. In particular, do not use HTML formatting or forced line breaks. Put the dmesg into the body of the mail, not as an attachement.

The ramdisk kernel (bsd.rd)

The bsd.rd ramdisk kernel is a live OpenBSD environment that runs entirely in memory. It contains the install script and a small number of utilities needed to perform a complete installation. These utilities can also be useful for disaster recovery. The installation media automatically boots into bsd.rd and starts the install script for you.

If you have a running OpenBSD system, bsd.rd is all you need to reinstall or upgrade to a newer version. To do so, download and verify the new bsd.rd, place it on an existing filesystem and boot from it. The general method of booting bsd.rd is to change your boot kernel from /bsd to /bsd.rd through whatever means used on your platform.

For example, booting from bsd.rd on an amd64 system:

Using drive 0, partition 3.
Loading......
probing: pc0 com0 com1 mem[638K 1918M a20=on]
disk: hd0+ hd1+
>> OpenBSD/amd64 BOOT 3.33
boot> boot hd0a:/bsd.rd
This will boot the kernel named bsd.rd from the a partition of the first recognized hard disk. The OpenBSD boot loaders are documented in the architecture-specific boot(8) man pages.

Customizing the install process

The siteXX.tgz file set

The OpenBSD install and upgrade scripts allow the selection of a user-created set called siteXX.tgz, where XX is the release version. Like the official file sets, this is a tar(1) archive rooted in / and untarred with the -xzphf options. It is installed last, so it can be used to complement and modify the files from a default install. Furthermore, it is possible to use hostname-dependent sets named siteXX-$(hostname -s).tgz. Note: If you intend to provide the sets over HTTP, place siteXX.tgz in your source directory and include it in your index.txt. It will then be an option at install time.

The install.site and upgrade.site scripts

If the siteXX.tgz file set contains an executable file /install.site, the installer runs it with chroot(8) based at the freshly installed system's root. Similarly, the upgrade script runs /upgrade.site. The latter can be placed in the system's root directory before rebooting for the upgrade.

Example usage:

Multibooting

Multibooting is having several operating systems on one computer, with some means of selecting which OS is to boot. You may want to familiarize yourself with the OpenBSD boot process before you start. A brief introduction to fdisk(8) is in the section on using OpenBSD's fdisk.

If you are adding OpenBSD to an existing system, you will probably need to create some free space before installing OpenBSD. In addition to your existing system's native tools, gparted may be useful for deleting or resizing existing partitions. Preferably use one of the four primary MBR partitions for booting OpenBSD. Extended partitions may not work.

Boot loaders

On Macs, rEFInd should work out of the box.

You can set up dual booting with GRUB 2 as follows. Assuming OpenBSD is installed on the fourth MBR partition (fdisk partition 3) of the first hard disk hd0, append the following to /etc/grub.d/40_custom.

menuentry "OpenBSD" {
	set root=(hd0,4)
	chainloader +1
}
Then regenerate the GRUB 2 configuration file, /boot/grub/grub.cfg. On Debian-based distros, you should run update-grub. Otherwise, do
# grub-mkconfig -o /boot/grub/grub.cfg
See the GRUB 2 manual or update-grub2(8) for more information.

Windows

The Boot Configuration Data (BCD) store allows multiple versions of Windows to be booted through bcdedit. A good introduction can be found in this article. If you want a GUI alternative, you may want to try EasyBCD.

You will need a copy of your OpenBSD install's Partition Boot Record (PBR). You can copy it to a file using a process similar to:

# dd if=/dev/rsd0a of=openbsd.pbr bs=512 count=1
where sd0a is your boot device, and you will need to get the file openbsd.pbr to your Windows system partition.

Once OpenBSD's PBR is copied to the Windows system partition, you need a shell with administrative privileges to run the following commands:

C:\Windows\system32> bcdedit /create /d "OpenBSD/i386" /application bootsector
The entry {0154a872-3d41-11de-bd67-a7060316bbb1} was successfully created.
C:\Windows\system32> bcdedit /set {0154a872-3d41-11de-bd67-a7060316bbb1} device boot
The operation completed successfully.
C:\Windows\system32> bcdedit /set {0154a872-3d41-11de-bd67-a7060316bbb1} path \openbsd.pbr
The operation completed successfully.
C:\Windows\system32> bcdedit /set {0154a872-3d41-11de-bd67-a7060316bbb1} device partition=c:
The operation completed successfully.
C:\Windows\system32> bcdedit /displayorder {0154a872-3d41-11de-bd67-7060316bbb1} /addlast
The operation completed successfully.
Note that OpenBSD expects the computer's real-time clock to be set to Coordinated Universal Time (UTC). See this section for more info.