LJ Archive

Configuring Your Laptop for GNOME and Sound

Jay Docherty

Issue #0, linuxjournal.com

In part 3 of his series on Linux and the laptop, Jay explains how to get GNOME configured, sound modules working and its appearance changed.

If you followed my tutorial, “Setting Up a Base Linux Install on a Laptop”, you should have a base Linux install up and running Window Maker, Debian's default window manager. Although Window Maker is useful, I find the feature-rich environments of GNOME and KDE to be more useful in a desktop/laptop configuration. In this article I'm going to discuss how to further configure your Debian laptop with GNOME 2.2 and enable sound using the basic modules that come stock with the 2.4 kernel.

Installing GNOME 2.2

Let us start by installing GNOME 2.2. There are multiple ways to install it, but really only one way is viable for a Debian user. All that you have to do is run apt-get install gnome-core. Debian's apt-get system goes out to the Sid repositories listed in /etc/apt/source.list and downloads Debian's latest build of GNOME and all of its many required packages. This automation saves you tons of time. Although I have found a couple of missing packages here and there, the convenience of an apt-get install by far outweighs the downside of compiling it from source. Using apt-get, the entire process takes a matter of minutes; if you were to do a source compile from scratch it could take you hours. For those of you who need to have the absolutely newest build of GNOME, you're stuck with a source install. Fortunately, a utility called Gargnome can assist you with a source compile. Although Gargnome is no apt-get, it is a heck of a lot better then messing with each individual package.

Once apt-get has finished installing GNOME, you need to change the default window manager from Window Maker to Metacity. If Metacity is not made the default default window manager, GNOME does not work correctly; windows and menus pop up in funny spots and its overall appearance is a mess. To change the default window manager run update-alternatives --config x-window-manager. This lists all of the available window managers available on your system and allows you to pick which one should be the default. After you have made the selection, run startx and prepare for the amazement of what is known as GNOME 2.2.

Initial Sound Setup

The first time GNOME 2.2 runs, you will receive errors about xscreensaver being missing and /dev/sound/mixer not existing. apt-get install xscreensaver fixes the screensaver error. The mixer popup occurs when you have yet to configure sound support. Due to the wide variety of available embedded chipsets, there is no way I can go through every variation in this article. What I can do is go through configuring one of the more popular sound chipsets, the i810. In my next article I'm going to explain how to set up the Alsa modules, which offer a more standardized configuration. If you don't want to wait, here's some direction to get your sound cranking using the stock kernel modules:

1. Compile the kernel with support for the i810 chipset. Here's the settings to be made for the 2.4 kernel:

Sound card support

  • Intel ICH (i8xx)

  • OSS sound modules

    • Verbose initialization

    • Persistent DMA buffers

    • Crystal CS4232 based (PnP) cards

2. After you recompile the kernel to incorporate the changes made in the previous step, the sound-oriented modules are created. We need to load two of them, i810_audio and ac97_codec. If you want to load the modules by hand you could run insmod $module_name. Or, to have the system load them at boot time, add them both to /etc/modules. In addition, for i810_audio to load properly, ac97_codec must be loaded first.

3. Add the following lines to /etc/modules/aliases. This step is dependent on your sound card; for the i810 you should add these to the bottom of the file:

        alias sound-slot-0                                 i810_audio
        alias sound-service-0-0                i810_audio
        alias sound-slot-2                           off
        alias sound-service-0-2                off
        alias sound-slot-3                           i810_audio
        alias sound-service-0-3                i810_audio
        alias sound-slot-4                           i810_audio
        alias sound-service-0-4                i810_audio

4. Run update-modules

5. Create a group called audio, and add to it all users that are to implement sound. Make sure that /dev/dsp belongs to the audio group as well.

If all went correctly, after a reboot you should have sound in GNOME. A good way to test this is to try to play a music CD. This will avoid any possible problems you may be having with ESD, GNOME's sound dæmon. Which brings us to one of the problems I found to be an outcome of apt-getting GNOME 2.2, in regards to missing packages. Four multimedia related packages are missing: esound, esound-clients, gnome-audio and gstreamer-plugins. If you want to use your machine for any type of multimedia, you should apt-get these packages yourself. This may not necessarily be a problem with the install itself, because not all GNOME 2.2 users are interested in sound. But, if you don't specifically know to install them, it can be difficult to troubleshoot the cause of the resulting problems.

Scroll Mouse Fun

