Call For Testing iXsystems TruNAS 2U Storage Appliance

Gnome 3 on OpenBSD 5.2

http://cft.lv/19

#Gnome #OpenBSD

January 31st, 2013

Version 1.0

© Michael Dexter

The best Gnome 3 experience on BSD can be found where you'd least expect it

It is no secret that I am becoming quite fond of PC-BSD: it is stabilizing nicely and offers a feature-rich BSD at one end and an amazing selection of window managers at the other. One thing it's missing however is Gnome 3. Love it or hate it, Gnome 3 is boldly exploring "modern" desktop territory with the Gnome Shell which aggressively provides both elegant eye candy and swift navigation. Surprisingly, the best place to experience Gnome 3 on BSD is perhaps where you would least expect it: OpenBSD

Jasper Lievisse Adriaanse has been very aggressive at keeping Gnome 3 up-to-date on OpenBSD as part of his work and we all get to benefit from his effort. Not only is he maintaining Gnome 3 on OpenBSD but he and his colleagues are also maintaining the suite of Gnome applications that includes things like the Nautilus file manager, Evolution e-mail client, Empathy chat client, gedit text editor, a scanning utility and most importantly, the Mahjongg tile game.

Clearly Gnome does not only run on GNU/Linux and if I am to fault the Gnome project for one thing, it is the fact that Gnome 3 requires hardware video acceleration for the Gnome Shell to work. Given the progress that basic hardware has made this few years, I suspect that a significant subset Gnome Shell would perform reasonably well in "gnome-fallback" mode if given a chance. The recent introductions of Intel's "Sandy Bridge" and "Ivy Bridge" graphics architectures have been very disruptive for non-proprietary operating systems and I hope the Gnome project will be a little more accommodating of the situation. Fortunately, "gnome-fallback" mode behaves largely like the familiar Gnome 2-style desktop and should be intuitive to any desktop computer user regardless of their previous experiences.

Getting Started

Installing Gnome 3 on OpenBSD will promptly remind you of the golden rule of using OpenBSD: read the fine manual. The last step of the installation process will provide you some simple yet very specific instructions to follow plus a cheat sheet that summarizes them. To ignore these instructions will bring only frustration but I will include the key points. It will not configure anything "automagically" and in the long run you will be very grateful for this. I have called OpenBSD a "what you see is what you get" project and operating system and considering the volatility of the alternatives, OpenBSD is a comforting pillar of stability in every regard.

Starting with a stock OpenBSD 5.2 amd64 installation with active networking, save yourself some grief by first determining if xorg will run and if you have graphics acceleration by running:

startx

This should give you a classic fvwm(1) session and in its terminal window you can run:

glxinfo | grep render

This will report your active video acceleration hardware, if available. You can exit out of xorg by left-clicking on the desktop and selecting "Exit", and confirming it.

Now, as root or a sudoer, set a package path for remote package retrieval:

export PKG_PATH=ftp://ftp5.usa.openbsd.org/pub/OpenBSD/5.2/packages/`machine -a`/

This can also be added to your ~/.profile with:

PATH=/sbin:/usr/sbin:/bin...
PKG_PATH=ftp://ftp5.usa.openbsd.org/pub/OpenBSD/5.2/packages/`machine -a`/
export PATH PKG_PATH

Many of the "gnome" packages offer you a few variations but selecting the defaults of "0" works fine for a basic installation. I chose "non-interactive" mode to auto-select the defaults during installation and choose a high level of verbosity in the progress output:

pkg_add -Ivvvv gnome

If successful, you will see all 273 packages in the "gnome" metapackage get installed and at the end of this process you will see a line:

"Look in /usr/local/share/doc/pkg-readmes for extra documentation."

Make a note of this location for the reason I mentioned.

While you are at it, I suggest you also considering adding the "gnome-extra" metapackage which includes more applications, games and integrated Samba tools for browsing CIFS networks for say, debugging FreeNAS configurations. For very multimedia desktop, consider:

pkg_add -Ivvvv gnome-extra gstreamer-plugins-ugly firefox chromium thunderbird gimp inkscape scribus audacity

"gstreamer-plugins-ugly" provides MP3 decoding support and if you're wondering about the name, it is from their "good, bad and ugly" classification of software which refers to the level of software freedom that each package provides.

With the software in place, it's time to follow the simple but specific instructions:

