OpenBSD has long been respected for its simple and straight forward installation process, which is very consistent across all platforms.
All platforms use a very similar installation procedure, however there are some minor differences in details on a few platforms. 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, macppc/INSTALL.macppc or sparc/INSTALL.sparc).
The OpenBSD installer is a special kernel with a number of utilities and install scripts embedded in a pre-loaded 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 pre-loaded 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.
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:
Before creating install media, you may wish to verify the signatures on your downloads.
Note that it is not possible for the downloaded files to directly check themselves -- an altered download would always say the files validated perfectly, of course!
As examples, we will look at the installation images available for the i386 and sparc platforms.
The i386 platform has seven separate installation disk images to choose from:
The sparc platform has four separate installation disk images to choose from:
On modern platforms, you are best advised to not use floppy install boot images, as in some of the "bigger" platforms (such as amd64, sparc64), the floppy images have had to have a lot of drivers and utilities cut out, which can make installation much more difficult.
You can create a CD-ROM using the cd57.iso or install57.iso files. The exact details here are left to the reader to determine with the tools they have at their disposal. Do note that the goal is to create a CD based on the image file, not to put the ISO file on a CD as a single file.
In OpenBSD, you can create a CD from an ISO image using cdio(1):
# cdio tao cd57.iso |
Modern Windows and Macintosh systems can directly create CDs from ISO images.
Other Unix-like systems use applications such as cdrkit.
Creating floppies in OpenBSD can be done with the fdformat(1) to prep the disk and dd(1). to write the image, then cmp(1) to verify the write was good. Similar process and tools can be used on other Unix platforms.
Creating floppies on Windows can be done with the native low-level formatting tools, and a program like ntrw which can be retrieved from the tools directory on any of the FTP mirrors.
A bootable USB flash drive (or a CF/SD/other card, external hard disk, etc) can be created by installing the target device on a Unix machine via any recognized adapters, then copying over the image with dd
Here is an OpenBSD example, assuming the device was recognized as "sd6":
# dd if=/location/install57.fs of=/dev/rsd6c bs=1m |
Details of this will vary on other platforms -- the important things are:
Booting an install media on the i386 and amd64 PC platforms is nothing new to most people. Your system will have to be instructed to boot from whatever media you have chosen to use, usually through a BIOS setup option. If you want to boot from CD or a USB device, your system BIOS must be able to and be set to do so. Note that some machines are buggy with regard to booting from USB devices; a BIOS update may help.
You can also install by booting bsd.rd from an existing OpenBSD partition, or over the network using the PXE boot process.
NOTE: On the sparc64 platform, only the SBus machines (Ultra 1, Ultra 2) are bootable from floppy.
You will need the system to be at a monitor ROM prompt, which typically looks like "ok ". If you are using a Sun keyboard, press and hold "STOP" while tapping "A". If using a serial console, a BREAK should return you to the monitor prompt.
Use the following command to boot from the floppy:
ok boot floppy |
Usually, you can boot from the CDROM drive of a Sun system from the boot prompt by typing 'boot cdrom':
ok boot cdrom |
OpenBSD's new installer is designed to install and configure OpenBSD in a very usable default configuration with very little user intervention. In fact, you can often just hit ENTER a number of times to get a good OpenBSD install, moving your hands to the rest of the keyboard only to enter the root password.
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 and a good overall strategy for figuring out what you need.
We will start with a very simple install, with brief discussions of the options provided, and using the magic of hypertext links, allow you to read more on the topics that interest you and explore your options.
Installation notes for each platform are on the install CDs and FTP servers, in the file INSTALL.<plat>, where <plat> is your platform, for instance, i386.
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. Once the install kernel is booted, the boot media is no longer needed, everything runs from the RAM disk. You can actually remove the CD, flash drive or floppy you booted from at this point, assuming you don't need it for installation files.
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. You can also enter a "!" at most places in the installation to get to a shell prompt, then exit the shell to return to the installer.
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 how they are hooked to other devices. A copy of this text 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 Welcome to the OpenBSD/i386 5.7 installation program. (I)nstall, (U)pgrade, (A)utoinstall or (S)hell? i |
And with that, we reach our first question. You have the four options shown:
We are assuming you are choosing "(I)nstall" here.
Now we start getting the questions that will define how the system is set up. You will note that in most cases, all the questions are asked up front, then the installation takes place. If you have a slow computer or a slow Internet connection, you will be able to answer these questions, walk away, come back later and only have to reboot the system to complete the install.
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. You can exit this program at any time by pressing Control-C, but this can leave your system in an inconsistent state. Choose your keyboard layout ('?' or 'L' for list) [default] Enter |
In most cases, the default keyboard layout (or terminal type if a serial console install is being done) is appropriate; however don't just take the default, respond appropriately.
System hostname? (short form, e.g. 'foo') puffy |
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.
Available network interfaces are: fxp0 vlan0. Which one do you wish to configure? (or 'done') [fxp0] Enter |
vlan0 is the VLAN virtual interface. For our purposes here, we are going to ignore this option and stick to the physical interfaces. If you have multiple physical interfaces, they will be listed here. Note that they are identified by driver name, not generic Ethernet devices. In this case, "fxp0" refers to the first device using the fxp(4) driver, fxp1 would be the second device, etc. More on device naming is in FAQ 6.
After selecting the device you wish to configure, you will now configure it. In many cases, you will want to configure it using DHCP:
IPv4 address for fxp0? (or 'dhcp' or 'none') [dhcp] Enter DHCPDISCOVER on fxp0 to 255.255.255.255 port 67 interval 1 DHCPOFFER from 192.168.1.250 (08:00:20:94:0b:c8) DHCPREQUEST on fxp0 to 255.255.255.255 port 67 DHCPACK from 192.168.1.250 (08:00:20:94:0b:c8) bound to 192.168.1.199 -- renewal in 43200 seconds. |
DHCP will configure the IP address, subnet mask, default gateway, DNS domain name and DNS servers. If you are not using DHCP, you will need to specify all these things manually; see the more detailed discussion below.
If you have any IPv6 configuration to do or there are other interfaces to configure (or you don't like how you configured the previous one), you can do that now, but in our case, we are done:
IPv6 address for fxp0? (or 'rtsol' or 'none') [none] Enter Available network interfaces are: fxp0 vlan0. Which one do you wish to configure? (or 'done') [done] Enter Using DNS domainname example.org Using DNS nameservers at 192.168.1.252 |
Now, we set the root account password:
Password for root account? (will not echo) er8Eeheix0ei Password for root account? (again) er8Eeheix0ei |
Use a secure password for the root account. Remember, on the Internet, they ARE out to get into your computer, and they will be trying lots of common passwords people think are really clever.
You will later be given a chance to create an administrative account and disable remote (SSH) access to the root account, but you still want a good password on your root account.
Start sshd(8) by default? [yes] Enter |
Usually, you will want sshd(8) running. If your application has no need for sshd(8), there is a small theoretical security advantage to not having it running.
Start ntpd(8) by default? [no] y NTP server? (hostname or 'default') [default] Enter |
You are here given an option of running OpenNTPD, OpenBSD's NTP implementation. OpenNTPD is a low-impact way of keeping your computer's clock accurately synchronized. The default configuration, using pool.ntp.org, uses a large number of free-access time servers around the world.
One reason you may NOT want to run ntpd(8) is if you are running a dual-boot system mostly using another OS which doesn't use a GMT-set hardware clock, and you don't want OpenBSD altering the time for your other OS.
Do you expect to run the X Window System? [yes] Enter |
Not all systems will ask if you expect to run X, those that do ask require a sysctl to be set to use X. Answering "y" here will modify /etc/sysctl.conf to include the line machdep.allowaperture=1 or machdep.allowaperture=2, depending on your system.
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 and rebooting, 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. Note that non-graphical applications that require X libraries and utilities to run do NOT need this sysctl to be set.
Do you want the X Window System to be started by xdm(1)? [no] y |
xdm(1) starts the X environment at system boot. We'd recommend doing this at install only if you are very confident that X will work on your system by default. Otherwise, configure X before setting up xdm(1).
Do you want to suspend on lid close? [yes] Enter |
If your machine appears to be a laptop, you will be asked if you want the system to respond to the closing of the lid by suspending.
Change the default console to com0? [no] Enter |
Sometimes, you want a system to use a serial port as a console instead of a keyboard and monitor. Answering "y" here will cause the installer to prompt you for a serial bit rate and configure the system to use the serial port for a console instead of the monitor and keyboard. Some platforms do this automatically if no keyboard is attached, these platforms will not ask this question.
Setup a user? (enter a lower-case loginname, or 'no') [no] nick Full name for user nick? [nick] Nick Holland Password for user nick? (will not echo) Tu0xie9onahJ Password for user nick? (again) Tu0xie9onahJ Since you set up a user, disable sshd(8) logins to root? [yes] |
You are being given an opportunity to create a user OTHER than root for system maintenance. This user will be a member of the "wheel" group so they can run su(1) and mail addressed to root will be forwarded to them. If you create a user here, you are given the option of disabling root logins via SSH, as you can do all administration remotely with the user you have created. If you later change your mind, you can edit the PermitRootLogin line in /etc/ssh/sshd_config.
Note that if you wish to create the user, enter the user's name, not "y" or "yes".
What timezone are you in? ('?' for list) [Canada/Mountain] US/Michigan |
OpenBSD assumes your computer's real-time clock (RTC) is set to GMT, but you also have to specify what time zone you are in. There may be several valid answers for your physical location. Hitting "?" at the prompt will help guide you to finding the best (most specific) time zone name.
Note that the installer will quite often guess correctly for your time zone, and you can then just hit "Enter".
More on setting the time zone here.
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.
Laying out your disk appropriately is probably the most difficult part of an OpenBSD install. The good news is the default layout works well for learning OpenBSD.
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.
OpenBSD's new installer attempts to make your disk layout tasks easier by having a sane default for "general" use. Note that many people will still want to customize the default, or use their own disk layout, but new users should probably start with this configuration until they see what they need to do differently. Note that the default layout will vary depending on how large your disk system is.
For now, we'll take the defaults on our 60G disk.
Available disks are: wd0. Which one is the root disk? (or 'done') [wd0] Enter Use DUIDs rather than device names in fstab? [yes] Enter Disk: wd0 geometry: 7296/255/63 [117210240 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 07 0 1 1 - 7295 254 63 [ 0: 117210177 ] NTFS 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 Use (W)hole disk or (E)dit the MBR? [whole] Enter Setting OpenBSD MBR partition to whole wd0...done. |
Note that this disk has a pre-existing partition on it -- using "whole" disk will remove it!.
Setting up the "whole" disk for OpenBSD does a number of important things:
There are many times when you won't want to do that, including:
Note that it is critical that a new (or never-used for booting) drive has a valid MBR, a valid signature, an OpenBSD partition, and a partition flagged as "active". If you don't do these things using the "Use whole disk" option, you need to make sure they get done manually.
More information on fdisk partitioning your disk below.
Now we will break up our OpenBSD fdisk partition into OpenBSD disk partitions using disklabel(8):
Setting OpenBSD MBR partition to whole wd0...done. The auto-allocated layout for wd0 is: # size offset fstype [fsize bsize cpg] a: 1024.0M 64 4.2BSD 2048 16384 1 # / b: 510.5M 2097216 swap c: 57231.6M 0 unused d: 4096.0M 3142688 4.2BSD 2048 16384 1 # /tmp e: 4606.5M 11531264 4.2BSD 2048 16384 1 # /var f: 2048.0M 20965312 4.2BSD 2048 16384 1 # /usr g: 1024.0M 25159616 4.2BSD 2048 16384 1 # /usr/X11R6 h: 7054.3M 27256768 4.2BSD 2048 16384 1 # /usr/local i: 2025.3M 41704064 4.2BSD 2048 16384 1 # /usr/src j: 2048.0M 45851808 4.2BSD 2048 16384 1 # /usr/obj k: 32795.0M 50046112 4.2BSD 2048 16384 1 # /home Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] Enter |
The installer has presented us with its proposed "Auto layout" for OpenBSD partitions on our disk, which we are going to accept.
If the proposed layout is not appropriate for your needs, you can, of course, edit the default or customize it completely, more details on the disklabel partitioning below.
NOTE for re-installers: The new installer will not clear your old disklabel if you chose "(C)ustom Layout", but you will need to re-specify each mount point using the 'm' option in disklabel(8).
The installer now creates those partitions and creates file systems on them using newfs(8), and mounts them for installation.
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.
Next, you will get a chance to choose your installation media. In this case, we will install from an HTTP (web) server.
Location of sets? (cd disk http or 'done') [cd] http HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none] Enter Server? (hostname, list#, 'done' or '?') [ftp5.usa.openbsd.org] mirror.example.org |
If you can't remember your favorite (or any!) mirror's location, the installer will often be able to come up with a default of a mirror which will work well for you. Otherwise, hit "?" to have a list of mirrors displayed, and select the number of a mirror that will work well for you.
Server directory? [pub/OpenBSD/5.7/i386] Enter |
You can now adjust the list of file sets.
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 labelled '[X]'. [X] bsd [X] base57.tgz [X] game57.tgz [X] xfont57.tgz [X] bsd.rd [X] comp57.tgz [X] xbase57.tgz [X] xserv57.tgz [ ] bsd.mp [X] man57.tgz [X] xshare57.tgz Set name(s)? (or 'abort' or 'done') [done] Enter |
At a bare minimum, you need to have a kernel (bsd) and base57.tgz file set. Unless you know what you are doing, stick with the default sets. You can add and remove file sets using "+" and "-" characters in front of the file set name, and also use wildcards:
But again, we'll take the default. This machine is a single-processor system, so bsd.mp is not installed, but everything else is. If it could later be upgraded to a multi-processor system, you might want to install bsd.mp as well (it is relatively very small, but then it is easy to add later, too).
And now, we start our install! This is the point at which you might want to come back later if you have a slow computer or Internet connection, though with a fast computer and local files, this process may take just a couple minutes or less!
If the install process can find the file SHA256.sig in the install source AND it can find sufficient space to pull over the install file sets to verify the signatures before installation, the file sets will be verified. If either of those cases are not true (i.e., installing from an install57.iso or install57.fs, or your hard disk is too small to "pre-load" the files), you will be presented with a message:
Directory does not contain SHA256.sig. Continue without verification? [no] |
or
Cannot determine prefetch area. Continue without verification? [no] |
Note that this is not saying that verification failed, it says that verification can't be done. If you are satisfied with your trust of the source of the files, hit "y" and your install will take place as normal (though without the "Get/Verify" steps you see below). Note that on slow hardware, the "Get/Verify" step can take quite a while.
Get/Verify SHA256.sig 100% |**************************| 1888 00:01 Siguature Verified Get/Verify bsd 100% |**************************| 10384 KB 00:05 Get/Verify bsd.rd 100% |**************************| 6803 KB 00:03 Get/Verify base57.tgz 100% |**************************| 51618 KB 00:26 Get/Verify comp57.tgz 100% |**************************| 44999 KB 00:28 Get/Verify man57.tgz 100% |**************************| 8773 KB 00:06 Get/Verify game57.tgz 100% |**************************| 2651 KB 00:02 Get/Verify xbase57.tgz 100% |**************************| 14878 KB 00:06 Get/Verify xshare57.tgz 100% |**************************| 4413 KB 00:04 Get/Verify xfont57.tgz 100% |**************************| 38994 KB 00:17 Get/Verify xserv57.tgz 100% |**************************| 18469 KB 00:15 Installing bsd 100% |**************************| 10384 KB 00:00 Installing bsd.rd 100% |**************************| 6803 KB 00:00 Installing base57.tgz 100% |**************************| 51618 KB 00:22 Installing comp57.tgz 100% |**************************| 44999 KB 00:17 Installing man57.tgz 100% |**************************| 8773 KB 00:06 Installing game57.tgz 100% |**************************| 2651 KB 00:00 Installing xbase57.tgz 100% |**************************| 14878 KB 00:03 Installing xshare57.tgz 100% |**************************| 4413 KB 00:05 Installing xfont57.tgz 100% |**************************| 38994 KB 00:10 Installing xserv57.tgz 100% |**************************| 18469 KB 00:06 Location of sets? (cd disk http or 'done') [done] Enter |
Yes, it is asking us again where we wish to install things from. This is so that missed, forgotten or failed file sets can be re-installed, and also so custom file sets can be installed.
Again, we just take the default, we are done installing files
Time appears wrong. Set to 'Wed Nov 5 09:21:38 EST 2014'? [yes] Enter |
If you configured the system to use NTP, you may get this message to set the system clock accurately.
Saving configuration files... Making all device nodes...done. CONGRATULATIONS! Your OpenBSD install has been successfully completed! To boot the new system, enter 'reboot' at the command prompt. When you login to your new system the first time, please read your mail using the 'mail' command. # |
OpenBSD is now installed on your system and ready for its first boot, but before you do...
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.
On your first boot, SSH keys will be generated. On modern computers, this will take a few seconds, you may not even notice it happening. On older systems, it may take many minutes, potentially even an hour or more for really slow systems.
One of your first things to read after you install your system is afterboot(8).
you may also find the following links useful:
The OpenBSD developers ask you to Send in a copy of your dmesg. This is really appreciated by the developers, and ultimately, all users.
Sometimes you can't just take the defaults. Here are some more details on parts of the installation process.
If you don't have a DHCP server available, you will have to set up your network adapter(s) manually. Here's an example:
Which one do you wish to configure? (or 'done') [xl0] Enter IPv4 address for xl0? (or 'dhcp' or 'none') [dhcp] 192.168.1.37 Netmask? [255.255.255.0] 255.255.254.0 IPv6 address for xl0? (or 'rtsol' or 'none') [none] Enter |
After that set of questions, you will be given a chance to configure any other network adapters that your machine has. If you specify another network adapter here, the above questions repeat.
Available network interfaces are: xl0 vlan0. Which one do you wish to configure? (or 'done') [done] |
Now, you will set up the default gateway and DNS servers, things that impact all network adapters:
Default IPv4 route? (IPv4 address, 'dhcp' or 'none') 192.168.1.1 add net default: gateway 192.168.1.1 DNS domain name? (e.g. 'bar.com') [my.domain] example.org DNS nameservers? (IP address list or 'none') [none] 192.168.1.250 192.168.1.251 |
Note that multiple DNS servers can be listed, separated by spaces.
Sometimes, you will have to do something more, for example set up a wireless access key or hard-set a duplex or speed setting (don't do this unless you absolutely HAVE to, fixing your switch configuration is a much better idea!). You are now given a chance to drop to the shell and do any manual configuration that you would like.
Do you want to do any manual network configuration? [no] y Type 'exit' to return to install. # ifconfig xl0 media xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 lladdr 00:08:74:2c:df:9c groups: egress media: Ethernet autoselect (100baseTX full-duplex) status: active supported media: media 10baseT media 10baseT mediaopt full-duplex media 100baseTX media 100baseTX mediaopt full-duplex media autoselect inet 192.168.1.37 netmask 0xfffffe00 broadcast 192.168.1.255 # ifconfig xl0 media 100baseTX mediaopt full-duplex # ifconfig xl0 xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 lladdr 00:08:74:2c:df:9c groups: egress media: Ethernet 100baseTX full-duplex status: active inet6 fe80::208:74ff:fe2c:df9c%xl0 prefixlen 64 scopeid 0x1 inet 192.168.1.37 netmask 0xfffffe00 broadcast 192.168.1.255 # exit ...setup resumes... |
(back to where we might have been)
Time in Unix is not a simple thing (or put another way, time in Unix is a really simple thing, human time is a politically manipulated mess). Time zone files help the system convert Unix time (the number of seconds past midnight GMT, Jan 1, 1970) to human time, taking into account things like time zones, daylight savings time (DST), DST rule changes, etc. They also include the history of changes.
Multiple time zone definition files will sometimes give the same current time, but may have different history. For example, EST5EDT and US/Michigan have the same time NOW, but back in 1975, the rules were different, so if you were doing math with dates and times that involved 1975, you would care about the differences. You should use the most specific and accurate timezone file you can for your region, rather than one that just gives the correct time at this moment.
OpenBSD's installer will help you find an appropriate time zone file for you if you are not sure. Simply hit "?" at each prompt, and the installer will show you options. If the first level of answers doesn't suite you, pick a continent or country, and look at your options there:
What timezone are you in? ('?' for list) [right/EST5EDT] ? 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 What timezone are you in? ('?' for list) [right/EST5EDT] 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 What sub-timezone of 'US' are you in? ('?' for list) Michigan |
We've now set the time to "US/Michigan". This creates a symbolic link in /etc pointing to the appropriate zoneinfo file in /usr/share/zoneinfo, something like this:
/etc/localtime -> /usr/share/zoneinfo/US/Michigan
Note the directory "right/", this directory includes leap second adjustments, but otherwise duplicates the standard zoneinfo choices. More here.
(back to where we might have been)
Note: only some OpenBSD platforms use fdisk at all, and usually, only i386 and amd64 users will have to worry about getting fancy with fdisk. Users of most other fdisk(8) using platforms generally don't have to worry about multibooting or setup/diagnostic partitions. For this reason, this section is focused on i386 and amd64.
fdisk(8) is used to mark off the OpenBSD part of your hard disk. It helps mark off the part of the disk used by OpenBSD from the parts used by other OSs or system functions.
If you have a partition on your disk you wish to retain or wish to leave space for another partition, you will NOT want to chose "(W)hole disk", but will need to edit the partition table with fdisk(8). More information on manually running fdisk(8) can be found here. Before working with any system that has data you don't wish to lose, make sure you have a good backup. It is very easy in this process to clobber important data, so make sure you are ready to get it back, if need be.
If you are adding OpenBSD to an existing system, you will probably need to create some free space on your system before installing OpenBSD. This will usually involve deleting or possibly reducing the size of existing partitions. The program gparted has been found useful for shrinking the partitions of many popular OSs, making it possible to install OpenBSD on the freed space.
In this example, we will assume we are starting with a blank 40G disk and wish to create a multiboot system, reserving 5G at the beginning of the disk for Windows, and the rest for OpenBSD. Note that a blank drive has to have valid MBR boot code and signature written to the disk before it can be booted.
The process is very much the same for working around an existing partition, you just need to skip over the parts where we create the Windows partition and worry about installing the MBR boot code.
Available disks are: wd0. Which one is the root disk? (or 'done') [wd0] Enter MBR has invalid signature; not showing it. |
If the disk had a valid MBR in place, it would show you the existing partition table, which can be a good way to show if a disk may have data on it already.
Use (W)hole disk or (E)dit the MBR? [whole] e 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. Inside the fdisk command, the 'manual' command describes all the fdisk commands in detail. Disk: wd0 geometry: 4998/255/63 [80293248 Sectors] Offset: 0 Signature: 0x0 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 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> |
First of all notice the fdisk prompt. The number "1" indicates the first level of partition tables -- if you were editing an extended partition, it would be "2" (or bigger). Extended partitions are partitions which have their own sub-partition table, getting around the IBM AT four partition design limit. Extended partitions won't be covered here.
First, we will make partition "0" a 5G Windows partition (using NTFS), and partition "1" will be our OpenBSD partition using the rest of the disk.
fdisk: 1> e 0 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused Partition id ('0' to disable) [0 - FF]: [0] (? for help) |
Since we don't know by memory what the partition ID is for NTFS, we hit "?" here to get a list.
Partition id ('0' to disable) [0 - FF]: [0] (? for help) ? Choose from the following Partition id values: 00 unused 20 Willowsoft 66 NetWare 386 A9 NetBSD 01 DOS FAT-12 24 NEC DOS 67 Novell AB MacOS X boot 02 XENIX / 27 Win Recovery 68 Novell AF MacOS X HFS+ 03 XENIX /usr 38 Theos 69 Novell B7 BSDI filesy* 04 DOS FAT-16 39 Plan 9 70 DiskSecure B8 BSDI swap 05 Extended DOS 40 VENIX 286 75 PCIX BF Solaris 06 DOS > 32MB 41 Lin/Minux DR 80 Minix (old) C0 CTOS 07 NTFS 42 LinuxSwap DR 81 Minix (new) C1 DRDOSs FAT12 08 AIX fs 43 Linux DR 82 Linux swap C4 DRDOSs < 32M 09 AIX/Coherent 4D QNX 4.2 Pri 83 Linux files* C6 DRDOSs >=32M 0A OS/2 Bootmgr 4E QNX 4.2 Sec 84 OS/2 hidden C7 HPFS Disbled 0B Win95 FAT-32 4F QNX 4.2 Ter 85 Linux ext. DB CPM/C.DOS/C* 0C Win95 FAT32L 50 DM 86 NT FAT VS DE Dell Maint 0E DOS FAT-16 51 DM 87 NTFS VS E1 SpeedStor 0F Extended LBA 52 CP/M or SysV 8E Linux LVM E3 SpeedStor 10 OPUS 53 DM 93 Amoeba FS E4 SpeedStor 11 OS/2 hidden 54 Ontrack 94 Amoeba BBT EB BeOS/i386 12 Compaq Diag. 55 EZ-Drive 99 Mylex EE EFI GPT 14 OS/2 hidden 56 Golden Bow 9F BSDI EF EFI Sys 16 OS/2 hidden 5C Priam A0 NotebookSave F1 SpeedStor 17 OS/2 hidden 61 SpeedStor A5 FreeBSD F2 DOS 3.3+ Sec 18 AST swap 63 ISC, HURD, * A6 OpenBSD F4 SpeedStor 19 Willowtech 64 NetWare 2.xx A7 NEXTSTEP FF Xenix BBT 1C ThinkPad Rec 65 NetWare 3.xx A8 MacOS X Partition id ('0' to disable) [0 - FF]: [0] (? for help) 07 |
Now we define its starting and ending points:
Do you wish to edit in CHS mode? [n] |
CHS mode allows you to specify disk space in Cylinders, Heads and Sectors. Keep in mind that for modern hard disks, the CHS numbers are completely bogus, just three numbers that translate to a sector on the disk, which is translated to your drives physical geometry (which probably varies across the disk anyway).
If you answer "y" here, you will be prompted for the starting and ending cylinder, head and sector. If you answer "no" here (as we will), you will be prompted for starting sector and the size. Editing by CHS is often easier when working around an existing partition, starting sector and size is often easier when you want to quickly create a partition of a given size.
offset: [0] 64 |
The fdisk platforms need gap before the first partition. The exact amount will not matter on modern machines, OpenBSD defaults to 64 sectors. This is recommended for performance reasons on modern disks, and does not matter on older disks.
size: [0] 5g Rounding to nearest cylinder: 10490381 |
The "Size" value can be the number of sectors (512 bytes each), or the desired capacity when followed by a "k", "m" or "g". When editing using offset and size, fdisk will round your partition so it ends on a cylinder boundary (OpenBSD doesn't care about this, and it is possible no modern OS cares about this, but some might have at one time).
Now, let's look at our new partition:
fdisk:*1> p Disk: wd0 geometry: 4998/255/63 [80293248 Sectors] Offset: 0 Signature: 0x0 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 07 0 1 2 - 652 254 63 [ 64: 10490381 ] NTFS 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 fdisk:*1> |
Note that the prompt now includes an "*", this means there are unsaved changes.
We've now created our Windows partition. Note that this partition is so far just reserved space on the disk, it isn't formatted; no file system exists here. You will worry about that when you install Windows; we've accomplished our goal of reserving space for the Windows partition to be created later.
Now we create our OpenBSD partition. In this case, the partition ID will be "A6".
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] Enter offset: [0] |
Uh-oh! What's our offset? Simple -- the offset of the previous partition plus the size of the partition, in this case, 64+10490381 = 10490445.
offset: [0] 10490445 size: [0] * fdisk:*1> |
Note that here, we entered "*" as the size, meaning "rest of the disk". Again, we could have entered the size in sectors, "m" or "g" if we wanted to leave space for something else.
Now we look at our partition table:
fdisk:*1> p Disk: wd0 geometry: 4998/255/63 [80293248 Sectors] Offset: 0 Signature: 0x0 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 07 0 1 1 - 652 254 63 [ 64: 10490381 ] NTFS 1: A6 653 0 1 - 4998 5 63 [ 10490445: 69802803 ] 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> |
WE AREN'T DONE YET!
This disk is not yet bootable! As it was a brand new disk, the disk's MBR was completely blank. The "Signature: 0x0" message there shows there is not a valid signature (0xAA55), which indicates there definitely is not a valid boot code. Of course, you could have a valid signature without valid boot code, through either random bad luck or damage to the existing boot code, but an invalid signature pretty well indicates you are lacking boot code, so we will install it now using the "update" command:
fdisk:*1> update Machine code updated. fdisk:*1> |
We also have to "flag" a partition as "active" so the boot ROM knows what partition to boot from:
fdisk:*1> f 1 Partition 1 marked active. |
Now, let's see how it looks:
fdisk:*1> p Disk: wd0 geometry: 4998/255/63 [80293248 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 07 0 1 1 - 652 254 63 [ 64: 10490381 ] NTFS *1: A6 653 0 1 - 4998 5 63 [ 10490445: 69802803 ] 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> |
A checklist of things you want to make sure about before you exit fdisk(8):
Inside the OpenBSD fdisk(8) partition, we use disklabel(8) to create OpenBSD file system partitions. OpenBSD labels its file system partitions using sixteen letters, "a" through "p". Partition "a" on the boot disk is defined as the root partition, "b" on the boot disk is the default swap partition. "c" on all disks is the "whole disk" partition, it is used by programs that have to have raw access to the physical disk, such as fdisk(8) and disklabel(8). The "c" partition is created automatically for you, and should not be deleted or changed. The remaining letters are available for you to define mount points on. You may skip letters, you can define them in any order, and they can be in any order on the disk (although some platforms do have a requirement for where the "a" partition is). You can also leave gaps in the disk that are unallocated, and allocate them later, or potentially enlarge existing partitions later into that unallocated space using growfs(8).
All partitions which have native FFS partitions on them should be within the OpenBSD fdisk(8) partition, however non-OpenBSD partitions can (and usually should) be outside the OpenBSD fdisk partition.
More information on using disklabel can be found here.
More information on why partitioning is beneficial and strategy for creating a good partitioning plan are below.
The OpenBSD installer will attempt to auto-partition your disk in a usable, "general purpose" configuration, based on the size of your disk. If your disk is big enough, unused space will be allocated to the /home partition. While this is often quite useful, it doesn't satisfy all users' needs.
For our example, we'll assume we are building a static web server for some of our friends to use. We have a machine attached to a modest Internet connection, with a 40G disk, with most of it used for OpenBSD (with the same 5G Windows partition as the example above. Why? Maybe this system has a RAID controller which is supported by OpenBSD, but manageable only from within Windows. More likely, because the FAQ editor doesn't feel like maintaining lots of different example systems).
The web pages served by an OpenBSD web server will be in /var/www, and very little will be stored in /home, so this indicates a definite change from the default that needs to be made. For the sake of discussion, we'll also assume that we won't need to rebuild the OS from source on this machine (we'll do that elsewhere). The system will not run X, however being that some web applications expect X to be installed, we will have X installed. The machine is not overly powerful, it can't have more than 1G RAM in it, and it is unlikely our application will ever desire more than that.
So, after a bit of thought, our plan is to partition the system like this:
The auto-allocated layout for wd0 is: # size offset fstype [fsize bsize cpg] a: 1024.0M 10490445 4.2BSD 2048 16384 1 # / b: 252.1M 12587597 swap c: 39205.7M 0 unused d: 2319.3M 13103933 4.2BSD 2048 16384 1 # /tmp e: 3653.9M 17853877 4.2BSD 2048 16384 1 # /var f: 1149.8M 25337016 4.2BSD 2048 16384 1 # /usr g: 1024.0M 27691862 4.2BSD 2048 16384 1 # /usr/X11R6 h: 3422.6M 29789014 4.2BSD 2048 16384 1 # /usr/local i: 5122.3M 63 NTFS j: 1848.7M 36798433 4.2BSD 2048 16384 1 # /usr/src k: 1848.7M 40584654 4.2BSD 2048 16384 1 # /usr/obj l: 17540.2M 44370875 4.2BSD 2048 16384 1 # /home Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] c |
If we had only minor revisions, we'd probably opt to "Edit" the custom layout rather than starting from a clean slate, but we are going to do things the hard way here.
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. You must provide each filesystem's mountpoint in this program. 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. Label editor (enter '?' for help at any prompt) > p OpenBSD area: 10490445-80293248; size: 69802803; free: 69802803 # size offset fstype [fsize bsize cpg] c: 80293248 0 unused i: 10490381 64 NTFS > |
Note there are already two partitions here -- the "c" partition which is always there and created for you, but disklabel(8) has also noticed the existing NTFS partition and assigned it a disklabel partition so it could potentially be accessed by OpenBSD (note, at this time, NTFS support is experimental and requires a custom kernel but FAT/FAT32 support is quite good).
We will now create our partitions. We will start with the "a" partition, our root partition:
> a a offset: [10490445] Enter size: [69802803] 100m Rounding to cylinder: 208845 FS type: [4.2BSD] Enter mount point: [none] / > |
Note that disklabel defaulted to the first available OpenBSD sector on the disk, which is what we want. It also defaulted to a size of all available space, which is NOT what we want. Here we overrode it with our preferred size, which can be specified in sectors, "M" or "G".
You will usually want to use the default FS type of "4.2BSD" for a FFS (Fast File System) or FFS2 partition, though other types you may find useful include "swap" and "RAID".
Finally is the mount point. Our "a" partition is the root partition, by definition.
Now, we do swap, which is our 'b' partition (again, this is a requirement -- 'b' on your boot disk is swap):
> a b offset: [10699290] Enter size: [69593958] 1g Rounding to cylinder: 2104515 FS type: [swap] Enter > |
Again, disklabel correctly calculated our starting sector, and presented us with a suggested size of "entire remaining space", which we again overrode with our desired size. Since this is the 'b' partition, disklabel assumed it was to be used for swap, and when we confirmed that, it didn't bother to ask us a mount point.
We are now ready to create the rest of the partitions.
> a d offset: [12803805] Enter size: [67489443] 2g Rounding to cylinder: 4209030 FS type: [4.2BSD] Enter mount point: [none] /usr > a e offset: [17012835] Enter size: [63280413] 100m Rounding to cylinder: 208845 FS type: [4.2BSD] Enter mount point: [none] /tmp > a f offset: [17221680] Enter size: [63071568] 2g Rounding to cylinder: 4209030 FS type: [4.2BSD] Enter mount point: [none] /usr/local > a g offset: [21430710] Enter size: [58862538] 1g Rounding to cylinder: 2104515 FS type: [4.2BSD] Enter mount point: [none] /usr/X11R6 > a h offset: [23535225] Enter size: [56758023] 1g Rounding to cylinder: 2104515 FS type: [4.2BSD] Enter mount point: [none] /home > a j offset: [25639740] Enter size: [54653508] 1g Rounding to cylinder: 2104515 FS type: [4.2BSD] Enter mount point: [none] /var > a k offset: [27744255] Enter size: [52548993] Enter FS type: [4.2BSD] Enter mount point: [none] /var/www > |
Note that on the /var/www partition ("k"), we just took the default to use all remaining available disk space. With modern monstrously huge drives, this is usually a bad idea. If you know you will never use it, don't allocate it, and save it for some future use.
Now, let's look at our results, using the "p" and "p m" commands:
> p OpenBSD area: 10490445-80293248; size: 69802803; free: 0 # size offset fstype [fsize bsize cpg] a: 208845 10490445 4.2BSD 2048 16384 1 # / b: 2104515 10699290 swap c: 80293248 0 unused d: 4209030 12803805 4.2BSD 2048 16384 1 # /usr e: 208845 17012835 4.2BSD 2048 16384 1 # /tmp f: 4209030 17221680 4.2BSD 2048 16384 1 # /usr/local g: 2104515 21430710 4.2BSD 2048 16384 1 # /usr/X11R6 h: 2104515 23535225 4.2BSD 2048 16384 1 # /home i: 10490381 64 NTFS j: 2104515 25639740 4.2BSD 2048 16384 1 # /var k: 52548993 27744255 4.2BSD 2048 16384 1 # /var/www > p m OpenBSD area: 10490445-80293248; size: 34083.4M; free: 0.0M # size offset fstype [fsize bsize cpg] a: 102.0M 10490445 4.2BSD 2048 16384 1 # / b: 1027.6M 10699290 swap c: 39205.7M 0 unused d: 2055.2M 12803805 4.2BSD 2048 16384 1 # /usr e: 102.0M 17012835 4.2BSD 2048 16384 1 # /tmp f: 2055.2M 17221680 4.2BSD 2048 16384 1 # /usr/local g: 1027.6M 21430710 4.2BSD 2048 16384 1 # /usr/X11R6 h: 1027.6M 23535225 4.2BSD 2048 16384 1 # /home i: 5122.3M 64 NTFS j: 1027.6M 25639740 4.2BSD 2048 16384 1 # /var k: 25658.7M 27744255 4.2BSD 2048 16384 1 # /var/www > |
Like with fdisk, you don't want your OpenBSD disklabel partitions to overlap (other than the 'c' partition, which overlaps everything, of course).
Write your changes and quit disklabel:
> w > q No label changes. newfs: reduced number of fragments per cylinder group from 13048 to 12992 to enlarge last cylinder group /dev/rwd0a: 102.0MB in 208844 sectors of 512 bytes 5 cylinder groups of 25.38MB, 1624 blocks, 3328 inodes each /dev/rwd0h: 1027.6MB in 2104512 sectors of 512 bytes 6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each newfs: reduced number of fragments per cylinder group from 13048 to 12992 to enlarge last cylinder group /dev/rwd0e: 102.0MB in 208844 sectors of 512 bytes 5 cylinder groups of 25.38MB, 1624 blocks, 3328 inodes each /dev/rwd0d: 2055.2MB in 4209028 sectors of 512 bytes 11 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rwd0g: 1027.6MB in 2104512 sectors of 512 bytes 6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rwd0f: 2055.2MB in 4209028 sectors of 512 bytes 11 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rwd0j: 1027.6MB in 2104512 sectors of 512 bytes 6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rwd0k: 25658.7MB in 52548992 sectors of 512 bytes 127 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/wd0a on /mnt type ffs (rw, asynchronous, local) /dev/wd0h on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid) /dev/wd0e on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid) /dev/wd0d on /mnt/usr type ffs (rw, asynchronous, local, nodev) /dev/wd0g on /mnt/usr/X11R6 type ffs (rw, asynchronous, local, nodev) /dev/wd0f on /mnt/usr/local type ffs (rw, asynchronous, local, nodev) /dev/wd0j on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid) /dev/wd0k on /mnt/var/www type ffs (rw, asynchronous, local, nodev, nosuid) Let's install the sets! ... |
(Back to where we may have been)
The complete OpenBSD installation is broken up into a number of separate file sets. Not every application requires every file set, however new users are recommended to install ALL of them. Here is an overview of each:
Even if you have no intention of running X, some third party packages require the libraries or other utilities in X to be installed on your system. These applications can sometimes be satisfied simply by installing just xbase57.tgz, the rest of X is not always needed. Many people resist installing X on their system without valid reason:
People sometimes waste a lot of time and effort trying to pick through xbase57.tgz and pull out just the files they need to install their application. This is not only pointless, but an effort that would have to be repeated for each upgrade cycle, which probably means you will not upgrade your system properly, creating REAL security problems.
IF you need X, just install it. It won't hurt you any more than the application you are needing it for will.
Ok, don't, but please don't tell yourself this is for "security reasons". By the time someone is far enough into your system that the presence or absence of the compiler matters, they are far enough in they can install a compiler themselves. However, the compXX.tgz file set is relatively big and has a lot of files in it, so it can take a while to install and upgrade, and on slow or small systems, this can matter.
If you do decide to not install the compiler, you will probably need another system to maintain and build updated software on. There are far more systems that have been compromised because of improper maintenance than there have been because a compiler was installed.
Obviously, the answer to this question varies tremendously based on your use of the system. OpenBSD can be installed in as little as 512M, but using that small of a device is something for advanced users. Until you have some experience, an 8G or larger hard disk is recommended to start with.
Unlike many other OSs, OpenBSD encourages users to partition their disk into a number of partitions, rather than having just one or two big partitions. There are a number of reasons to partition your disk:
Given sufficient disk space, OpenBSD's installer will default to the following partitions:
Some additional thoughts on partitioning:
Multibooting is having several operating systems on one computer, and some means of selecting 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.
Preferably use one of the four primary MBR partitions for booting OpenBSD (i.e., extended partitions may not work).
Note that Windows 7 and Vista can resize their system partitions: go to the Control Panel, search for "partition", and enter the corresponding system tool. Right click on a partition, and you will notice you can shrink it. Its main limitation is that the Windows Exchange File can't be moved, so if you need more space, you may have to move/disable it.
Here are several options to multibooting:
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.
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. (You can, of course, use this floppy to make a bootable CD, too.)
The boot(8) program is loaded from the floppy, it then 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.
To multiboot OpenBSD and Windows NT/2000/XP, you can use NTLDR, the boot loader that NT uses. To multiboot 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.
With Vista, Microsoft dropped NTLDR support in favor of their newer Boot Configuration Data (BCD) store used for controlling the boot environment. Since BOOT.INI is no longer available for customization, a command-line utility, bcdedit, takes its place.
Once OpenBSD's PBR is copied to Vista's system partition, the following three commands are required to select and boot OpenBSD when the system is restarted:
C:\Windows\system32> bcdedit /create /d "OpenBSD/i386" /application bootsector The entry {05a763ce-d81b-11db-b3ec-000000000000} was successfully created. C:\Windows\System32>
The GUID returned here, 05a763ce-d81b-11db-b3ec-000000000000, is shown for illustrative reasons. Take note of the GUID displayed when you run this command as this value will need to be copied into the following commands. Simply copying the GUID shown above will not work.
The following two commands are also required:
C:\Windows\system32> bcdedit /set {05a763ce-d81b-11db-b3ec-000000000000} device boot The operation completed successfully. C:\Windows\system32> bcdedit /set {05a763ce-d81b-11db-b3ec-000000000000} path \openbsd.pbr The operation completed successfully. C:\Windows\system32>
This must be run in a shell with administrative privileges. Once you've located cmd.exe, right click to be able to select "run as administrator".
Note the absolute pathname of the imported PBR file. Do not add a drive letter as it is assumed that the file is placed in the system partition. bcdedit will not complain about an explicit drive specification, but the boot manager will later balk claiming that it cannot resolve the designated pathname.
Upon rebooting, Vista will be listed first in the boot manager ultimately followed by OpenBSD. Selecting either entry will boot the corresponding operating system.
If nothing happens, look around in the control panel for boot information. Most likely, your Windows boot is set up with no delay, so you don't see the boot menu. You can also use this to boot OpenBSD by default.
For more information, consult bcdedit's help by issuing:
C:\Windows\system32> bcdedit /?
or by searching Microsoft's documentation and Website. A good introduction can be found in this TechNet Frequently Asked Questions article.
For those who find manual configuration daunting, EasyBCD provides a GUI alternative.
Microsoft has enhanced BCD since releasing Vista to allow multiple versions of Windows to be booted through bcdedit. Because of this greater control, five commands are required to configure a multiboot environment with OpenBSD.
After copying OpenBSD's PBR into Windows 7's system partition, issue the following command to initialize the needed registry hive:
C:\Windows\system32> bcdedit /create /d "OpenBSD/i386" /application bootsector The entry {0154a872-3d41-11de-bd67-a7060316bbb1} was successfully created. C:\Windows\system32>
As admonished before, the {0154a872-3d41-11de-bd67-a7060316bbb1} GUID is system-dependent. Note the value you receive when executing, and copy it into the following commands:
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. C:\Windows\system32>
Some other bootloaders OpenBSD users have used successfully include GAG, The Ranish Partition Manager, rEFIt, and GRUB.
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?
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, including the hardware sensors that are found in machines.
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" This email address is being protected from spambots. You need JavaScript enabled to view it.%MINIFYHTML5de98efd244ade75723f2164c5f10ea55%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; sysctl hw.sensors) | mail This email address is being protected from spambots. You need JavaScript enabled to view it.%MINIFYHTML5de98efd244ade75723f2164c5f10ea56%
and then forward that message to
This email address is being protected from spambots. You need JavaScript enabled to view it.%MINIFYHTML5de98efd244ade75723f2164c5f10ea57%
where This email address is being protected from spambots. You need JavaScript enabled to view it. 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; sysctl hw.sensors) > ~/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:
"Oh no! I forgot to add a file set when I did the install!"
Sometimes, you realize you really DID need comp57.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:
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.
The install file sets are simply compressed tar files, and you can expand them manually from the directory in which the file sets reside:
# tar -C / -xzvphf comp57.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 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.
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 3.26 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.
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:
# fdisk -u wd0Note: the "update" option within the interactive ("-e") mode of fdisk will not write the signature bytes required to make the disk bootable.
It is very likely your machine is running fine, just taking a while to do the ssh key generation process. A SPARCStation2 or a slow 80486 may take several hours to complete the ssh-keygen(1) steps. Just let it finish; it is only done once per install.
If you use install57.iso or install57.fs, you will find the installer will complain about no SHA256.sig file, and thus, it can't verify the files during the installation.
It is not possible to usefully have the complete installer verify the sets. After all, if someone were to make a "rogue" install57.iso file, they would almost certainly change the installer to say everything verified successfully. Thus, you must verify your installer downloads separately.
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).
Some computers people might want to run OpenBSD on lack any obvious way to install OpenBSD, having no floppy or CD-ROM drive. Either the machine was designed without it (for example, many laptops and "flash" based machines, like Soekris and ALIX systems), or the boot devices have failed or been removed, and would be difficult to replace. Here are some tips and techniques you can use to get OpenBSD installed on these systems.
In all cases, remember that the machine had an OS installed on it before, and it was usually intended that the OS could be reloaded in the field. How this was originally intended to be done will often provide you a good idea how you can install OpenBSD now.
The verification process consists of fetching the SHA256.sig file, then fetching all the install files to the local hard disk and verifying their signatures. If either the signature file is unavailable or there is insufficient disk space for that extra copy of the files, verification will not be possible, and you will get that message. If you trust your source, this should not be a problem. If you do not trust your source, you can manually verify the files as detailed here.
The OpenBSD install/upgrade scripts allow the selection of a user-created set called "siteXX.tgz", where XX is the release version (e.g. 57). 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, "site57-puffy.tgz". This allows easy per-host customized installations, upgrades, or disaster recovery.
Some example uses of a siteXX.tgz file:
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 much of the functionality of the full system when your script runs. Keep in mind that you are running a minimal kernel, not all features are available, and due to space constraints, things that work today may not work in a future release.
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 other install methods.
Here are some tools you can use when you have to deploy a number of similar OpenBSD systems.
See the above article.
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.
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.
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:
mount -t msdos /dev/fd0a /mnt dmesg >/mnt/dmesg.txt umount /mntIf you have another OpenBSD system, you can also write it to an OpenBSD compatible floppy -- often, the boot floppy has enough room on it to hold the dmesg. In that case, leave off the "-t msdos" above.
General information on setting up a serial console is provided elsewhere in the FAQ; in order to capture a log of the install, the following commands are usually sufficient.
i386
At the boot loader prompt, enter
boot> set tty com0
This will tell OpenBSD to use the first serial port (often called COM1 or COMA in PC documentation) as a serial console. The default baud rate is 9600.
Sparc/Sparc64
These machines will automatically use a serial console if started without a keyboard present. If you have a keyboard and monitor attached, you can still force the system to use a serial console with the following invocation at the ok prompt.
ok setenv input-device ttya ok setenv output-device ttya ok reset