Although trackpoints and touchpads are useful, there can be times when the accuracy and swift abilities of a traditional mouse can't be matched. If you plan on doing any graphics editing or game playing on your laptop, you will be much better off if you have an external mouse in your laptop bag. Typically your trackpoint/touchpad is detected as a PS2 device, leaving USB ports as the most convenient interface for an external mouse. The hardest part of getting a USB mouse to work involves the kernel compile. In my experience, USB modules can be finicky to make function properly. I should add that before you start configuring a mouse, you should get an idea if all of its features are supported by Linux. For example, I know some of HP's and Compaq's rebranded Logitech mice are not fully supported. With that said, here are the USB options I had to set on my IBM Thinkpad R32:

Input core support

  • Keyboard support

  • Mouse support

  • (1024) Horizontal screen resolution

  • (768) Vertical screen resolution

Support for USB

  • Preliminary USB device filesystem

  • UHCI Alternate Driver (JE) support

  • USB HIDBP Mouse (basic) support

On a Dell Inspiron 8200, I set these options:

Input core support

  • Keyboard support

  • Mouse support

  • (1600) Horizontal screen resolution

  • (1200) Vertical screen resolution

Support for USB

  • Preliminary USB device filesystem

  • UHCI Alternate Driver (JE) support

  • USB Human Interface Device (full HID) support

If everything is in check with your kernel support, you then plug in the device. You should see a message similar to the following in the console or through dmesg:

hub.c: new USB device 00:1d.1-1, assigned address 3
input0:  USB Mouse on usb2:3.0

Upon unplugging the device you should see:

usb.c: USB disconnect on device 00:1d.1-1 address 3

These messages can be misleading, though. For example, on my Thinkpad I originally compiled the kernel using full HID support. When I plugged in a device, all the appropriate messages were displayed, but for some reason no input ever made it to my apps. When I switched my HID support driver to USB HIDBP, everything worked properly. So keep that in mind when reviewing the console messages. They are your first line of attack when troubleshooting a problem, but they are not the be all and end all of accurate USB reporting.

If all went well, then your mouse should be detected properly by the kernel. Which leads us to configuring X to see your external mouse. If you have been following this tutorial from part 1, you should be using X version 4.2.x, so my config snippets are from the file /etc/X11/XF86Config-4. In this example I was able to get my Razor Boomslang functioning perfectly. In your XF86Config-4 file, you should see an entry for your existing PS2 interface. The entry looks something like this:

Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver            "mouse"
        Option          "Device"                "/dev/psaux"
        Option          "Protocol"              "PS/2"
        Option          "Emulate3Buttons"       "true"
        Option          "ZAxisMapping"          "4 5"
EndSection

For my Boomslang I added the following entry below that for my Configured Mouse:

Section "InputDevice"
        Identifier      "Boomslang"
        Driver            "mouse"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "IMPS/2"
        Option          "ZAxisMapping"          "4 5"
EndSection

Some entries in the SeverLayout section also need to manipulated; you need to edit one line and add another line. The line to edit is:

InputDevice     "Configured Mouse"

You need to add CorePointer to the end of the line, so it looks like:

InputDevice     "Configured Mouse"      "CorePointer"

This line sets your primary device to that of your Configured Mouse, which should be the trackpoint/touchpad. So, no matter what other interfaces are plugged in or not plugged in, the system accepts input from that device.

Secondly, you need to add this line to the bottom of the “ServerLayout” section:

InputDevice     "Boomslang"             "SendCoreEvents"

This tells X to expect input from the Boomslang but not to use it as the primary device. With this configuration you can use your USB mouse and not have to worry about rebooting or changing config files when switching back to the trackpoint/touchpad. The transition between the two interfaces will be seamless.

Advanced Power Management

Advanced power management (APM) is the primary link a user has between his laptop and its power consumption. Due to APM's integration in the Linux kernel, there is little difficulty to get it running. All you need to do is compile your kernel with the APM support enabled, and you will have basic APM functionality. You must set the following options in the 2.4 kernel compile for APM:

  • Power Management support

  • Advanced Power Management BIOS support

At boot time APM reports as to what type of BIOS is detects. After the machine is booted you can verify APM is functioning correctly by running more /proc/apm. If this file does not exist, you have a problem.

Once APM is enabled, GNOME provides an extremely useful battery monitoring applet that you can add to the control panel. Right click on the panel, then go to Add to panel, then Utility and then click on Battery Charge Monitor. This utility if perfect for monitoring your battery; it tells you your power source and your charge level. If you want to use sleep and suspend, you can use this applet to kick it off. Due to the proprietary nature of enabling those features, I am not going to delve into explaining how to enable sleep and suspend. If you are looking to enable them, however, you will find your needs met by consulting a howto manual for setting up your exact laptop model. Such tutorials can be found here.

