How to Install and Configure a Display Manager on FreeBSD

Learn how to install and configure a display manager (e.g., SDDM) on FreeBSD.

A display manager provides a graphical login interface and manages user sessions, enhancing the usability of a FreeBSD system. This guide covers the installation and configuration of SDDM (Simple Desktop Display Manager), a lightweight and modern display manager.

Prerequisites

Before installing SDDM, ensure your FreeBSD system is up-to-date:

# freebsd-update fetch install
# pkg update

Additionally, you need to have superuser (root) access to install and configure packages.

Step 1: Install X.Org

X.Org is necessary for running graphical environments on FreeBSD. Install it with:

# pkg install xorg

Enable required services:

# sysrc dbus_enable="YES"
# sysrc hald_enable="YES"

Start the services:

# service dbus start
# service hald start

Step 2: Install SDDM

To install SDDM, run:

# pkg install sddm

Enable SDDM to start at boot:

# sysrc sddm_enable="YES"

Step 3: Install a Desktop Environment

SDDM requires a desktop environment to function correctly. Choose one based on your preference:

  • KDE Plasma:

    # pkg install kde5
    
  • GNOME:

    # pkg install gnome
    
  • Xfce:

    # pkg install xfce
    

Step 4: Configure SDDM

SDDM’s configuration file is located at /usr/local/etc/sddm.conf. If it does not exist, create it:

# touch /usr/local/etc/sddm.conf

To customize settings, edit the file with a text editor:

[Theme]
Current=default

[Users]
DefaultPath=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin

Step 5: Customize SDDM Themes

SDDM supports themes stored in /usr/local/share/sddm/themes/. To list available themes:

# ls /usr/local/share/sddm/themes/

To set a theme, modify the [Theme] section in /usr/local/etc/sddm.conf:

[Theme]
Current=theme_name

To preview a theme:

sddm-greeter --test-mode --theme /usr/local/share/sddm/themes/theme_name

Step 6: Configure User Sessions

Session files are stored in /usr/local/share/xsessions/. To set a default session, modify the [Users] section in /usr/local/etc/sddm.conf:

[Users]
Session=session_name.desktop

Replace session_name.desktop with the actual session file name.

Step 7: Enable and Start SDDM

Ensure SDDM starts at boot:

# sysrc sddm_enable="YES"

To start SDDM manually:

# service sddm start

Troubleshooting

SDDM Does Not Start at Boot

  • Ensure sddm_enable="YES" is correctly set in /etc/rc.conf.

  • Check logs for errors:

    # cat /var/log/sddm.log
    

Black Screen or Login Failure

  • Ensure the correct graphics driver is installed.
  • Check /var/log/Xorg.0.log for errors.
  • Verify that the chosen desktop environment is installed and properly configured.

Conflicts with Other Display Managers

If another display manager is running, disable it before starting SDDM:

# sysrc gdm_enable="NO"
# sysrc lightdm_enable="NO"
# sysrc slim_enable="NO"

Conclusion

Installing and configuring SDDM on FreeBSD provides a streamlined graphical login experience. By following this guide, you can successfully set up and customize SDDM to enhance your FreeBSD desktop environment.