Install Gnome desktop on OpenBSD 5.5


OpenBSD is getting more and more attractive on the desktop.

Adding to that OpenBSD is super stable, reliable, consistent and simple to use in general.

I will use my Lenovo x201i to install on.

Install base OpenBSD

Install base on Lenovo x201i (amd64). Because x201 doesn’t have any CDROM to insert you install CD you may use either an USB stick or use PXE boot install.

I chose the following disk layout on my 120 GB SSD disk. Around 40 GB is left for spare.

# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd0a      3.9G    419M    3.3G    11%    /
/dev/sd0g     39.4G   65.1M   37.3G     0%    /home
/dev/sd0d      9.8G    8.0K    9.4G     0%    /tmp
/dev/sd0e     14.8G    1.9G   12.1G    14%    /usr
/dev/sd0f      9.8G    7.6M    9.3G     0%    /var

Also make sure to setup a regular user to be used when loggin on to gnome.

Add permissions to wheel group in /etc/sudoers file.


export PKG_PATH=
pkg_add nano
echo "export PKG_PATH=$PKG_PATH" >> ~/.profile

Setup pf

Inspired heavily by Building an OpenBSD desktop.

# cat /etc/pf.conf         

lan = "{,,, }"
eth = "em0"
wlan = "iwn0"

set block-policy return
set skip on lo0

match in all scrub (no-df)
antispoof quick for (egress)

block in quick on egress from { no-route urpf-failed } to any

# Default block policy. Only block incoming
block in all
pass out quick

# Pass in on SSH port
pass in inet proto tcp from $lan to port ssh

# Support ICMP e.g. ping
pass in inet proto icmp all icmp-type $icmp_type

Update firewall rules

pfctl -evf /etc/pf.conf

Install Gnome

Gnome is really trivial to install on OpenBSD!

pkg_add gnome

I had some problem with openldap-client so I needed to install that separately.

pkg_add openldap-client
pkg_add gnome

The following services need to be started at boot. gdm will start the gnome shell.

# cat /etc/rc.conf.local

ntpd_flags=             # enabled during install

pkg_scripts="dbus_daemon avahi_daemon gdm minidlnad"

After gnome install. Restart the machine and log on to gnome desktop as a regular user.

It is now possible to run X unpriviledged.

# cat /etc/sysctl.conf

Install mercurial

Install mercurial and clone the most used repos.

pkg_add mercurial

cat ~/.hgrc
username = Peter Ljung <>

hg clone ssh://peter@silver/Documents/hg/server-conf
hg clone ssh://peter@silver/Documents/hg/eman
hg clone ssh://peter@silver/Documents/hg/eman-blog
hg clone ssh://peter@silver/Documents/hg/flux
hg clone ssh://peter@silver/Documents/hg/haskell
hg clone ssh://peter@silver/Documents/hg/jrobot
hg clone ssh://peter@silver/Documents/hg/opennas
hg clone ssh://peter@silver/Documents/hg/ops
hg clone ssh://peter@silver/Documents/hg/photogenic
hg clone ssh://peter@silver/Documents/hg/swingcvs

Install toad and awifi

awifi is my own script for simple wlan setup.

Download the file and make a symbolic link to it.

# pkg_add wget
# mkdir /usr/local/share/auto-wifi/
# cd /usr/local/share/auto-wifi/
# wget
# ln -s /usr/local/share/auto-wifi/ /usr/local/bin/awifi
# awifi

Install toad to enable automatic USB attach/detach.

# pkg_add toad
# /etc/rc.d/toad start
# /etc/rc.d/hotplugd start

Try to insert a USB disk and access it.

ls /run/media/peter/usb0/

Install Vim

Add vim. I use the package with X11 support (gvim) and with python and ruby support.

pkg_add vim

Install smtpd

smtpd is part of the OpenBSD base system so you don’t need to install anything.

An example configuration is well explained at

Don’t forget to configure a valid hostname for your host. In /etc/hosts.	localhost think

Use media

Install vlc, minidlna.

# pkg_add vlc minidlna

Install Haskell and Gloss

There is some problem with OpenBSD, Haskell, LLVM and binutils. This following link indicate that it should work with binutils 2.17 and later. See FreeBSD LLVM 2.6 Release Notes which should be the case.

The llvm-gcc bootstrap will fail with some versions of binutils (e.g. 2.15) with a message of "Error: can not do 8 byte pc-relative relocation" when building C++ code. We intend to fix this on mainline, but a workaround for 2.6 is to upgrade to binutils 2.17 or later.

But I still get “can not do 8 byte pc-relative relocation” errors. So I needed to use the assembler backend (-fasm) and override the default LLVM backend specified in (gloss-examples.cabal). Question is if all other options is removed at the same time?

pkg_add haskell-platform
cabal update
cabal install gloss
pkg_add llvm
cabal install --ghc-options="-fasm" gloss-examples

Run a test application.

export DISPLAY=":0.0"