How to Install KDE Plasma on OpenBSD: Error Free Setup

How to Install KDE Plasma on OpenBSD: Error Free Setup

How to Install KDE Plasma Desktop Environment on OpenBSD

When you choose OpenBSD, you aren't just picking an operating system; you are opting for a system engineered with a "security-first" mindset. Transitioning from a purely terminal-based setup to a graphical workstation requires a precise touch to maintain that legendary system integrity while gaining a modern desktop experience.

Hello everyone, and welcome to MusaBase! In today's article, I will guide you through installing and configuring the desktop environment on an OpenBSD system.

If you're coming from my previous guide on installing KDE Plasma on FreeBSD, you will find that OpenBSD has its own unique way of handling the X Window System and desktop sessions. In this guide, you will learn how to:

  • Download and install KDE and KDE Plasma packages
  • Enable services for Xorg or the X Window System
  • Configure the .xinitrc or .xsession files for xenodm
  • And finally, launch KDE Plasma on OpenBSD

By the end of this guide, you will have a fully functional KDE Plasma desktop running on OpenBSD. So without further ado, let's get started!







Prerequisites

This guide assumes that you already have OpenBSD installed on your PC and that your installation supports the X Window System. If you haven't installed OpenBSD yet, please visit my OpenBSD Installation Guide to get started. Just don't forget to keep the support for the X Window System enabled while installing the OS. Once you are done with the installation, return to this tutorial to continue.




Step 1: Preparing OpenBSD System

Before we jump right into installing KDE Plasma, we need to configure our mirror for faster downloads and update the system so we can pull the latest packages and security patches.

1.1: Set Mirror to Closest Server

In OpenBSD, there's no mirrorlist file like in Linux, but we can set a single URL to point to one specific mirror. We change this mirror URL because the default mirror URL might be the main OpenBSD mirror in the US, which could be slow if you are in another region or country. Choosing a closer mirror reduces latency and speeds up package installs.

  • Open the installurl file in nano like this:
doas nano /etc/installurl
# OR
sudo nano /etc/installurl
  • In the file, replace the default URL with:
https://cloudflare.cdn.openbsd.org/pub/OpenBSD/
# OR
https://fastly.cdn.openbsd.org/pub/OpenBSD/

1.2: Updating System & Packages

Now we will update our OpenBSD system and installed packages. If there are any new Kernel updates available, we need to install them and also update packages to the latest versions.


1.2.1: Updating OpenBSD OS

  • Run:
doas syspatch
# OR
sudo syspatch

1.2.2: Updating Installed Packages

  • Next, run:
doas pkg_add -u
# OR
sudo pkg_add -u
  • After updating and upgrading the OS and system packages, reboot your system with doas reboot for changes to take effect.

With these preparations, we can move forward to the next step, which is installing KDE Plasma itself on our OpenBSD system.




Step 2: Install KDE Plasma

OpenBSD splits KDE into separate packages like kde for meta packages, kde-plasma for the GUI and kde-plasma-extra for additional or full KDE experience, unlike in Linux distros where we can get a single plasma meta package. For this guide, I'm not going to install kde-plasma-extra packages because they can be installed later and are not required to run a desktop environment.

  • Run:
doas pkg_add kde kde-plasma



Step 3: Configure Xorg

Next, we need to enable and start d-bus and add a startplasma-x11 script in ~/.xinitrc or ~/.xsession.

3.1: Enable & Start D-bus

D-Bus or messagebus in OpenBSD provides the core mechanism of inter-process communication. KDE Plasma heavily relies on D-Bus for system functions like managing power, notifications, and session coordination. Without it, services like shutting down or locking the screen will fail.

  • Enabling messagebus is really easy; simply run:
doas rcctl enable messagebus
doas rcctl start messagebus

# OR
sudo rcctl enable messagebus
sudo rcctl start messagebus
OpenBSD command line: enabling and starting the messagebus (D-Bus) service using rcctl.

3.2: Add startplasma-x11 Script

Now, we need to add the startplasma-x11 script lines inside either ~/.xinitrc or ~/.xsession. We can find the script's information at /usr/local/share/doc/pkg-readmes/kde-plasma. For more information or details, run:

doas nano /usr/local/share/doc/pkg-readmes/kde-plasma

3.2.1: Create or Edit .xinitrc or .xsession

  • If you want to start KDE Plasma manually, then add the following script in ~/.xinitrc, but then you have to start your KDE session manually on every boot with doas startx.
  • If you want to start the KDE session automatically on every boot, then follow these steps:
doas nano ~/.xsession
  • It may open an empty file.
  • Inside the file, add:
export XDG_RUNTIME_DIR=/tmp/run/$(id -u)
if [ ! -d $XDG_RUNTIME_DIR ]; then
        mkdir -m 700 -p $XDG_RUNTIME_DIR
fi

export QT_FORCE_STDERR_LOGGING=1
export XDG_CURRENT_DESKTOP=KDE
export DESKTOP_SESSION=plasma
/usr/local/bin/startplasma-x11 > ~/.startplasma-x11.log 2>&1
  • Next, we need to make the ~/.xinitrc or ~/.xsession executable by running:
doas chmod +x ~/.xsession
# OR
doas chmod +x ~/.xinitrc



Step 4: Start KDE Plasma

  • Run:
doas rcctl enable xenodm
doas rcctl start xenodm

# OR

sudo rcctl enable xenodm
sudo rcctl start xenodm
OpenBSD command line: enabling and starting the xenodm display manager service using rcctl.
  • Your screen will blink and may stay black for a few seconds, and after that, you will be greeted by the xenodm login screen:
Xenodm login screen on OpenBSD, prompting for username and password to start a KDE Plasma session.
  • Enter your username and press ENTER.
  • Then type your user's password and press ENTER, and you will see the KDE Plasma loading screen with the OpenBSD logo.
KDE Plasma loading screen on OpenBSD with a progress bar and the OpenBSD logo.

Default KDE Plasma desktop on OpenBSD, showing wallpaper, panel, and application menu.

And we're in!


πŸš€ KDE Plasma on OpenBSD is Ready!

Well, there you go! You now have a functional KDE Plasma desktop environment running on your OpenBSD system. It has been quite a journey; I spent two weeks testing various methods to ensure this process is as smooth as possible. This guide is the result of that extensive testing. I will be uploading more articles featuring different desktop environments on OpenBSD and FreeBSD, so stay tuned!

Explore More OpenBSD Desktops

🎨 GNOME Desktop: If you prefer the GNOME workflow on your secure system, check out my guide on installing GNOME on OpenBSD.

XFCE Environment: For a more lightweight and traditional experience, see my walkthrough on how to install XFCE on OpenBSD.

πŸ› ️ Support & Feedback: If you hit any errors at any step of this installation, please let me know in the comments below. I will be more than happy to help you out.

If you found this testing-backed guide helpful, subscribe to the MusaBase newsletter for more deep-dives into the BSD world.
101 out, I’ll see you in the next one! πŸš€

Load comments