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

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

Installing Gnome in OpenBSD 4.7

Notice

This document has been updated for OpenBSD 4.8: http://www.gabsoftware.com/tips/tutorial-install-gnome-desktop-and-gnome-display-manager-on-openbsd-4-8/.

This document is aimed at people willing to install the official Gnome package on a fresh and default install of OpenBSD 4.7. 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.

Gnome 2.28.2 on OpenBSD 4.7

Gnome 2.28.2 “about screen” on OpenBSD 4.7

Let’s go !

After a fresh default install of OpenBSD 4.7, open a terminal.

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 GB would 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

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 automatic creation of new lines:

pkg_add http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/nano-2.2.1.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. Its most useful arguments are -v, -vv, -vvv, -vvvv, -vvvvv which represent the verbosity level of the command output; -iwhich 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.7 in my case) and the second 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 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 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 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.

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

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. But for example, the following pkg_addlines 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 have to go to http://ftp.openbsd.org/pub/OpenBSD/4.7/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.28.0p7.tgz

Then wait possibly few hours if you are on a slow connection like me…

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

pkg_add -i -vv gdm-2.20.10p10.tgz
nano /etc/rc.local

Append 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 should be able to see at least the Gnome login screen. But don’t restart now.
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.28.0p0.tgz
pkg_add -i -vv gnome-panel-2.28.0p6.tgz
pkg_add -i -vv nautilus-2.28.4p0.tgz

You can now try to start Gnome by restarting or typing:

startx

(you don’t need to be root).
If the FVWM window manager is still displaying instead of Gnome Desktop, try the following :

nano /etc/rc.conf.local

Append the following lines :

gnome_enable=YES
gdm_enable=YES
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…
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 the following packages to solve these issues.

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

Starting Gnome failsafe terminal

Installation of useful packages :

su
pkg_add -i -vv gnome-terminal-2.28.2p0.tgz
pkg_add -i -vv gnome-control-center-2.28.1p1.tgz
pkg_add -i -vv gnome-menus-2.28.0.1p4.tgz
pkg_add -i -vv gnome-settings-daemon-2.28.1p1.tgz
pkg_add -i -vv gnome-themes-2.28.1p0.tgz
pkg_add -i -vv gnome-themes-extras-2.22.0p8.tgz
pkg_add -i -vv gnome-utils-2.28.1p0.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.

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.28 running on OpenBSD 4.7 for the pleasure :

Gnome System preferences menu

Gnome System preferences 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 install47.iso file to a CDR, reboot and press Enter a few times. Here it is, you just installed OpenBSD !

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 !

