FreeBSD 12 as an alternative to the Linux desktop

Swapping Tux

© Photo by Ian Parker on Unsplash

© Photo by Ian Parker on Unsplash

Article from Issue 223/2019

FreeBSD is a reliable and highly secure server operating system. We look at how FreeBSD fares as a desktop system.

FreeBSD has been around since 1993 and enjoys an excellent reputation, especially in the server sector. The system is based on the Berkeley Software Distribution (BSD), a Unix-style operating system whose origins go back to 1977. Numerous BSD variants, such as TrueOS (the former PC-BSD), Dragonfly BSD, or GhostBSD, make the scene just as confusing as the Linux world.

With the exception of TrueOS and GhostBSD, BSD derivatives don't focus on the desktop but on servers, storage appliances, routers, and firewalls. However, mainline BSD variants like FreeBSD have extensive software repositories with plenty of desktop tools if you're ready to look for them. We decided to explore the possibility of setting up a desktop system on FreeBSD.


FreeBSD is available as an ISO image for various computer architectures. Whether you are using a traditional Intel computer, a Raspberry Pi, a PowerPC system, or a Sparc workstation, you'll find a version of FreeBSD for your hardware at the project site [1].

After downloading the right image for your application, burn it onto an optical disc or transfer it to a memory stick. For example, on Linux, you can use the dd command (see Listing 1). Please be sure to replace the drive name sdX with the correct drive for your system.

Listing 1

Burning the Image


Then boot your computer from the newly created removable disc. FreeBSD will soon provide you with a simple boot manager, where you can choose to reboot or to run the system in multiuser or single-user mode. In addition, there is an option to switch to the prompt. If FreeBSD does not show the boot manager, you may be asked to check the list of compatible hardware, which usually means that a hardware component is not supported.

By default, FreeBSD starts in multiuser mode from the boot manager, and shortly afterwards, you will see an Ncurses dialog asking if you want to start a Live operating system or install right away. If you opt for Live mode, a login prompt immediately appears, and you can log on as root without password. You are taken back to the prompt again without a graphical user interface launching. Live mode is thus not suitable for beginners and users who prefer a graphical desktop.

Static installation on a test partition is easier. Select the option for static installation. FreeBSD then calls the default Bsdinstall installer, which installs the system on your storage device in just a few steps. Since the BSD derivative uses a US keyboard layout by default, you may want to change the keyboard layout to suit your needs. Select one of the options and confirm by pressing Select. You then have the option of specifying a host name and importing optional system components of the BSD derivative via a selection window (Figure 1).

Figure 1: The FreeBSD installation takes place completely in text mode.

The default selection is usually for newcomers; you can thus move on to the next step, which involves partitioning the mass storage media, without making any adjustments. FreeBSD supports UFS and ZFS as native filesystems – both are firmly anchored in the Unix world and are primarily used in professional environments.

UFS2 is FreeBSD's default filesystem, while the sophisticated ZFS seems over the top for desktop systems. If the entire mass storage device is available for a complete reinstallation, you can tell the installer to perform automatic partitioning. In this case, the system creates a UFS2 root partition and a swap partition. If there are already other operating systems on the hard disk, the installer identifies them and supports manual partitioning.

Please note the completely different nomenclature of the drive names compared to Linux: The first hard disk or SSD under FreeBSD has a drive name of ada0; the other mass storage devices are counted in ascending order. Each partition is preceded by p and numbered in ascending order after the drive name. For example, the first partition on the first drive is ada0p1. When partitioning is complete, the installer copies the operating system to the mass storage device (Figure 2).

Figure 2: When partitioning is complete, the copy process begins. A progress bar marks the progress.

Enter a new password at the prompt for the root user. When you get to the configuration dialog, first enable network access and set the date and time. The routine will then branch to a dialog where you can select the system services that you want FreeBSD to launch automatically at boot time.