tail /usr/local/share/doc/pkg-readmes/gnome-3.4.2p7

As instructed by this readme, create or modify /etc/rc.conf.local with the following lines to enable the required daemons:

multicast_host=YES
pkg_scripts="${pkg_scripts} dbus_daemon avahi_daemon"

Then add this line to ~.xinitrc for each user that will launch Gnome:

exec /usr/local/bin/ck-launch-session /usr/local/bin/gnome-session

Launch these daemons by hand or by rebooting and you should be ready to start Gnome with simply:

startx

You should now see a beautiful blue-striped desktop and note that running wsmoused(8) will give you console mouse that will let you copy and paste text using the left and center/simultaneous mouse buttons.

With Gnome 3 running, you will see "Activities" in the top left menu in "gnome" mode and "Applications" in "gnome-fallback" mode. Type "ALT-F1" in either mode to get the Gnome Shell "overview" or to open the Applications menu. To launch a terminal in Gnome Shell, simply type "ALT-F1" and start typing "term" which should automatically suggest the Terminal application which you can launch with "Enter". "ALT-F2" will also allow you to enter a shell command directly.

Falling Back

My best experience of Gnome 3 with the Gnome Shell on OpenBSD is on a ThinkPad T61 with Intel 965GM graphics. All of my other systems work in "gnome-fallback" mode and exhibit various issues in "gnome" mode. Gnome will usually select the correct mode automatically if it encounters an issue but one of my video cards insisted on giving me what appears to be the "white screen of death" in which I could not access the screen in any useful way. Note that if you find yourself in a situation like this, you can type CTRL-ALT F2 to connect to the second virtual terminal where you can log in and kill the xinit process. This will save you having to power down the system and fsck(8) it on boot.

If both modes are working correctly, you can switch between them by mousing your way to the following settings panel and logging out and back in again:

System Settings: Details: Graphics: Forced Fallback Mode [ ON | OFF ]

If you do not have a working display, you can "get" and "set" the appropriate settings at the command line:

dbus-launch gsettings get org.gnome.desktop.session session-name

dbus-launch gsettings set org.gnome.desktop.session session-name gnome
dbus-launch gsettings set org.gnome.desktop.session session-name gnome-fallback

That's it! All of the standard Gnome documentation should help you from here and you can probably tell by now that I've spent the majority of my Unix time at the command line rather than in a window manager. It should also be obvious that I want to dogfood all of my presentations this year and want to make the most of OpenBSD, FreeBSD and hopefully other BSDs.

If you want to use the default OpenBSD window manager fvwm(1) once Gnome 3 is configured, simply run:

startx /usr/X11R6/bin/fvwm

If you find yourself in fvwm(1), you will notice a "(Re)Start" menu when you right-click on the desktop. Of the window managers listed, cwm(1) and twm(1) are included by default in OpenBSD. As with fvwm(1), you can simply launch these like we launched fvwm(1) in the above example, or switch into them once fvwm(1) is running.

Considering however that no Gnome discussion is complete without mention of its lighter-weight cousin XFCE, I thought I would try a simple experiment:

pkg_add -Ivvvv xfce

When finished, I simply ran:

startx /usr/local/bin/xfce4-session

This quickly loaded an elegant desktop with a cute mouse that could be considered somewhere between fvwm(1) and Gnome 3. Under it you should have full access all of the Gnome 3 applications you installed plus a few XFCE-specific ones like Thunar, a lighter-weight file manager.

While I find "xfce4-session" a rather unintuitive command, you can save some remembering and typing with the following shorthand for any of these additional window managers:

startx `which xfce4-session`

You could set up some aliases to launch the window manager of your choice or, while I wouldn't personally recommend it, use a graphical login manager like the built-in xdm(1), slim(1), gdm(1) or any of the countless others... until you understand why I prefer not go down this particular long, slippery slope.

Wrapping Up

When you do get a new window manager or two working, do send a copy of your dmesg to dmesg@openbsd.org and post it to the NYC*BUG dmesg database.

You can anonymize your MAC address with the following syntax:

dmesg | sed 's!..:..:..:..:..:..!xx:xx:xx:xx:xx:xx!g' > mydmesg.txt

CFT

Copyright © 2011 – 2013 Michael Dexter unless specified otherwise. Feedback and corrections welcome.