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

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

OpenBSD with XFCE Desktop - Installation Guide Cover

Transforming a fresh OpenBSD installation into a daily driver requires the right balance of performance and simplicity. While KDE and GNOME are great, XFCE provides that classic UNIX feel that fits perfectly with the OpenBSD philosophy.

Welcome back to MusaBase! In today's guide, we are going to install the XFCE desktop environment on an OpenBSD system.

In my earlier tutorials, I demonstrated how to set up KDE Plasma on OpenBSD and how to configure GNOME for a stable OpenBSD workstation. In this follow-up, we are completing the lineup with XFCE, one of the fastest, lightest, and most reliable desktop environments available for BSD users today. In this ultimate guide, you will learn how to:

  • Prepare your OpenBSD system for a graphical environment
  • Download and install the necessary XFCE packages
  • Create and configure an .xsession file to launch XFCE
  • Enable and start the required display services
  • And finally, log into your new XFCE desktop environment on OpenBSD

By the end of this tutorial, you will have a clean, fast, and fully functional XFCE setup running smoothly on your OpenBSD system. So without further ado, let's get started!







Why Choose XFCE as a Desktop Environment on OpenBSD?

XFCE is designed to be fast and resource-efficient. Its core philosophy is modularity, with components like the panel, window manager, and file manager working independently. It is best suited for PCs or laptops that aren't very powerful, such as virtual machines, legacy PCs, or older laptops.

OpenBSD is known for security, simplicity, and correctness. XFCE complements this by being simple yet powerful, without being bloated with too many heavy, unwanted services. For a BSD workstation, XFCE offers a reliable balance; it provides more functionality than a bare window manager while creating less overhead than heavier desktop environments like GNOME or KDE.




Prerequisites

This guide focuses specifically on desktop setup and does not cover the initial operating system installation. To follow along, you should have a working OpenBSD system ready. If you haven't reached this stage yet, follow my walkthrough on setting up a base OpenBSD installation from scratch.

Once your base system is ready, return to this tutorial to proceed with the XFCE installation.




Step 1: Refreshing the OpenBSD Environment

Before we start deploying the XFCE desktop, ensuring your OpenBSD installation is on the latest patch level is a smart move. While you can skip this, an updated system guarantees that the kernel and security layers are fully patched, preventing weird dependency errors during the desktop environment setup. Keeping the base system and third-party apps in sync is the key to a stable BSD experience.

1.1: Patching the Base System

OpenBSD makes it incredibly easy to fix security vulnerabilities in the base system. We’ll use the syspatch utility to fetch any critical binary updates for the kernel and core libraries.

  • Apply system patches by running:
doas syspatch

1.2: Updating Third-Party Packages

After the base system is ready, we need to ensure our installed tools (like nano or vim) are up to date. This ensures that the XFCE components we are about to install will match the latest shared libraries.

  • To sync your installed apps with the latest repository versions, run:
doas pkg_add -u

Once these updates are finished, I recommend a quick restart with doas reboot to make sure the new kernel patches are active before proceeding to the XFCE installation.




Step 2: Install XFCE

To install XFCE on OpenBSD, you only need to install the XFCE meta package by running a single command. This meta package contains 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

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

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

This means a package didn't install fully, and some components are missing or broken. 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
  • Alternatively, reinstall the XFCE meta package by running:
doas pkg_add xfce
  • When you see the XFCE package installation complete message like this:
  • This indicates that XFCE is installed successfully on your OpenBSD system.



Step 3: Configure OpenBSD Services for XFCE Session

Now you need to create an .xsession file and add the xfce4 launch script. You'll 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
  • In the open .xsession file, add the following lines:
export LANG=en_US.UTF-8
exec /usr/local/bin/startxfce4
  • Press Ctrl + O to save the changes, then press Enter to apply them. Finally, press Ctrl + X to exit the file if you're using nano as your text editor.
  • After adding the locale and exec script, you also need to make the .xsession file executable.
  • To make the file executable, run:
doas chmod +x ~/.xsession
#OR
sudo chmod +x ~/.xsession

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

3.3: Reboot

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



Step 4: Launch XFCE

Now that everything is set up, 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
  • Your display screen may blink and stay blank for a few seconds, then you should see the following screen:
  • Simply enter your username and press Enter, then enter your user's password and press Enter again.

And you're in!



πŸš€ Your OpenBSD Workstation is Ready!

Well, now you have a fully functional XFCE desktop session up and running on your OpenBSD system. XFCE’s reputation for simplicity and speed makes it a perfect match for the secure and minimalist nature of OpenBSD. I will be exploring more advanced setups in the future, including Wayland compositors like Hyprland for OpenBSD, so stay tuned for those upcoming guides!

Explore More OpenBSD Environments

πŸ’Ž KDE Plasma: If you want a more feature-rich and visually modern experience on this OS, follow my guide on building an advanced OpenBSD desktop with KDE.

🎨 GNOME Desktop: For users who prefer a sleek and simplified interface, check out my walkthrough on setting up a professional GNOME workstation on OpenBSD.

πŸ› ️ Support & Feedback: If you hit any error at any step or have problems while logging into your desktop session, please let me know in the comments below. I will be more than happy to help.

OpenBSD allows you to install multiple environments side-by-side, giving you the flexibility to choose what works best for your daily tasks.
101 out, I’ll see you in the next one! πŸš€

Load comments