In another Ncurses window, you then compile a list of various security options that serve to harden the operating system against attacks. The configuration dialog then takes you through the process of creating new users and entering their authentication credentials. The installer asks for further optional information, such as the new users' membership in groups and the associated home directories (Figure 3).

Figure 3: All configuration work, including creating new users, takes place in the terminal.

In the Final Configuration window, you will find all previous configuration dialogs again. If you want to modify the configuration, activate the dialog with the arrow keys. When all changes are complete, you return to the Final Configuration screen. Use the Exit option to reboot from the newly installed mass storage device.

First Launch

The system first opens the same boot loader as on the installation disc and starts multiuser operation if you do not select any of the options offered. You'll soon reach a login prompt where you can log in as the root user. Now you can install a graphical user interface. The Ports Collection provides a variety of desktop environments for this purpose.

First you have to install the X11 server. At the prompt, type pkg install xorg (Listing 2, Line 1). Since no package management tool is installed as yet, the routine first asks if it should download and configure a package manager; you will want to say yes. FreeBSD then collects files for the missing package manager from the repository servers and installs them.

Listing 2

Setting Up X11


The routine then downloads the complete X11 system, including the matching fonts, and installs it on your mass storage device. Next, at the prompt, add the users previously created in the system to the groups video and wheel using the commands from Listing 2, Lines 3 and 4. Then open the Vi text editor at the prompt and edit the /etc/rc.conf file (Line 5).

/etc/rc.conf is where you need to add the dbus_enable="YES" line (see the box entitled "Editors"). The pkg install desktop_name command lets you install the desired desktop environment on the system [2]. For example, to install XFCE, the command line is pkg install xfce (Line 7). At another prompt, the program lists the number of packages required for the desktop environment and their space requirements. The installer will then ask you if you really want to install these packages, which you can do by pressing [Y].


FreeBSD installs the Vi editor by default, but using this editor can be a little overwhelming for newcomers. As an alternative to Vi, you can also use the package manager to install a friendlier editor such as Nano. The package is named after the program, so the installation just requires you to type pkg install nano.

Now you have installed both the X11 server and a desktop environment. To ensure that they launch when the startx command is entered, create a suitable .xinitrc (Listing 2, line 8) at the prompt in the last step. Now you can load the desktop by entering startx together with the desktop environment.

If the X server does not start as expected but is closed with a note to the effect that a D-Bus UUID is missing, you need to enter the dbus-uuidgen --ensure command at the prompt. The X server and desktop environment will then launch correctly.

Manual Work

FreeBSD is designed primarily for server systems, and it lacks many tools to set up the system on the desktop. Since the hardware detection and driver support for desktop systems also leave much to be desired [3], FreeBSD requires more manual work than most current Linux distributions if you want to use the operating system productively with a graphical user interface.

The graphical configuration tools of the working environments are available after the basic installation, but some of them only work in a limited way. In many cases, the system does not fully detect graphics cards and often offers only rudimentary display settings on the desktop [4]. For XFCE 4.12, only the SVGA and XGA resolutions were available in our lab (Figure 4).

Figure 4: Due to missing hardware detection, FreeBSD severely limits the resolutions available for some graphics cards and monitors.

In order to adapt the system to the graphics hardware and output devices, you either need to set the appropriate video modes via the xrandr program or modify various X server configuration files directly by hand to reflect the installed hardware. You can also perform these tasks in the terminal.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Going Places

    As the FreeBSD Foundation approaches its 20th anniversary, we talk to its top brass about the project's growing visibility in the open source ecosystem.

  • This Month's DVD

    FreeBSD 12.0 and Ubuntu MATE 18.10

  • This Month's DVD

    FreeBSD 12.2 and GhostBSD

  • Free Software Projects

    Free software covers such a diverse range of utilities, applications, and other assorted projects that it can be hard to find the perfect tool. We pick the best of the bunch. This month we look at IPodder, FreeBSD 6, and SynCE.

  • This Month's DVD

    Linux Mint MATE 20.3 and FreeBSD 13.1

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More