How to Install KDE Plasma on OpenBSD: Error Free Setup

How to Install KDE Plasma on OpenBSD: Error Free Setup

openbsd-kde-plasma-installation-how-to-install-kde-plasma-on-openbsd-guide-cover-photo

Hello everyone, welcome to MusaBase! In today's article, I'll guide you through installing and configuring a desktop environment on a OpenBSD system. In the previous guide, I showed you how to install OpenBSD, and in this follow-up, we'll continue on installing KDE Plasma on that OpenBSD system. In this guide, you'll learn how to:

  • Download and install KDE and KDE Plasma packages
  • Enabling Services for Xorg or X Window System
  • Configuring .xinitrc or .xsession file for xenodm
  • And finally launching KDE Plasma on OpenBSD

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

openbsd-neofetch-inside-kde-plasma






Prerequisites

This guide assumes that you have already OpenBSD installed on your PC and your OpenBSD does support X Window System. If you haven't installed OpenBSD yet, then please visit my OpenBSD Installation Guide and install it. Just don't forget to leave the support for X Window System enable while installing the OS. When you are done with the installation then come back to this tutorial and continue.




Step 1: Preaparing 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 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 changed 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 antoher region or country. Choosing a closer mirror reduces latency and speeds up pacakge 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 pacakges. If there are any new Kernel update available we need to install it and also update packages to 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 OS and system packages, reboot your system with doas reboot for changes to take effect.

With these preparation we can move forward onto 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 GUI and kde-plasma-extra for additional or full KDE experience, unlike in Linux distors where we can get single plasma meta package. For this guide, I'm not going to install kde-plasma-extra packages, becuase 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 for 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 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-enabling-and-starting-messagebus

3.2: Add startplasma-x11 Script

Now, we need to add startplasma-x11 script lines inside either inside ~/.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 do as the following:
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
enabling-and-starting-xenodm-in-openbsd-for-starting-kde-plasma
  • You screen will blink and may stay black for a few seconds and after that you will be greeted my xenodm login screen:
openbsd-xenodm-login-screen-to-log-in-kde-plasma
  • 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 OpenBSD Logo.
kde-plasma-loading-screen-on-openbsd

kde-plasma-desktop-screen-in-openbsd

And we are in!




Afterwards

Well here you go! Now you have a functional KDE desktop environment running on OpenBSD. Its been a hell of a ride, i tested it with so many different methods for two weeks and finally i KDE working on OpenBSD with the method explained in this guide. I'll upload more aritcle with different desktop environment on OpenBSD and FreeBSD, stay tune.

If you hit any error at any step, please let me know in the comments. I'll be more than happy to help.

1o1 out, I'll see you in the next one!

Load comments