How to Install XFCE on OpenBSD (Fast, Lightweight & Secure)
bsd desktop bsd unix howto lightweight desktop open source os openbsd security focused os unix desktop unix operating system xfce xfce desktop
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 Installed 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 and 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!
Frequently Asked Questions: XFCE on OpenBSD
Why choose XFCE as the desktop environment on OpenBSD?
XFCE is a lightweight, fast, and modular desktop environment that perfectly complements OpenBSD's philosophy of simplicity, security, and correctness. It consumes fewer resources than GNOME or KDE, making it ideal for older hardware, virtual machines, or users who want a clean UNIX‑style desktop without unnecessary bloat. XFCE provides a stable and reliable graphical interface while staying out of your way.
What are the prerequisites for installing XFCE on OpenBSD?
You need a working OpenBSD base system with X Window System (X11) support. If you didn't select the X sets during installation, install them first: doas pkg_add xorg. You should also have a non‑root user with doas (or sudo) privileges. A stable internet connection is required to download the XFCE packages.
How do I install XFCE on OpenBSD?
Install the XFCE meta‑package with:
doas pkg_add xfce
This pulls in all core components: window manager, panel, session manager, settings daemon, and essential utilities. If you want extra plugins and applications (like additional panel items or a power manager), also install:
doas pkg_add xfce-extras
What should I do if the XFCE installation fails with a “partial installation” error?
If you see a message like pkg_add: Installation of xfce4‑xxx‑xxxx failed, partial installation recorded, a specific package didn't install correctly. To fix it, install the failed package manually, for example:
doas pkg_add xfce4-panel-4.20.4
Or simply re‑run the meta‑package installation:
doas pkg_add xfce
This will attempt to install any missing dependencies and complete the setup.
How do I configure the .xsession file to launch XFCE?
Create (or edit) the ~/.xsession file in your home directory:
doas nano ~/.xsession
Add the following two lines:
export LANG=en_US.UTF-8 exec /usr/local/bin/startxfce4
Save the file (Ctrl+O, Enter, Ctrl+X). Then make it executable:
doas chmod +x ~/.xsession
The display manager (xenodm) will read this file when you log in.
Why does the .xsession file need to be executable?
The OpenBSD display manager xenodm explicitly requires the user's .xsession to be executable. If it isn't, xenodm may refuse to start the session and return you to the login screen. Running chmod +x ~/.xsession sets the execute permission and resolves this.
What is messagebus and why do I need it for XFCE?
messagebus is the OpenBSD name for the D‑Bus daemon. It provides inter‑process communication between desktop applications and system services. XFCE relies on it for essential functions like logging out, rebooting, shutting down from the GUI, and for many panel applets. You must enable and start it:
doas rcctl enable messagebus doas rcctl start messagebus
How do I enable and start the xenodm display manager?
After configuring .xsession and messagebus, enable xenodm to start at boot and launch it immediately:
doas rcctl enable xenodm doas rcctl start xenodm
Your screen will switch to graphical mode and present the login prompt.
I started xenodm but the screen is blank or returns to console. What should I do?
A brief black screen is normal while the display manager initialises. If it stays black or dumps you back to the terminal, check:
- That .xsession exists in your home directory, contains the correct lines, and is executable.
- That XFCE was installed completely (re‑run doas pkg_add xfce).
- That messagebus is running (doas rcctl check messagebus).
- That your user is in the wheel group (for doas) – not strictly required for login, but helps.
You can also examine logs with doas tail /var/log/messages.
Can I install XFCE alongside other desktop environments on OpenBSD?
Yes, OpenBSD supports multiple desktop environments. Each user can have their own .xsession file, and you can switch between environments by editing that file. Alternatively, if you use a display manager like xenodm, you can create multiple session files in /usr/local/share/xsessions/ and choose the desired session at login.
How do I start XFCE from the console without a display manager?
If you prefer to start XFCE manually after logging in at the console, you can simply run:
startxfce4
However, this will not give you a graphical login manager. To have a more seamless experience, it's recommended to enable xenodm as described in the guide.
How do I update XFCE after installation?
Regular system updates also update your installed packages. Run:
doas pkg_add -u
This will upgrade all packages, including XFCE components, to the latest versions available in the OpenBSD repository.
What are the most common mistakes when installing XFCE on OpenBSD?
- Forgetting to install the X Window System (xorg) before attempting to install XFCE.
- Not making .xsession executable (chmod +x).
- Omitting the export LANG=... line, which can lead to locale warnings.
- Failing to enable messagebus, causing session management issues.
- Not rebooting after syspatch, leading to kernel vs. userland mismatches.
π 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!
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! π