Tutorial: Install Gnome Desktop and Gnome Display Manager on OpenBSD 4.8

Tutorial: Install Gnome Desktop and Gnome Display Manager on OpenBSD 4.8

Installing Gnome in OpenBSD 4.8

Notice

This document is aimed at people willing to install the official Gnome package on a fresh and default install of OpenBSD 4.8.

While several other documents exist, I didn’t find one with all the necessary steps. I somehow managed to make it work, so I would like to share this experience with you, if it can make you avoid some hassles.

This document tries to be as precise and accurate as possible. However it may not be perfect, and it is of course possible that it does not work in your configuration. It worked with mine, but your comments, corrections and suggestions are welcome, and this document will be updated accordingly.

This tutorial is quite similar to the previous one. As some users had problems installing 4.8 using my tutorial, I will try to add more details and explanations.

We will pass from this :

FVWM, OpenBSD default window manager

FVWM, OpenBSD default window manager

To this:

Gnome 2.30 about window on OpenBSD 4.8

Gnome 2.30 about window on OpenBSD 4.8

What is the interest to install Gnome on an OpenBSD system ?

Well the interest is only valid if you plan to make a workstation of OpenBSD (servers don’t need it). As you are reading this article, you are most probably already convinced of the benefits of Gnome. However, if comparing the two previous screenshots didn’t convinced you yet, there are several advantages to install Gnome on top of OpenBSD for a workstation:

  • A workstation should be responsive
  • A workstation should not be bloated with unused applications
  • A workstation should be secure
  • A workstation should be stable
  • A workstation should be simple
  • A workstation should be user-friendly
  • A workstation should be easy to maintain and upgrade

OpenBSD + Gnome can do just that. More, OpenBSD permits to install a recent operating system on machines you’d think they are outdated. 128MB of RAM and 4GB of hard disk space should be enough for OpenBSD+Gnome.

If you are not convinced, you can have a look at the following screenshot concerning OpenBSD memory usage after I booted:

OpenBSD 4.8 Memory usage

OpenBSD 4.8 Memory usage

That’s right! OpenBSD just uses about 70 MB of RAM with Gnome! And that’s even a lot for an OpenBSD system.

Ready? Let’s go!

After a fresh default install of OpenBSD 4.8  (read this if you don’t know how to install it), open a terminal (xterm by default).

First, make sure that you are in your home directory :

$ pwd

It should display /home/your_user_name/. If not, cd to your home directory.

Then become root :

$ cd ~your_user_name
$ su
OpenBSD xterm

OpenBSD xterm

Note: I advise you create a cache for the downloaded packages (specify a location with sufficient free space, 2.5 GB will not be too much) for easy and fast re-installation in case something goes wrong. To create the cache directory, type the following command :

# mkdir /path_to_your_pkg_cache

Then set and export the PKG_CACHE environment variable :

# export PKG_CACHE=/path_to_your_pkg_cache/

You can install the nano text editor for a convenient editing of config files (optional step, you can use vi if you prefer) and set the nowrap mode to avoid the automatic creation of new lines, which is an undesirable behavior:

# pkg_add http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/nano-2.2.4.tgz
# echo 'set nowrap' > /root/.nanorc
# exit
$ echo 'set nowrap' > .nanorc
$
Note:
If you are new to OpenBSD, the pkg_add command is used to install a package into your system. If you come from Linux, you probably know some commands such as apt-get, aptitude, emerge, etc. 

Its most useful arguments are -v, -vv, -vvv, -vvvv, -vvvvv which represent the verbosity level of the command output; -i which enables the interactive mode; the path to the package comes last.Let met also explain briefly the uname command.

In the previous pkg_add line, I used uname -r and uname -m. The first will output the version of OpenBSD (4.8 in my case) and the second command outputs the architecture (amd64 in my case).
For more detailed informations about these commands, do not hesitate to use the man command with the command name in argument.

You can use another URL for the pkg_add line, if you find that another mirror is faster.

Now we should set the PKG_PATH environment variable so that the pkg_add command knows where to search for the packages and to save us from typing the full mirror URL at each command. This is done in the .profile file located in your home directory :

$ nano .profile

Append/modify the following lines :

PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
ALT_PKG_PATH=http://ftp.chg.ru/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
PKG_CACHE=/path_to_your_pkg_cache/
export PKG_PATH ALT_PKG_PATH PKG_CACHE
Note:
Take extra-care to specify two different and fast mirrors if you don’t want to wait two days at each pkg_add command…

CTRL+X, Yes, Enter will save the file and close nano.

Let’s do the same for the root account :

$ su
# nano /root/.profile

Append/modify the following lines :

PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
ALT_PKG_PATH=http://ftp.chg.ru/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
PKG_CACHE=/path_to_your_pkg_cache/
export PKG_PATH ALT_PKG_PATH PKG_CACHE

CTRL+X, Yes, Enter will save the file and close nano.

Reboot :

# reboot

In addition, you may type the 8 previous lines directly in the terminal if you don’t want to reboot now, so that the environment variables are updated. After reboot, you can check by typing the following commands :

$ echo $PKG_PATH
$ echo $ALT_PKG_PATH
$ echo $PKG_CACHE
$ su
# echo $PKG_PATH
# echo $ALT_PKG_PATH
# echo $PKG_CACHE
Checking the environment variables

Checking the environment variables

Note:
Following the suggestion of Peter Ljung in his comment, please note that it is not compulsory to add the version number and the file extension of the package in your pkg_add lines. 

I always specify the full package path because my connection is slow and this way pkg_add does not have to search for the correct version number. When you don’t add the version number, pkg_add will download the full package listing, which can consume a lot of time if you are on a slow connection, especially if the package you are installing has a lot of dependencies.

For example, the following pkg_add lines are also valid if you want to install nano. If PKG_PATH is not yet set:

# pkg_add http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/nano

If PKG_PATH is already set, you can simply type :

# pkg_add nano

I guess that you now feel the interest of setting PKG_PATH, don’t you ? 🙂

If you want to know the full package filename, just go to the packages root path and note the full filename of the package. In my case I had to go to http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/amd64/. You have to go to the right packages root path related to your architecture and OpenBSD version.

The environment is now ready for Gnome. Here is the command to install Gnome itself :

# pkg_add -i -vv gnome-session-2.30.2p3.tgz

Then wait possibly few hours if you are on a slow connection like me… Or a few minutes if you have a fast Internet connection.

At this point, your $PKG_CACHE directory should contain at least the following packages:

Installed packages after the installation of gnome-session

Installed packages after the installation of gnome-session

Done ? Let’s continue with the installation of the Gnome Display Manager (gdm):

# pkg_add -i -vv gdm-2.20.11p1.tgz

At this point, your $PKG_CACHE directory should now contain:

Installed packages after the installation of GDM

Installed packages after the installation of GDM

Next, we have to edit a configuration file that will start GDM after a successful boot.

# nano /etc/rc.local

Append/modify the following lines in /etc/rc.local:

if [ -x /usr/local/sbin/gdm ]; then
echo -n ' gdm'; (sleep 5; /usr/local/sbin/gdm) &
fi

CTRL+X, Yes, Enter will save the file and close nano.

You probably want to start Gnome Desktop automatically at startup and use the Gnome login screen.  If yes, type the following commands:

# echo 'exec gnome-session' > /root/.xinitrc
# chmod +x /root/.xinitrc
# exit
$ echo 'exec gnome-session' > .xinitrc
$ chmod +x .xinitrc
Gnome login screen

Gnome login screen

Note:
At this point, if you restart, you may be able to see the Gnome login screen, although there are high chances that you will still restart in xdm and FVWM. But don’t restart now because we are not done yet. 

There are still some missing important packages to install  : metacity, gnome-panel and nautilus. Without them, you will not be able to do much things but watching the default Gnome wallpaper (except if you like empty screens)…

So let’s install the missing packages.

Note:
If some choice between libraries are to be made, just choose the first one by typing 0 validated by Enter.
su
# pkg_add -i -vv metacity-2.30.1p1.tgz
# pkg_add -i -vv gnome-panel-2.30.2p2.tgz
# pkg_add -i -vv nautilus-2.30.1p2.tgz

There are good chances that if you reboot, xdm is still started, and/or the FVWM window manager is still displaying instead of Gnome Desktop. So do the following :

# nano /etc/rc.conf.local

Append/modify the following lines :

xdm_flags=NO
gnome_enable=YES
gdm_enable=YES

If you want, you can now start Gnome by rebooting or typing:


$ startx

(you don’t need to be root)

Note:
Be sure to select Gnome Desktop at the Gnome login screen, and to set it as the default one when asked ! If you missed it, you still can do it in the Gnome login screen by going in the menu Actions > Configure  login manager… and checking and choosing the default session in the General tab. If you cannot use your keyboard in the Gnome login screen, see the Troubleshooting section.
Configure the login manager

Configure the login manager

Choosing the default session

Choosing the default session

At this point, Gnome should be able to start. However you don’t even have the gnome-terminal package installed, which is not very convenient to add some packages…

More, maybe the keyboard will not work and no title bars will be displayed, that is kind of an issue if you aim to produce a usable computer…

So I strongly advice you install some few packages to solve these issues.

