FreeBSD GUI desktop environment

FreeBSD desktop environment

Install FreeBSD GUI desktop environment. A step-by-step article for installing a FreeBSD GUI desktop environment on a desktop.

Topics covered:
  • 2.1Install FreeBSD desktop
    • 2.1.1Display server
    • 2.1.2Desktop environment
    • 2.1.3Graphics module
  • 2.2Desktop configuration
    • 2.2.1File systems table
    • 2.2.2System configuration
    • 2.2.3Reboot system
  • 2.3Troubleshoot FreeBSD desktop
    • 2.3.1Xfce desktop environment
    • 2.3.2Xorg configuration

Affiliate links

Running a custom FreeBSD web server requires a VPS or a cloud server with root access. Use our affiliate links to purchase a VPS or cloud server from third-party vendors. The affiliate commissions we earn facilitate, Free website access for everyone.

The affiliate links are listed in alphabetical order without any favor. Users are encouraged to refer to the Global Webdynamics LLP Terms of Service governing the Third-party vendors.

2.1Install FreeBSD desktop

The FreeBSD base system doesn't come with a GUI desktop environment. The user must install the graphical desktop software, applications, and libraries using the package manager and configure the system configuration files to run the GUI desktop environment on the FreeBSD operating system.

2.1.1Display server

Install the X.Org server, an X Window System display server implementing the X protocol. The xorg is a meta port that will install the collection of applications and libraries required to run the X11 windowing system.

Terminal ~ 2.1-1
# Windowing system
$ sudo pkg install xorg

2.1.2Desktop environment

Install the GNOME desktop environment and GNOME Display Manager (GDM). The gnome-42 is a meta port that will install the full-fledged GNOME desktop environment. The meta port will install basic applications, games, networking and multimedia applications, system management utilities, development libraries, etc.

Terminal ~ 2.1-2
# GNOME desktop
$ sudo pkg install gnome

2.1.3Graphics module

To manage Graphics Processing Unit (GPU) and 3D graphics acceleration, the user needs to install Direct Rendering Manager (DRM) kernel module. The meta port drm-kmod will choose the DRM version for installation depending on the installed FreeBSD version.

Terminal ~ 2.1-3
# DRM kernel module
$ sudo pkg install drm-kmod

2.2Desktop configuration

After installing the Graphical User Interface (GUI) related applications, libraries, and drivers, the user can configure the system to run the GNOME desktop.

2.2.1File systems table

To run the GNOME desktop requires a proc filesystem ( procfs ) to mount at the mount point /proc. The user must add the procfs to the file systems table ( fstab ) configuration file /etc/fstab.

Terminal ~ 2.2-1
# Mount proc filesystem
$ sudo nano -w -c /etc/fstab
# Device        Mountpoint      FStype  Options Dump    Pass#
...
proc            /proc           procfs  rw      0       0
...

2.2.2System configuration

Following are some of the minimal system configurations for running the complete GNOME desktop environment with full features:

2.2.2-1Load modules

Load DRM kernel module on system boot. Add the kernel module i915kms (Intel HD graphics) or amdgpu (AMD graphics) to the Kernel Loadable Module list ( kld_list ) in the system configuration file /etc/rc.conf to load the graphics kernel driver module at boot time.

Terminal ~ 2.2-2
# Load DRM module
$ sudo nano -w -c /etc/rc.conf
...
# For Intel HD graphics
kld_list="i915kms"

# For AMD graphics
kld_list="amdgpu"

# For AMD Radeon graphics
kld_list="radeonkms"
...

To use the features of the graphics driver by GUI applications, the user should be part of the video group or the wheel group. Add the user ( freebsd ) to the video group if the user is already not part of the wheel group.

Terminal ~ 2.2-3
$ sudo pw groupmod video -m freebsd

2.2.2-2Startup services

The services that must start on system boot are enabled using the system configuration file /etc/rc.conf. The GNOME desktop requires the following services to enable on system boot: D-Bus, Hardware Abstraction Layer (HAL), GNOME Display Manager (GDM), and GNOME.

Terminal ~ 2.2-4
# Enable services
$ sudo nano -w -c /etc/rc.conf
...
dbus_enable="YES"
hald_enable="YES"
gnome_enable="YES"
gdm_enable="YES"
...

2.2.2-3System console

The virtual terminal ( vt ) console driver will use the Kernel Mode Setting ( KMS ) feature of the DRM graphics driver to switch between X Window System and the virtual terminals. The KMS video driver also enables fast console switching and the resolution setting for framebuffer ( fb ). In the /boot/loader.conf file, add the following boot time system configurations.

Terminal ~ 2.2-5
$ sudo nano -w -c /boot/loader.conf
...
hw.vga.textmode=1
kern.vty=vt
kern.vt.fb.default_mode="1366x768"
...

2.2.3Reboot system

Finally, reboot the system. The GNOME Display Manager (GDM) will start the desktop session with the login screen. The user can log in to the GNOME desktop with a username and password.

Terminal ~ 2.2-6
# Restart now
$ sudo shutdown -r now

2.3Troubleshoot FreeBSD desktop

At times after upgrading application software using the package manager or upgrading the FreeBSD to a new version, the FreeBSD GUI desktop doesn't start after boot due to device driver compatibility issues. Following are some FreeBSD GUI desktop environment troubleshooting options.

2.3.1Xfce desktop environment

Due to unforeseen issues, the GNOME Display Manager (GDM) doesn't show the login screen or the GDM fails to login to the GNOME desktop. Then the other option is to install an alternative desktop environment like Xfce.

To use Xfce as a FreeBSD desktop environment, install SLiM, a desktop graphical login manager for X11 windowing systems.

Terminal ~ 2.3-1
$ sudo pkg install xfce slim

Disable GNOME and GDM services and enable SLiM service. Reboot the system, and the SLiM login manager will present the login screen. After authentication, boot into the Xfce desktop environment.

Terminal ~ 2.3-2
$ sudo nano -w -c /etc/rc.conf
...
# Disable services
gnome_enable="NO"
gdm_enable="NO"
...
# Enable service
slim_enable="YES"
...

$ sudo shutdown -r now

2.3.3Xorg configuration

In most installation cases, the Xorg configuration step is not required to set up a FreeBSD GUI desktop environment. Xorg is automatically configured while installing the latest version of the FreeBSD operating system, and the drm-kmod meta port package installs the required device drivers. But, in some cases, the Xorg server may not start at boot and needs a manual Xorg configuration.

The Xorg command with the -configure flag will create a Xorg configuration file /root/xorg.conf.new. Copy and rename the xorg.conf.new file to /etc/X11/xorg.conf. Create a .xinitrc file under the user's home directory and add the command exec startxfce4.

Terminal ~ 2.3-2
$ sudo Xorg -configure
$ sudo mv /root/xorg.conf.new /etc/X11/xorg.conf
$ nano -w -c ~/.xinitrc
# For GNOME desktop
exec /usr/local/bin/gnome-session

# For Xfce desktop
exec startxfce4

# Set permissions
$ chmod 755 ~/.xinitrc

Affiliate links

Running a custom FreeBSD web server requires a VPS or a cloud server with root access. Use our affiliate links to purchase a VPS or cloud server from third-party vendors. The affiliate commissions we earn facilitate, Free website access for everyone.

The affiliate links are listed in alphabetical order without any favor. Users are encouraged to refer to the Global Webdynamics LLP Terms of Service governing the Third-party vendors.