Fun with GDM

By default the current build of Sid comes with XDM installed for your X login needs. Although XDM was great in its day, it is bare bones when compared to the newer versions of GDM. XDM is more appropriate if you are running a server, whereas GDM offers more desktop, or in our case laptop, oriented features. The ability to shut off or restart the system is only one of GDM's many abilities. In a server environment, shutting off a system without logging in is a security nightmare. But, for a laptop this type of worry is trivial. A few of GDM's other advantages are: it can be configured on the fly without starting a window session; it has a lavish GUI where you can configure many aspects of it's appearance; and it enables you to manage multiple sessions. With GDM you even can manage remote sessions.

Unfortunately, the Sid repository does not currently have the latest version of GDM, 2.4; it offers the older, 2.2 version. In regards to laptop use, the big difference between these two version is the graphic greeter option. The graphical greeter provides a much more customizable (XML) theme-oriented environment. If you want to use GDM 2.4, you have to acquire it from an alternate source. A tool like this one can be used to find alternative download sources for GDM. After a source is found, you have a choice of apt-getting it or downloading it directly from a site for a manual dpkg install. I think you'll find the latter method to be faster than editing your apt-sources and updating. I was able to download the gdm_2.4.1.3-2_i386.deb package directly from this site, which I found through www.apt-get.org.

From the standpoint of the end user, the appearance of the graphical greeter is big plus, and it's pretty simple to enable and configure. When GDM is first installed, it defaults to using the standard greeter. To change this click on the System drop-down menu and select Configure. You will be asked to enter the system's root password and then presented with GDM's configuration window. To switch to graphical greeter mode, under the General tab, use the drop-down menu next to Local: to select graphical greeter. To configure it further, select the graphical greeter tab at the top of the window. From here you can add new themes or switch between existing ones.

To add a new theme, you must first download the .tar.gz file of your preferred theme. Such themes can be acquired at many web sites. A great place to start is art.gnome.org. Once you have downloaded the theme, you must go back into the configuration menu for GDM and click on the Install new theme button under the graphical greeter tab. This allows you to browse your system for a downloaded theme; it also uncompresses the tar.gz theme and installs it into the appropriate /usr/share/gdm/themes folder on your system. If you are familiar with XML, you can go into that folder manually and manipulate any theme. Each theme's primary configuration file resides in the directory by the theme's name and is named $themename.xml.

GNOME's Appearance

GNOME itself has many different aspects to alter in regard to visual appeal. Although some users may find this a far-from-critical area and not spend much time on it, it should not be overlooked. With proper customization, a machine running GNOME 2.2 easily can rival any Windows box in terms of eye candy and graphical convenience. There is an infinite number of different ways to customize your GNOME workspace. The three basic things any GNOME user can change without much hassle are the GTK+ 2.0 theme, Metacity theme and the Nautilus theme. According to the GNOME theme control panel, these three translate to controls, window border and icons, respectively.

Installing new controls and window boarder themes is a simple process. You can download new themes from many locations on the Web. My old standby for GNOME-oriented themes is art.gnome.org. Most themes can be downloaded as a tar.gz file. You can install them using the GNOME theme manager located in your Applications menu through Desktop Preferences, Themes. Once in the theme manager, use the Install Theme button to choose the theme element in question. This installer uncompresses it and installs the new theme element into the .themes directory underneath your home directory. Now, if you restart your GNOME session, you should see an option for the new theme element in the Themes panel.

A bug in GNOME 2.2.1 affects adding Nautilus themes with the Theme control panel. New icon themes are supposed to be copied into the .icons directory, but they actually are being copied to the .themes directory. As a result, after you restart the session your new icon theme is not available on the control panel. The fix for this is pretty simple: link the .icons directory to .themes.

ln -s ~/.themes ~/.icons

Another area of confusion is which themes should be downloaded to change the icons. At the art.gnome.org site you need to download the themes under the section Icon and not the themes under the section Nautilus. The easiest way to tell if a theme will work is, after you have installed it, look in its directory (~/.icons/$themename) for a file called index.theme. If the directory is missing index.theme, it's not going to work.

A Bright Future

The world of X GUIs has come a long way and is moving rapidly to whatever it is destined to become. GUI versions a mere year old seem outdated and uncomfortable when compared to what we have today. I attribute much of this progression to the healthy competition between Linux development and user communities. I don't think GNOME would be where it is today without KDE, and vice versa. Giving users a choice in their windowing environment is one of the many freedoms the Linux user base has come to embrace. So pick your GUI and enjoy!

email: jay@docherty.com

LJ Archive