Note:
You can still use the Gnome failsafe terminal from the Gnome login screen if you can’t get an access to xterm.
Starting Gnome failsafe terminal

Starting Gnome failsafe terminal

Installation of useful packages :

$ su
# pkg_add -i -vv gnome-terminal-2.30.2p0.tgz
# pkg_add -i -vv gnome-control-center-2.30.1p0.tgz
# pkg_add -i -vv gnome-menus-2.30.2p0.tgz
# pkg_add -i -vv gnome-settings-daemon-2.30.2p1.tgz
# pkg_add -i -vv gnome-themes-2.30.2.tgz
# pkg_add -i -vv gnome-themes-extras-2.22.0p8.tgz
# pkg_add -i -vv gnome-utils-2.30.0p0.tgz
# pkg_add -i -vv gnome-applets2-2.30.0p2.tgz
# pkg_add -i -vv gnome-system-monitor-2.28.1p3.tgz
# pkg_add -i -vv gnome-nettool-2.30.0p0.tgz
Note:
The PKG_PATH environment variable may not be set if you type this line from the Gnome failsafe console, so you can type the 8 lines concerning PKG_PATH before, or just type the full mirror url if unlike me you like to waste your time.

Finally, reboot and enjoy your Gnome !

# reboot

Gnome Desktop is now installed and running along with Gnome Window Manager on the most secure OS available. Nice, isn’t it ?

Finally you can customize your Gnome desktop, for example you may want to change the screen resolution, and use it as an OpenBSD workstation or whatever use you can find.

Some screenshot of Gnome Desktop 2.30 running on OpenBSD 4.8 for the pleasure :

Gnome 2.30 system menu

Gnome 2.30 system menu

Gnome Applications menu

Gnome Applications menu

Troubleshooting and FAQ

Q : My keyboard does not respond in the Gnome login screen, I can’t type my username and password !

A : It happened to me also. In the Gnome login screen, simply choose Actions > Remote login via XDMCP, then click Cancel once the remote login screen is loaded, you will return to the Gnome login screen and hopefully the keyboard will work ! (Or at least it worked for me)

 

Q : Why is your xterm window more beautiful than mine ?

A : Because I took the screenshot in a Gnome Desktop session. But is it important ?

 

Q : Why do you install Gnome on OpenBSD in the first place ?

A : And why not ? OpenBSD is the perfect candidate for a workstation machine : secure, stable, not bloated with 3000 widgets. Of course one wouldn’t work on a worskstation if it is not a minimum beautiful and convenient. Gnome is here to correct this problem. I have nothing against FVWM for a terminal station, but I definitely prefer Gnome as a workstation user interface.

 

Q : Do you plan to make a similar tutorial for KDE ?

A : No, I don’t plan to use KDE in its current version, not because it is bad (it’s good actually) but simply because I prefer Gnome.

 

Q : How to install OpenBSD ?

A : Get the iso, then just burn the install48.iso file to a CDR, reboot and press Enter a few times. Here it is, you just installed OpenBSD! For detailed informations, you can check this tutorial: http://www.gabsoftware.com/tips/tutorial-how-to-install-openbsd-4-8-step-by-step/.

 

Q : Is your document also valid for FreeBSD or NetBSD ?

A : I don’t know. Most probably not. But you can try and tell me your findings.

 

Finally

Here it is, this is the end of this document and I hope it will help someone as much as it would have helped me if I found it when I needed it !

Regards,

Gabriel Hautclocq

76 Responses

  1. kelvin patel says:

    hi,

    i m new for openBSD. i installed opneBSD 5.1
    now i want to install GNOME and other software on my laptop. i download pkg for GNOME mention by you and copy it to /home directory.
    now can you please guide me what to do next??

  2. kelvin patel says:

    Hi,
    I m new for OpenBSD. I install OpenBSD 5.1 in my system with dualboot with XP. can any one provide procedure to install Gnome 3 in OpenBSD 5.1
    Please help…

  3. tom says:

    getting problems with 5.3

    different gnome and such

    can you give some lights?

    thaks for the great job. used that to reach where i am now

  4. RB says:

    I followed your instructions carefully while installing OpenBSD 5.3 64-bit into Virtual Box, running on Ubuntu 13.04, and the Gnome desktop will not activate. The Gnome login window does not appear, and I have to login at the command line in terminal. I try using the startx commad, and it results in an error, and asks me to logout, which takes me back to the terminal.

  1. 9 February 2016

    […] Tutorial: Install Gnome Desktop and … – Installing Gnome in OpenBSD 4.8 Notice. This document is aimed at people willing to install the official Gnome package on a fresh and default install of … […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.