Configuring X window and desktop environments on FreeBSD 6.2

by Forrest Sheng Bao

The purpose of this article is to provide a short how-to to those who do not want to read the long FreeBSD handbook.

I will assume that your graphic interface card can work well with FreeBSD and the driver program runs ok now. So I skip the process about installing graphic card driver.

To use a desktop environment, such as GNOME or KDE, you need to let X server run first. X server requires a configuration file to initialize it. The configuration file of X server is named as xorg.conf and is located at /etc/X11/xorg or /usr/X11R6/etc/X11/.

You may copy the xorg.conf file from the Linux system that you run on the same computer, located in


FreeBSD also provides a program to generate the xorg.conf automatically. As the super user, simply run:
Xorg -configure

This will generate an X11 configuration skeleton file in your home directory called
To test whether you have set it correctly, you can use
Xorg -config /path/to/your/xorg.conf

For example,
Xorg -config
Maybe you will need to manually modify some parts of the auto-generated configuration file. On my workstation, I have to edit the Screen section. I need to add the
"Defaultdepth 24" and "Modes" 1289x1024
lines into that section.If you can see the display and you can move your mouse, it generally means the configuration is correct. After that, please copy the file to /etc/X11/ or /usr/X11R6/etc/X11. Remember to rename it as xorg.conf.

To leave the test screen, press Ctrl+Alt+F1.(Or any F-n that correspond to your original login console.)

Once the X can work, you can go on to your desktop environment. Please make sure that you have installed your preferred desktop environment. You can install them use sysinstall or install them from port collections.

There are two ways to start a desktop environment. One is to associate it will the X starting script. The other is to configure it in the ttys configuration files. To most users, they should choose the later option which will start the desktop environment automatically when the computer starts.

If your default run-level is not graphics but command-line, which means you like to start X when you need it not automatially, you can choose the first option.

To make GNOME as the environment, run

echo "/usr/local/bin/gnome-session" > ~/.xinitrc

To make KDE as the environment, run
echo "exec startkde" > ~/.xinitrc

When typing startx on the shell prompt, the specified desktop environment will be started as X starts.
(You can also try kdm on the shell prompt to start KDE directly.)
If you prefer the GUI to be started automatically when the computer finish booting, you can choose the second option, configuring the /etc/ttys file.

Go to the line starts with ttyv8. You may find it like this:

ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure

Comment this line if it exists. (Or if you prefer the default XDM, leave it along and don't operate as following instructions.

Insert this line, if you prefer KDE:

ttyv8 "/usr/local/bin/kdm -nodaemon" xterm on secure
It sounds like no that easy way to start GNOME when the computer starts. But you can start gnome-related programs by editing /etc/rc.conf and adding the line

Then choose GNOME as the session when you are facing the KDE login window. Make sure you have set KDE as ttyv8 at /etc/ttys if you wanna start GNOME in this way.

FreeBSD GNOME Project: GNOME 2.18 FAQ,

Chapter 5 The X Window System, FreeBSD Handbook,

KDE on FreeBSD FAQs,

1 comment:

Anonymous said...