42 Responses

  1. Peter Ljung says:

    Great description!
    Just one question … Why are you using full package names with version number when installing packages? I always leave the version number out and that works as well. If you wan\’t to include the version maybe you could explain how to identify them for another version of OpenBSD.

    • You are right, version number isn’t needed and this way it can possibly work for another version of OpenBSD (to verify).
      But it is faster on a slow connection to specify the version number, otherwise it has to search for the correct version number.
      When I mean slow connection, I am in China with a bad ISP, so it is really slow, and it can make me win 2 or 3 minutes when I specify the version number.
      If your connection is fast then don’t bother with version numbers 🙂

    • And you are right I will explain how do I find the version numbers. I will update the article. Thank you for your suggestion !

    • Article updated accordingly 🙂

  2. TheThoth says:

    Thanks for the tutorial, I am a linux user but I am new to BSD. I am having a problem however. When I try to do this: pkg_add -i -vv gnome-session it starts but I get alot of stuff that says it cannot install because it cannot resolve dependencies. This happens when I run the next command too. Did I miss something in your tutorial?

    Thanks

    • Hi,

      1. Did you try from a fresh install of OpenBSD 4.7 ?
      2. Did you follow the tutorial step by step ?
      2. Could you post the error output ? If some dependencies are missing, you can install them, then continue where you left.

      Thank you for reading 🙂

  3. TheThoth says:

    Thanks, I am about to try it again with another fresh install. I just noticed an error in your tutorial (not related to my original problem) it is in this section:

    PGK_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)/
    PGK_CACHE=/path_to_your_pkg_cache/
    export PKG_PATH ALT_PKG_PATH PKG_CACHE

    I believe the first line should be PKG_PATH=http://ft……..

  4. Hi,

    You have good eyes, there was indeed a typo, which I copy pasted several times by the way. Thank you for reporting this, now corrected 🙂

  5. TheThoth says:

    Ok, I got it working now, I don’t know what happened on my first try, but all is well now and I have Gnome running. Thank you for the excellent tutorial!

  6. You are welcome, that’s great if my tutorial helped you in any way 🙂

  7. Great tutorial !

    I’m from Indonesia and new in OpenBSD.Your tutorial help me so much to install gnome.I run OpenBSD With 2G memory, 2 processors in Virtualbox with xeon machine. Maybe any specific configuration for OpenBSD’s kernel to run desktop (when boot process) ?

  8. @Michael : I’m glad this helped you !
    About a specific configuration for OpenBSD’s kernel to run desktop, I recommend to use the bsd.mp kernel which is optimized for multi processors configurations, as you said you have two processors.

  9. Yeah your idea is right. I will check my system and RTM about bsd.mp/kernel.Just suggest you to write next topic about gnome desktop 🙂 Many newbies want to know how to mount usb flashdisk, listen the music..etc with gnome on OpenBSD.

  10. Tom says:

    great tutorial
    thank you very much
    super complete and easy to follow

    i learned a lot
    now only misses the multimedia part.. 🙂
    thanks again. great job

  11. Frank says:

    Hi,

    Very helpful tutorial.

    After setting gnome_enable=YES and gdm_enable=YES, don’t forget to set xdm_flags to NO in /etc/rc.conf AND IN /etc/rc.conf.local. May be helpful.

    Thank you again.

    • Hi Frank,

      I’m glad this tutorial helped you!

      About gnome_enable=YES, I just had to set it in either /etc/rc.conf or /etc/rc.conf.local (forgot which one), because /etc/rc.conf.local will be loaded after /etc/rc.conf

  12. Jerome: Thank you for pointing this out! Corrected.

  13. vxcvxcv says:

    How can I separate this \”&lt;br /&gt;<br /> \”\”from really commands??? Why don\’t ya just put the simple lines in there inspite of this html scrap???

  14. Dave Tinney says:

    Here are the package names for OpenBSD 4.8:

    pkg_add http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/nano-2.2.1.tgz
    pkg_add -i -vv gnome-session-2.30.2p3.tgz
    pkg_add -i -vv gdm-2.20.11p1.tgz
    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
    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

  15. Dave Tinney says:

    oops, the nano package should be
    pkg_add http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/nano-2.2.4.tgz
    The rest of them are correct, and these instructions work for 4.8

  16. Ubaldo Arias Flores says:

    Hi!, first of all, let me thank you (Gabriel Hautclocq) for your great tutorial you wrote some time ago and you keep paying attention too, it helped me before and nowadays too.
    What it makes me post to all of you today, guys, is a little question and request related to the *BSD world.
    Could you please, or somebody else, write a similar tutorial or guide explaining the necesary steps (incluiding those needed for pkg configuration) to install, on a fresh and default install of DragonFlyBSD 2.8.2, Gnome Desktop and Gnome Display Manager?
    I have tried to accomplish that task since some time ago without succedd.
    I would appreciate you could help me.
    Thanks to all of you.
    Greetings from chile!
    Ubaldo Arias Flores.

    • Hi Ubaldo,

      First I would like to thank you for your comment, I’m really happy that someone found this tutorial useful !
      I don’t have any plan to migrate to DragonFlyBSD at the moment, so it’s unlikely that I write such a tutorial, but someone else is welcomed to do so. What is more likely to come is an update of this tutorial for OpenBSD 4.8 once I migrated.

      That said, DragonflyBSD seems to be an interesting project, especially concerning multi-threading and multi-processors machines, and it may be worth to give it a try one day 😉

      Best regards,
      Gabriel Hautclocq

  17. Ubaldo Arias Flores says:

    Gabriel!!, thanks a lot for answering!.
    As you wrote, it would be really nice and useful that somebody around here could post a tutorial like I am looking for, as I posted before, I have tried so many times to have a working desktop on DragonFly BSD without success that finally decided to post here in hope that somebody could have the answers or tutorial (installing-gnome-desktop-and-gnome-display-manager-on-dragonflybsd-2-2-2/) I want.
    Indeed DragonFlyBSD is an interesting project and option, especially, as you said, concerning multi-threading and multi-processors machines and besides, hammer filesystem =)
    Concerning what you said about OpenBSD 4.8, let me tell you that this same tutorial you wrote for OpenBSD 4.7 works perfectly in this new release. Only yesterday I made a fresh and default installation of OpenBSD 4.8 amd64 architecture, and everything was installed perfectly.

    Once again, thanks a lot for your answering!
    Greetings from Chile.
    Ubaldo Arias Flores.

  18. DarkGagan says:

    Hello guys! I made a fresh install of OpenBSD4.8 and follow your tutorial step by step, taped and verified every command (even after corrections) and despite of this I have some problems between xorg and gdm-gnome. My system boots on xorg (I have the basic GUI, not the gnome’s) and I must start gnome manually with “gnome-session” on a xterm. I can also run gnome more than one time, one per xorg desktop. I just want that after the default OpenBSD 4.8 install and then gnome and all the packages named in the tutorial and files modifications made my system nicely restart and gdm ask me the user/pw account and gnome starts automatically and all the xorg gui stuff makes place for gnome’s. So what are the mistakes I made? Is someone can help me? What do you need I can join you to solve the problems?

    • Hi,

      If you followed the commands specified in this tutorial (corrected for OpenBSD 4.8) then it should work…

      Especially the following part :


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

      Though I didn’t tested myself with Gnome 4.8, apparently it worked for others.

      Could you post all the commands you used in detail ?

    • Hi DarkGagan,

      Just did an install of OpenBSD 4.8.

      It appears that you are right, if you follow the tutorial Gnome-session cannot start properly because xdm is still started.

      Here is how to fix this :

      In your /etc/rc.conf.local you probably have :

      xdm_flags=
      gnome_enable=YES
      gdm_enable=YES
      

      Edit /etc/rc.conf.local and be sure that the 3 following lines are present :

      xdm_flags=NO
      gnome_enable=YES
      gdm_enable=YES
      

      The key is the “xdm_flags=NO” line.
      The /etc/rc script checks for “xdm_flags=NO”. If the value of xdm_flags is different than NO, xdm is started. By setting xdm_flags to NO, you prevent xdm and fvwm to start, allowing GDM and Gnome-session to start.

      Tell me if that solves your problem.

      I will update the tutorial shortly for OpenBSD 4.8

  19. Notes to all readers:

    This tutorial has been updated for OpenBSD 4.8 and Gnome 2.30. You can read it here: http://www.gabsoftware.com/tips/tutorial-install-gnome-desktop-and-gnome-display-manager-on-openbsd-4-8/

  20. DarkGagan says:

    Hi Gab,

    First a very big thank you for your very quick answers,

    Then I haven’t got enough time these days to test your new version but I’ll made it and give feedback on the 4.8 comments.

    Congratulations for your work!!!

    (and… cocorico! I’m french too but I use English to be better understood by others in the hope of what I wrote could be useful…)

  21. Ubaldo Arias Flores says:

    Hi guys, it is me again!,
    as I posted some days before, the tutorial you can read in this very post written by Gabriel works properly for OpenBSD 4.7 and OpenBSD 4.8 alike with no error and/or differences between them.
    The problem DarkGagan reported that he had about xdm comes apparently because the answer he musted gice during installation. Did you answer properly that question, the one that reads “Do you expect to run the X Window System? [yes] Enter” and “Do you want the X Window System to be started by xdm(1)? [no] Enter”……
    Take a look on that!!!
    Besides that, anything else would be the same as above. I have followed this same tutorial for both releases, OpenBSD 4.7 and 4.8.
    Greetings from Chile!
    Ubaldo Arias Flores.

    • Hi Ubaldo,

      Thank you for your feedback. The problem of DarkGagan is indeed caused by xdm being automatically started before gdm. By selecting “no” at the question “Do you want the X Window System to be started by xdm(1)?” you circumvent the problem because it will set xdm_flags to NO in /etc/rc.conf.local. If you choose “yes”, it will set xdm_flags to nothing and so xdm will start.

      If you chose “yes” at this question but want to use GDM afterward, you can still disable xdm by setting xdm_flags to NO, gdm_enable to YES and gnome_enable to YES in /etc/rc.conf.local as I said in my updated tutorial (http://www.gabsoftware.com/tips/tutorial-install-gnome-desktop-and-gnome-display-manager-on-openbsd-4-8/)

      So we now have two ways to solve this problem! 🙂

      Regards

  22. Erik Hurtig says:

    Hi there! Just wanted to tell you guys that you don’t have to reboot the system to update the environment variable set in the user profiles. Just log out and then log in again.

  23. That’s right, thank you for your feedback 🙂

  24. brian says:

    I just wanted to say thanks for an excellent tutorial! Used this to get GNOME working for 4.9

  25. Lars Nielsen says:

    I can tell that this work under OpenBSD 5.0 to

  26. kelvin says:

    Hi Gabriel,

    I just installed openBSD 5.1 and I am not able to install pkg gnome-session-3.2.1p9. I am getting error cant’t find gnome-session-3.2.1p9
    i download this pkg from ftp site and put it on /home/install directory. o/p of # echo $PKG_PATH is /home/install

    please help… need help

  27. Patrick says:

    Has anyone had any luck with Gnome 3.4.2 in OpenBSD 5.2
    I personally like the new Gnome desktop and use it on
    Fedora 17. However I would like to have it on my OpenBSD
    os as well. I have it installed and working but it appears
    as the old Gnome desktop environment. Any advice ?

    • Peter Ljung says:

      Yes, I have installed gnome on OpenBSD 5.2 on Virtual Box just to see that it works fine. I use XFCE on my laptop and didn’t want to install gnome as well.

      Just do “pkg_add gnome” and read the /usr/local/share/doc/pkg-readmes/gnome-*

      You need dbus and avahi to run it. Also xdm is preferred way to start it up. I think that gdm is removed from repository because of some problem.

      I made some short notes here.

      http://www.lounge.se/wiki2/show/GnomeInstallOnSolo

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.