OpenBSD 5.5 Installation Notes

08 Oct 2014

The OpenBSD FAQ is a tremendously useful document, but it requires you to jump around in order to find all the necessary information for installation and configuration. Often, you are given all the possible ways of doing something at once, mixed together. These notes are meant to be followed in order, step-by-step, and should result in a working system. If I have made any errors, please email me using the address at the bottom of the page.

These notes were put together in the process of an actual install--not as a result of simply cobbling together documentation. As a result, they reflect my personal preferences. You should feel free to take a different path, but changing the order or content of the steps may result in unexpected behavior. If in doubt, please consult the FAQ or ask a question on IRC.

These notes assume that you are installing on a 64-bit machine (amd64) from install55.iso which has a SHA256 hash of:


Installer Walkthrough

Welcome to the OpenBSD/amd64 5.5 installation program.
Keyboard layout
System hostname
Which network interface do you wish to configure?
IPv4 address for em0?
Issuing hostname-associated DHCP request for em0.
DHCPDISCOVER on em0 to port 67 interval 1
DHCPOFFER from (xx:xx:xx:xx:xx:xx)
DHCPREQUEST on em0 to port 67
DHCPACK from (xx:xx:xx:xx:xx:xx)
bound to -- renewal in 43200 seconds.
IPv6 address for em0?
IPv6 prefix length for em0?
Which network interface do you wish to configure?
Using DNS domainname example.net
Using DNS nameservers at
Password for root account (will not echo)
Password for root account (again)
Start sshd(8) by default?
Start ntpd(8) by default?
NTP server?
Do you expect to run the X Window System?
Do you want the X Window System to be started by xdm(1)?
Change the default console to com0?
Setup a user? (enter a lower-case loginname, or 'no')
Full name for user username?
Password for user username? (will not echo)
Password for user username? (again)
Since you set up a user, disable sshd(8) logins to root?
What timezone are you in?
Available disks are: wd0
Which disk is a the root disk?
Use DUIDs rather than device names in fstab?
MBR has invalid signature; not showing it.
Use (W)hole disk or (E)dit the MBR?
Setting OpenBSD MBR partition to whole wd0...done.
The auto-allocated layout for wd0 is:
#   size    offset      fstype  [fsize      bsize   cpg]
 a: 1.0G    64          4.2BSD      2048    16384   1       # /
 b: 1.2G    2097216     swap        
 c: 80.0G   0           unused
 d: 4.0G    4685760     4.2BSD      2048    16384   1       # /tmp
 e: 6.0G    13074368    4.2BSD      2048    16384   1       # /var
 f: 2.0G    25591488    4.2BSD      2048    16384   1       # /usr
 g: 1.0G    29785792    4.2BSD      2048    16384   1       # /usr/X11R6
 h: 9.3G    31882944    4.2BSD      2048    16384   1       # /usr/local
 i: 2.0G    51385888    4.2BSD      2048    16384   1       # /usr/src
 j: 2.0G    55580192    4.2BSD      2048    16384   1       # /usr/obj
 k: 51.5G   59774496    4.2BSD      2048    16384   1       # /home

OpenBSD needs a large amount of space for /usr/src and /usr/obj in order to build the system and ports. Also, /, /usr, /usr/local, and /usr/X11R6 should be expanded. /home does not need to be nearly as large as allocated. Many small files will be populated in /usr, /usr/X11R6, /usr/local, and especially in /usr/src and /usr/obj, therefore the fsize (fragment size) should be reduced to the minimum.

The default install of OpenBSD doesn't create enough inodes on small hard drives to install ports and packages. During disklabel creation, enter expert mode, X. Then, modify each partition (m partition) and set the fragment size to 512 in order to maximize the number of available inodes. Refer to Disk Setup for more information

Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout?

Planned disklabel

#   size    mount point
 a: 5.0G    /
 b: 2.0G    swap        
 c: 80.0G   unused
 d: 4.0G    /tmp
 e: 6.0G    /var
 f: 10.0G   /usr
 g: 2.0G    /usr/X11R6
 h: 10.0G   /usr/local
 i: 10.0G   /usr/src
 j: 10.0G   /usr/obj
 k: 20.0G   /home

Creating Partitions

> X
Entering expert mode

Create a partition using the a command. Some options will be unavailable unless you are in expert mode. Repeat for each partition, except b and c. b must be the swap partition and c must be the size of the entire disk. Sizes will be shown in 512-byte sectors, but you can specify them in gigabytes using the G suffix.

> a
partition: [k]
offset: [123716544]
size: [44050251]
FS type: [4.2BSD]
mount point: [none] /home
fragment size: [2048] 512
block size: [4096]
Align partition to block size: [y]
Rounding size to bsize (8 sector): 44050248

Modifying Partitions

If you didn't create the partitions in expert mode, use the m command to modify them.

> m a
offset: [64]
size: [10490368]
FS type: [4.2BSD]
mount point: [/]
fragment size: [16384] 512
block size: [4096]
Align partition to block size: [y]

Resulting disklabel

