Skip to main content.

Building an OpenBSD desktop

2014-04-01

Live demo in BSD Now Episode 031 | Originally written by TJ for bsdnow.tv | Last updated: 2015/05/01

NOTE: the author/maintainer of the tutorial(s) is no longer with the show, so the information below may be outdated or incorrect.

While the BSD family of operating systems are known around the world for their stability, scalability, performance and security in the server space, they can actually make a pretty nice desktop as well. This tutorial will show you how to go from a fresh, minimal install of OpenBSD to a stylish graphical desktop. Once you've got the system up after the install, log in as root and we'll get started. Be sure you included all the X sets in your install! A good first thing to verify is that your network connectivity is working properly.

# ping -c 2 bsdnow.tv

PING bsdnow.tv (65.39.148.220): 56 data bytes
64 bytes from 65.39.148.220: icmp_seq=0 ttl=47 time=71.209 ms
64 bytes from 65.39.148.220: icmp_seq=1 ttl=47 time=54.169 ms
--- bsdnow.tv ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 54.169/62.689/71.209/8.520 ms

Assuming your network is functioning properly, the next thing to check whether there are any updates to the base system. If there were any issues that affect your version, you should go ahead and patch them. Even desktop systems should have a firewall, so we'll use a basic pf configuration.

# vi /etc/pf.conf

You might want something like:

set block-policy drop
set skip on lo0
match in all scrub (no-df random-id max-mss 1440)
antispoof quick for (egress)
block in quick on egress from { no-route urpf-failed } to any
block in all
pass out quick inet keep state

Since X11 is included with OpenBSD, we just need to install the other graphical utilities that we're going to need. Which desktop environment or window manager you use is up to you, but we'll be doing GNOME for this tutorial. Note that GNOME3 requires 3D acceleration, so this will not work in VirtualBox. XFCE doesn't have that requirement, so you may want to try it if you don't have a supported graphics card. Select a mirror close to you for the best speeds. I'm going to install GNOME and a few other packages that you'll probably want. TOAD is a daemon that allows hotplugging of CD/DVD drives. Even with emulation, Adobe Flash is not available for OpenBSD. The "youtube-dl" tool will let you download flash videos and play them in mplayer. The HTML5 versions of YouTube and some other sites will work normally.

# export PKG_PATH=http://ftp.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`uname -m`/
# pkg_add -I gnome toadd firefox youtube-dl vim irssi scrot gstreamer-plugins-ugly mplayer ubuntu-fonts

You can also use ports to install everything if you prefer, but this is much faster. As of 5.5, binary packages are even signed, hooray! After everything installs, we'll add a few items to start up on boot and change a few settings.

# echo 'multicast_host=YES' >> /etc/rc.conf.local 
# echo 'ntpd_flags="-s"' >> /etc/rc.conf.local
# echo 'hotplugd_flags=""' >> /etc/rc.conf.local
# echo 'pkg_scripts="dbus_daemon avahi_daemon toad gdm"' >> /etc/rc.conf.local
# cp /etc/examples/ntpd.conf /etc
# echo 'constraint from "https://example.com"' >> /etc/ntpd.conf

If you're going to be using programs like Firefox, you're probably going to need to adjust some values in /etc/login.conf. By default, OpenBSD will kill any process your user runs after it takes up 512MB of RAM. Firefox can (and will) take a lot more, so let's up that a little bit.

# vi /etc/login.conf

A diff to show what you may want to change:

--- /etc/login.conf     Fri Mar  7 19:28:16 2014
+++ /etc/login.conf     Fri Mar  7 19:32:31 2014
@@ -43,8 +43,8 @@
 default:\
        :path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin /usr/local/bin /usr/local/sbin:\
        :umask=022:\
-       :datasize-max=512M:\
-       :datasize-cur=512M:\
+       :datasize-max=1024M:\
+       :datasize-cur=1024M:\
        :maxproc-max=256:\
        :maxproc-cur=128:\
        :openfiles-cur=512:\

I also recommend using soft updates and enabling the "noatime" flag on your root device.

# vi /etc/fstab

For example, if you installed / to /dev/wd0a, change the line to:

/dev/wd0a / ffs rw,noatime,softdep 1 1

Finally, apply all the changes. Make sure you do not have XDM set to start automatically.

# reboot

The system will restart and present you with a graphical login manager. You can log in as this regular user (not root!) and begin configuring things how you like through the graphical utilities. A couple nice screenshots from Antoine Jacoutot:

Latest News

New announcement

2017-05-25

We understand that Michael Dexter, Brad Davis, and George Rosamond think there should be more real news....

Two Year Anniversary

2015-08-08

We're quickly approaching our two-year anniversary, which will be on episode 105. To celebrate, we've created a unique t-shirt design, available for purchase until the end of August. Shirts will be shipped out around September 1st. Most of the proceeds will support the show, and specifically allow us to buy...

New discussion segment

2015-01-17

We're thinking about adding a new segment to the show where we discuss a topic that the listeners suggest. It's meant to be informative like a tutorial, but more of a "free discussion" format. If you have any subjects you want us to explore, or even just a good name...

How did you get into BSD?

2014-11-26

We've got a fun idea for the holidays this year: just like we ask during the interviews, we want to hear how all the viewers and listeners first got into BSD. Email us your story, either written or a video version, and we'll read and play some of them for...


Episode 243: Understanding The Scheduler

2018-04-25

This episode was brought to you by Headlines OpenBSD 6.3 released Punctual as ever, OpenBSD 6.3 has been releases with the following features/changes: > Improved HW support, including: > SMP support on OpenBSD/arm64 platforms > vmm/vmd improvements: > IEEE 802.11 wireless stack improvements > Generic network stack improvements > Installer improvements > Routing daemons and other userland network improvements > Security...

Episode 242: Linux Takes The Fastpath

2018-04-18

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines TrueOS STABLE 18.03 Release The TrueOS team is pleased to announce the availability of a new STABLE release of the TrueOS project (version 18.03). This is a special release due to the security issues impacting the computing world since the beginning...

Episode 241: Bowling in the LimeLight

2018-04-11

Direct Download:MP3 AudioVideo This episode was brought to you by Headlines [Other big ZFS improvements you might have missed] 9075 Improve ZFS pool import/load process and corrupted pool recovery > One of the first tasks during the pool load process is to parse a config provided from userland that describes what devices the pool is...

Episode 240: TCP Blackbox Recording

2018-04-04

Direct Download:VideoMP3 Audio This episode was brought to you by Headlines [A number of Upstream ZFS features landed in FreeBSD this week] 9188 increase size of dbuf cache to reduce indirect block decompression With compressed ARC (6950) we use up to 25% of our CPU to decompress indirect blocks, under a workload of...