How to Set Up XFCE on OpenBSD: Fast, Light & Secure

How to Set Up XFCE on OpenBSD: Fast, Light & Secure

how-to-install-xfce-on-openbsd-guide

Hi all, welcome to MusaBase! In today's guide, we're going to install XFCE desktop environment on an OpenBSD system. In earlier tutorials, I covered how to install KDE Plasma and GNOME on OpenBSD, and in this follow-up, we're completing the lineup with XFCE, one of the fastest, lightest, and most reliable desktop environments available for BSD users. In this ultimate guide, we will learn how to:

  • Prepare your OpenBSD system for XFCE
  • Download and install XFCE packages for OpenBSD
  • Create an XSession file for XFCE launch
  • Enable and start display services
  • And finally, log into XFCE desktop environmnet on OpenBSD

By the end of this tutorial, you'll will have a clean, fast, and fully functional XFCE desktop environment running on your OenBSD system. So without further ado, let's get into it!

neofetch-in-xfce-on-openbsd-system






Why choose XFCE as a Desktop Env on OpenBSD?

XFCE is designed to be fast and resource-efficient. Its core philosophy is modularity, components like the panel, window manager, file manager, etc. It is best suited for PCs or Laptops that aren't very powerful. Such as Virtual machines, legacy PCs, older laptops etc.
OpenBSD is known for security, simplicity and correctness. XFCE complements this by being simple yet powerful, not bloated withtoo many heavy unwanted services. For a BSD workstation, XFCE offers a reliable balance, where it functions more than a bare window manager and offers less overhead than heavier DEs like GNOME or KDE.




Prerequisites

This tutorial won't cover the installation of OpenBSD. To install OpenBSD, please visit my 100% Complete OpenBSD Installation guide, and follow the steps to explained in the guide to install a fully functional OpenBSD OS. After completing the installation come back to this guide and continue on installing XFCE on OpenBSD.




Step 1: Prepare OpenBSD System for XFCE

Before diving into installing XFCE, updating the OpenBSD OS and installed packages (system and third-part) is a better approach to install any further packages or Desktop environment itself. This step is optional but performing this step first is strongly recommended, becuase doing this step will ensure that our OpenBSD system is up-to-date, has the latest kernel, latest security patches and has the latest available packages and their correct dependencies. Without it our system installer might try to pull in outdated or missing packages, that will conflict in dependencies and also result in failure to install new packages.

1.1: Update OpenBSD OS

First we will update the OpenBSD system, if there are any new Kernel update available, we need to install it. This way we would have new securtiy patches as well.

  • Run:
doas syspatch
# OR
sudo syspatch

1.2: Update Installed Packages

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



Step 2: Install XFCE

To install XFCE on OpenBSD, we only need to install XFCE meta package by running a single command. This meta package will contain all the core components, tools, services etc. To install XFCE run:

doas pkg_add xfce
#OR
sudo pkg_add xfce

Installation Error or Partial Installation Failed

xfce--partial-installation-failed-solution

If your XFCE installation ends with a message as shown in the above image:

"pkg_add: Installation of xfce4-xxx-xxxx failed, partial installation recorded as partial-xfce4-xxx-xxx"

That means a package didn't install fully, and some components are missing or borken. This can cause problems when launching XFCE, either it won't start at all, or it may start but have missing services or features.

    To fix this:
  • Install the failed package manually, for example:
doas pkg_add xfce4-panel-4.20.4
#OR
doas pkg_add xfce4-panel
  • Or reinstall the XFCE meta pakage again by running:
doas pkg_add xfce
  • When we see the XFCE package installed done message prompt like this:
indication-of-xfce-installed-successfully-on-openbsd
  • This indicates that XFCE is installed successfully on our OpenBSD system.



Step 3: Configure OpenBSD Services for XFCE Session

Now, we only need to create an XSession file and add the xfce4 launch script. And also need to enable and start messagebus and xenodm to log into XFCE with a graphical login manager.

3.1: Create or Edit XSession File

  • Run:
doas nano ~/.xsession
creating-xession-file-for-xfce-session-on-openbsd
  • Now, in the open xsession file add the following line:
export LANG=en_US.UTF-8
exec /usr/local/bin/startxfce4
  • Press CTRL + O to save the changes then press ENTER to apply the changes, then press CTRL + X to exit the file if using nano as your text editor.
adding-xfce-launch-script-in-xsession-on-openbsd
  • After adding the locale and exec script we also need to make the .xsession file executable.
  • To make the file executable, run:
doas chmod +x ~/.xsession
#OR
sudo chmod +x ~/.xsession
making-the-xsession-file-executable-on-openbsd

3.2: Enable & Start Messagebus/D-Bus

  • Run the following commands:
doas rcctl enable messagebus
doas rcctl start messagebus

#OR

sudo rcctl enable messagebus
sudo rcctl start messagebus
enabling-and-starting-messagebus-on-openbsd-for-xfce-session

3.3: Reboot

  • After configuring services, its better to restart the system so the services that execute only at boot time can start properly.
  • Run:
doas reboot
#OR
sudo reboot



Step 4: Launch XFCE

Now that everything set, lets enable and start the display manager and finally log into XFCE. Do the following:

doas rcctl enable xenodm
doas rcctl start xenodm

#OR

sudo rcctl enable xenodm
sudo rcctl start xenodm
enabling-and-starting-xenodm-on-openbsd-for-xfce-session
  • Your display screen may blink and stay blank for a few seconds, then you should have the following screen:
openbsd-xenodm-greeter-screen
  • Here simply enter your username and press ENTER, then enter your user's password and ENTER.
xfce-home-screen-on-a-openbsd-system

And you are in!




Afterwards

Well now you have fully functional XFCE desktop session up and running on your OpenBSD system. You can also install multiple desktop sessions like KDE Plasma and GNOME on OpenBSD. I'll try to upload guides on other desktop sessions or wayland compositor like Hyprland installation on OpenBSD also, stay tuned for that.

If you hit any error at any step or having problem while logging into desktop session, please let me know in the comments, I'll be more than happy to help.

This is it, 1O1 out, I'll see you in the next one!

Load comments