#   size       offset      fstype  [fsize  bsize   cpg]
a: 10490368    64          4.2BSD      512 4096    1       # /
b: 4192978     10490432    swap        
c: 167772160   0           unused
d: 8401952     14683424    4.2BSD      512 4096    1       # /tmp
e: 12578912    23085376    4.2BSD      512 4096    1       # /var
f: 20964832    35664288    4.2BSD      512 4096    1       # /usr
g: 4192960     56629120    4.2BSD      512 4096    1       # /usr/X11R6
h: 20964832    60822080    4.2BSD      512 4096    1       # /usr/local
i: 20964800    81786912    4.2BSD      512 4096    1       # /usr/src
j: 20964832    102751712   4.2BSD      512 4096    1       # /usr/obj
k: 44050248    123716544   4.2BSD      512 4096    1       # /home

Writing the disklabel

> q
Write new label? 
/dev/rwd0a: 5122.2MB in 10490368 sectors of 512 bytes
419 cylinder groups of 12.24MB, 3134 blocks, 6272 inodes each

A similar message will be repeated for each partition as they are created and formatted.

After partitioning and formatting, the installer will mount each of the partitions and print out a message similar to:

/dev/wd0a (1c5526dd391b8565.a) on /mnt type ffs (rw, asynchronous, local).

Selecting Package Sets

Let's install the sets!
Location of sets? (cd disk ftp http or 'done') [cd]
Which CD-ROM contains the install media? (or 'done') [cd0]
Pathname to the sets? (or 'done') [5.5/amd64]
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 patterns or 'all'. Selected sets are 
labelled '[X]'.

[X] bsd         [X] etc55.tgz   [X] xbase55.tgz     [X] xserv55.tgz
[X] bsd.rd      [X] comp55.tgz  [X] xetc55.tgz
[ ] bsd.mp      [X] man55.tgz   [X] xshare55.tgz
[X] base55.tgz  [X] game55.tgz  [X] xfont55.tgz
Set name(s)? (or 'abort' or 'done') [done] 
[X] bsd         [X] etc55.tgz   [X] xbase55.tgz     [X] xserv55.tgz
[X] bsd.rd      [X] comp55.tgz  [X] xetc55.tgz
[X] bsd.mp      [X] man55.tgz   [X] xshare55.tgz
[X] base55.tgz  [X] game55.tgz  [X] xfont55.tgz
Set name(s)? (or 'abort' or 'done') [done] 
[X] bsd         [X] etc55.tgz   [X] xbase55.tgz     [X] xserv55.tgz
[X] bsd.rd      [X] comp55.tgz  [X] xetc55.tgz
[X] bsd.mp      [X] man55.tgz   [X] xshare55.tgz
[X] base55.tgz  [ ] game55.tgz  [X] xfont55.tgz
Set name(s)? (or 'abort' or 'done') 
Directory name does not contain SHA256.sig. Continue without verification? [no] 
Installing bsd 100% |**********************| 11414 KB 00:08

Similar messages will be printed for each set as they are installed.

Location of sets? (cd disk ftp http or 'done')

Setting the Time

Time appears wrong. Set to 'Thu Oct 9 01:04:49 EDT 2014'?
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.
# reboot
syncing disks... done

First Boot

Upon rebooting, you should be presented with the XDM login screen. After logging in, you'll be in FVWM with an xterm open, an iconified xconsole, and the FVWM pager (similar to a virtual desktop or workspace switcher).

Enable sudo and Configure Environment Variables

sudo is not preconfigured. Edit /etc/mk.conf and add SUDO=/usr/bin/sudo. Then, use visudo to edit /etc/sudoers and uncomment the line %wheel ALL=(ALL) SETENV: ALL to enable users in the wheel group to use sudo.

$ su
# vi /etc/mk.conf
# visudo

Uncomment line 43 so that it looks like:


CVSROOT isn't listed in env_keep by default, so you'll need to add it in order to download and update ports, system sources, and Xenocara.

Change line 25 to add CVSROOT to env_keep.

Defaults:%wsrc env_keep +="SUBPACKAGE WKROBJDIR CVSROOT"

Exit the root shell and edit ~/.profile.

# exit
$ vi ~/.profile

Append the following lines to ~/.profile to set mirrors for packages and ports. The path for PKG_PATH must end in a slash. Do not use the default mirror for CVSROOT. Instead, pick a mirror geographically close to you.

export PKG_PATH=ftp://ftp3.usa.openbsd.org/pub/OpenBSD/5.5/packages/`machine -a`/
export CVSROOT=anoncvs@anoncvs3.usa.openbsd.org:/cvs

Reload the profile. ksh uses . instead of source (as bash does).

$ . ~/.profile

Install Common Packages

Refer to The OpenBSD packages and ports system for more information.

$ sudo pkg_add -v pkglocatedb zsh screen vim nmap gnupg rsync git colorls firefox vlc xchat pidgin

Select pkglocatedb-0.6p1, screen-4.0.3p4, vim-7.4.135p0-gtk2-perl-python3-ruby, gnupg-1.4.16, rsync-3.1.0-iconv, and pidgin-2.10.9.

zsh Configuration, Part I

Change the shell to zsh. Changes will take effect on restarting FVWM.

