Installing an OpenBSD 4.9 (i386) desktop system

Note : this tutorial is now obsolete. Please refer to the official OpenBSD installation documentation.


How to obtain a lightweight OpenBSD desktop using the XFCE 4.8 environment

(this tutorial was made using a VirtualBox 4.0 virtual machine)

Download the install CD image : (french mirror)

Choose your mirror here :

Installing OpenBSD

The install procedure is straightforward. Boot the CD and follow the Official faq :

“Do you expect to run the X Window System?” : yes
“Do you want the X Window System to be started by xdm(1)?” : no
(we will enable it later)

“Setup a user?” : fred

Partitioning your disk (the hardest part of the setup) :

I personally opt for a (simpler) (C)ustom layout :

example for a 20Go hard disk (I’m using a low capacity virtual hard disk here!) :

a: / 1G
b: swap 1G
d: /usr 10G
e: /tmp 1G
f: /var 1G
g: /home (all the remaining disk space)

Adapt at your will.

So when prompted, choose (C)ustom layout, and type the following to delete all partitions and create our layout :

(use the ? command for help)
> z
> a
partition: [a] (enter, use defaults)
offset: [...] (enter, use defaults)
size: [...] 1G
FS type : [4.2BSD] (enter, use defaults)
mount point: [none] /
> p
(we see our partition)
> a
partition: [b] (enter, use defaults)
offset: [...] (enter, use defaults)
size: [...] 1G
FS type : [swap] (enter, use defaults)
> a
partition: [d] (enter, use defaults)
offset: [...] (enter, use defaults)
size: [...] 10G
FS type : [4.2BSD] (enter, use defaults)
mount point: [none] /usr
> a
partition: [e] (enter, use defaults)
offset: [...] (enter, use defaults)
size: [...] 1G
FS type : [4.2BSD] (enter, use defaults)
mount point: [none] /tmp
> a
partition: [f] (enter, use defaults)
offset: [...] (enter, use defaults)
size: [...] 1G
FS type : [4.2BSD] (enter, use defaults)
mount point: [none] /var
> a
partition: [g] (enter, use defaults)
offset: [...] (enter, use defaults)
size: [...] (enter, use all remaining space)
FS type : [4.2BSD] (enter, use defaults)
mount point: [none] /home
> p

Ok, we are done, save changes
> w
and exit partitioning
> x

Installation of the CD sets, just use the defaults.

If all went well
# reboot

First root login after installation

We add the PKG_PATH environment variable (location of packages to download) in the .profile shell configuration file.
# vi .profile

add the line :

export PKG_PATH=`machine -a`/

(here for the french mirror, remember to use a suitable mirror for your location)

Do the same for regular user fred
# nano -w /home/fred/.profile

Exit and re-log as root for the modification to be effective.

Now let’s install our first package : the friendlier text editor Nano ๐Ÿ™‚
# pkg_add -v nano

Enable sudo for user fred
# visudo

uncomment the line
# %wheelย  ALL=(ALL) SETENV: ALL

then make sure our user belongs to the wheel group
# groups fred

if not :
# usermod -G wheel fred

NOTE : if you’re using a VM, you can now connect with ssh (as user fred) on your openbsd system for convenient terminal copy & paste.

Installing the XFCE Desktop environment from packages
$ su
# pkg_add -v gamin xfce4-session xfce-utils xfdesktop xfconf xfce4-mixer xfce4-settings xfce4-panel xfce4-terminal xfce4-places xfwm4 xfwm4-themes

# cat >>/etc/rc.conf.local <<EOF

Then start X Window with XFCE
# echo >~/.xinitrc startxfce4
# startx

Note : for X troubleshooting, see

If everything works well so far, we can enable X to start automatically at boot, via the xdm login manager
# echo >>/etc/rc.conf.local xdm_flags=""

We also need to set .xsession (otherwise fvwm is the default window manager)
# exit
$ echo >~/.xsession startxfce4

(reboot to apply changes)

You may want to use gdm as login manager instead of xdm (more gnome dependencies will be installed) :
# pkg_add -v gdm
# nano /etc/rc.conf.local


and add gdm to the rc_scripts line :

rc_scripts=”dbus_daemon gdm”

While we are at it, enable the aucat sound daemon at boot time
# nano /etc/rc.conf.local
add the line :


Start aucat as daemon
# aucat -l

Ok, we have now a bare XFCE desktop, it’s time to install some apps!

Installing applications for our desktop

Internet apps

Lightweight web browser Midori (uses WebKit like Chromium)
$ sudo pkg_add midori

NOTE : Midori is able to play HTML5 videos ๐Ÿ™‚
See (“Join the trial”)

Chromium web browser (*not recommended at this time because of stability problems! And the sound doesn’t seem to work*)
$ sudo pkg_add chromium

There are some things to do for Chromium to be a bit functional :
# echo >>/etc/sysctl.conf kern.shminfo.shmall=32768
# nano /etc/login.conf
in the “default” section :

(system will need to be restarted)

Add the Chromium icon in XFCE’s menu
Create the file chromium.desktop
# nano /usr/local/share/applications/chromium.desktop

[Desktop Entry]
Comment=Chromium Web browser
Exec=chrome %u

Firefox 3.6.x + language pack
$ sudo pkg_add firefox-i18n-fr
(here for the french language, adapt to your case)

media player plugin for Firefox (uses mplayer)
$ sudo pkg_add gecko-mediaplayer

(verify your plugins with about:plugins in firefox)