$ chsh -s /usr/local/bin/zsh username

Exit FVWM and login again. xterm will start again and zsh will run zsh-newuser-install.

Enabling ls Colors

OpenBSD doesn't have support for ls color by default. Append the following lines to change the prompt and enable ls colors.

Edit ~/.zshrc.

$ vim ~/.zshrc
autoload -U promptinit && promptinit
prompt redhat
alias ls="colorls -G"

Quit xterm and open a new xterm to reload ~/.zshrc.

Configuring Vim, Part I

Edit ~/.vimrc to set options and configure NERDTree. Until NERDTree is installed, vim will complain about the two autocmd's. Later, archivers/unzip will be installed from ports to unpack the NERDTree distribution.

$ vim ~/.vimrc
filetype plugin indent on
syntax on
set ruler
set number
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set autoindent
let NERDTreeShowHidden=1
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
let fortran_free_source=1
let fortran_dialect="f90"
au BufRead,BufNewFile *.f90 set filetype=fortran

zsh Configuration, Part II

Edit ~/.zprofile and add the following lines to enable sourcing ~/.profile on login.

$ vim ~/.zprofile
emulate sh
. ~/.profile
emulate zsh

Quit xterm and open a new xterm to reload ~/.zprofile.

Disabling xconsole

Edit /etc/X11/xdm/Xsetup_0 and comment out lines 3-6 to disable the xconsole created on logging in.

$ sudo vim /etc/X11/xdm/Xsetup_0
#if [ "$DISPLAY" = ":0" -o "$DISPLAY" = ":0.0" ]
#        xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail

Installing Flash Support

Start Firefox, then quit it to create and populate the ~/.mozilla directory. Add support for Flash to Firefox by installing the gstreamer plugins, then start Firefox again to confirm that it works.

$ sudo pkg_add -v gnash gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly
$ mkdir ~/.mozilla/plugins
$ ln -s /usr/local/lib/mozilla/plugins/libgnashplugin.so ~/.mozilla/plugins/

Control audio settings using audioctl and mixerctl.

$ mixerctl outputs.master.mute=off

Building the System

Checkout a copy of the OpenBSD 5.5 patch branch kernel, userland, X11, and ports. CVSROOT must be set or you'll need to specify it on the command line with the -d option each time. The OpenBSD handbook suggests preloading the source tree instead of downloading a fresh tree from anonymous CVS (sys.tar.gz, src.tar.gz, xenocara.tar.gz, and ports.tar.gz), but the subsequent CVS update appears to hang on my test machine. get-ing a new tree works correctly.

Add your regular user to the wsrc group.

$ sudo user mod -G wsrc username

Create directories for ports and xenocara.

$ cd /usr
$ sudo mkdir ports
$ sudo mkdir xenocara

Perform an initial CVS get of ports, src, and xenocara.

$ sudo cvs get -rOPENBSD_5_5 -P src xenocara ports

Allow building ports as a regular user. (TODO: Figure out how to make this actually work.)

$ sudo chgrp -R wsrc /usr/ports
$ sudo chgrp -R wsrc /usr/src
$ sudo chgrp -R wsrc /usr/xenocara
$ sudo find /usr/ports -type d -exec chmod g+w {} \;
$ sudo find /usr/src -type d -exec chmod g+w {} \;
$ sudo find /usr/xenocara -type d -exec chmod g+w {} \;

Build a STABLE kernel. Refer to Building the System from Source for more information. (TODO: Fix permissions and build as a regular user.) The new kernel will be located at /bsd and the old one will be backed up to /obsd.

$ cd /usr/src/sys/arch/amd64/conf
$ sudo config GENERIC
$ cd ../compile/GENERIC
$ sudo make clean && sudo make
$ sudo make install
$ sudo reboot

Build the userland.

$ sudo rm -rf /usr/obj/*
$ cd /usr/src
$ sudo make obj
$ cd /usr/src/etc && env DESTDIR=/ sudo make distrib-dirs
$ cd /usr/src
$ sudo make build

Build Xenocara.

$ cd /usr/xenocara
$ sudo rm -rf /usr/xobj/*
$ sudo make bootstrap
$ sudo make obj
$ sudo make build

Create WRKOBJDIR for ports to build in. Unless explicitly set (or unset), it defaults to /usr/ports/pobj. TODO: Move this step to the initial setup of the directories for building the system.

$ sudo mkdir /usr/ports/pobj
$ sudo chgrp wsrc /usr/ports/pobj
$ sudo chmod g+w /usr/ports/pobj


$ sudo shutdown -r now

Configuring Vim, Part II

Install unzip-6.0p3 from ports.

$ cd /usr/ports/archivers/unzip
$ sudo make install
$ sudo make clean

Create ~/downloads, download NERDTree 4.2.0, create ~/.vim, and install NERDTree.

$ make ~/downloads
$ cd ~/downloads
$ curl -o nerdtree.zip http://www.vim.org/scripts/download_script.php?src_id=17123
$ mkdir ~/.vim
$ unzip nerdtree.zip -d ~/.vim
$ rm nerdtree.zip


Congratulations! You've successfully installed and configured OpenBSD 5.5.