There’s no native flash player support in *BSD (hopefully this crappy piece of software will be rendered obsolete by HTML5 video support)
So we have some workarounds with Firefox 3.6 (Firefox 4.0 supports HTML5 videos, but is not available as a package in OpenBSD release 4.9…)

Youtube without flash for Firefox :

* Install the Greasemonkey add-on
* Install the following script for Greasemonkey : “Youtube without Flash Auto”

NOTE : doesn’t work for me right now!

Another work-around :

Youtube-dl for downloading videos
$ sudo pkg_add -v youtube-dl
$ youtube-dl <URL_of_youtube_video>

Then use mplayer to replay the video.

Email client Thunderbird
$ sudo pkg_add mozilla-thunderbird

If you prefer a lighter client, sylpheed / claws-mail are also available.

FTP client FileZilla
$ sudo pkg_add filezilla

IM client, Empathy (warning, many gnome dependencies!)
$ sudo pkg_add empathy

xchat for a much lighter, IRC client only.
$ sudo pkg_add xchat

Multimedia apps

VLC media player (warning, qt4-dependant!)
$ sudo pkg_add vlc

Lightweight audio player : Audacious
$ sudo pkg_add audacious-plugins

To have sound output in Audacious, be sure to select “Sndio output plugin” in preferences/audio.

Office apps

Lightweight text editor : mousepad
$ sudo pkg_add mousepad

LibreOffice suite (Warning, heavy!)
$ sudo pkg_add libreoffice-i18n-fr libreoffice-java
(adapt to your own language)

To define default language in LibreOffice, start it then go to the Tools menu > Options > Language settings.

PDF viewer
$ sudo pkg_add -v epdfview-0.1.7p7

Image processing : GIMP
$ sudo pkg_add gimp

Image displayer : eog (again, heavy gnome-dependencies!)
$ sudo pkg_add eog-plugins

Updated 07/22/2011 : Mike suggests Ristretto which is an XFCE app (so much lighter)

Some more useful utilities (archive manager, calc, …)
$ sudo pkg_add thunar-archive galculator

Now we want to add support for .rar archives, rar/unrar isn’t available as a package, but is present in OpenBSD’s ports.

Installing the ports tree

$ cd /tmp
$ ftp
$ cd /usr
$ sudo tar xzf /tmp/ports.tar.gz

Compiling and installing unrar :

$ cd /usr/ports/archivers/unrar
$ sudo make install

NOTE : the OpenBSD developers strongly suggest to use binary packages whenever possible.


As always, feedback is welcome ๐Ÿ™‚

OpenBSD optimizations

Disk optimization : add the softdep and noatime options for your partitions in /etc/fstab

# nano -w /etc/fstab

/dev/wd0a / ffs rw,softdep,noatime 1 1
/dev/wd0g /home ffs rw,nodev,nosuid,softdep,noatime 1 2
/dev/wd0e /tmp ffs rw,nodev,nosuid,softdep,noatime 1 2
/dev/wd0d /usr ffs rw,nodev,softdep,noatime 1 2
/dev/wd0f /var ffs rw,nodev,nosuid,softdep,noatime 1 2


# man afterboot
# man intro
# man 8 intro
# man hier

Manually update the files database so we can use the locate command to look for a file
# /usr/libexec/locate.updatedb
# locate <name>

List installed packages
# pkg_info |more

Search for packages in repository (provided by PKG_PATH)
# pkg_info -Q <search string>

Update all packages on the system
# pkg_add -v -u


29 thoughts on “Installing an OpenBSD 4.9 (i386) desktop system

  1. Done the XFCE install. When started, windows have no decorations. Even installing ALL xfce4 packages doesn’t solve it. Tried 3 times to install xfce4 no openbsd 4.9 and can’t get any window decoration. Launching a terminal shows it, and no text can be typed inside, and no window decoration.

    Removed everything. Type the same pkg_add commands as you, started dbus, and get no window decoration, Xfce4 totally borked.

  2. Hello
    nice tuto, just a question, what resolution were you able to get from virtualbox? 1024×768 ? 800×600 ? i am stuck at 800×600..

  3. Great article! To answer one of *your* questions, consider using ristretto (x11/xfce4/ristretto) in ports as a substitute for eog for viewing, zooming, and rotating images.

  4. hi , nice article ,, ! but how if i want to dualboot with ubuntu , mayb you want to write another article about it

    sorry for my bad english.. ๐Ÿ™‚

  5. Nice article, everything on one page to get install and desktop up and running instead of having to trawl the net.


  6. i cant install packages..

    export PATH
    export PKG_PATH=

    my .profile ok set packages ?

      • install in one vm virtualbox..
        i started try to install version 4.6 because i dont have the cds….
        and i install46.iso and packets from http://ftp.. that have the version 4.6
        i check this mirror
        and every thing seens oks…
        open the the shell root
        and next i log out

        First root login after installation

        # vi .profile
        export PATH
        export PKG_PATH=””

        do the same with my user than


        lol now work different than past they found i think the ftp

        # pkg_Add -v nano
        parsing nano-2.0.9
        dependencies for nano resolve to: libiconv.. gettext.. iconv..
        nano:parsing libiconv-1.13
        found libspec c.51.0 in /usr/lib
        Segmentation fault (core dumped) | 1%

        now i think work? i will try ssh ๐Ÿ˜‰

      • I’m not sure if older OpenBSD releases work properly in VirtualBox?
        Also, do you have the latest VirtualBox version?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s