Sound in Ubuntu Server 9.10 Karmic Koala

I've recently attached my previously headless Ubuntu server to a TV - so it's purpose has morphed to be a server plus a media centre. I've installed Fluxbox, a minimal window manager for X. It means there's a GUI for the server for playing videos and maybe even youtube videos (if the old video card in the server can handle it).

All the extra software is available through the Ubuntu repositories. Installing fluxbox was not too difficult, although there were some problems getting everything required to run a GUI. It is quite configurable, but I haven't gotten around it that just yet. The default set-up is usable. Then just add Midori for web browsing and VLC for video.

Getting the wireless connection and sound to work was quite tricky. For wireless, I had a D-Link DWL-G122 802.11g Adapter available. The driver worked without any troubles, and I found wpa_supplicant the easiest way to set up the wireless. The two most important places to look when doing this are /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf. These were some of the most helpful pages:

Getting sound was a bit of a struggle. First of all, don't try making sound work in the 2.6.31-20 Linux kernel. It just doesn't. If you don't trust me, have a look around the web - people are finding problems everywhere. Next, it helps to have speakers plugged in (to the correct output jack) and turned on. Then check the volume in Linux. And the volume in the application.

For sound troubles, the best resource was this Comprehensive Sound Problem Solutions Guide. Since PulseAudio is the default Ubuntu sound server now, the documentation pages can be a real help.

Some of the most useful commands and files I found were:

command line volume control
less /proc/asound/modules
List the available/known sound cards.
ps ax | grep pulseaudio
Check if PulseAudio is running (there might be a entry for the grep command itself - ignore that).
pulseaudio -k
Kill any running pulseaudio server
pulseaudio -D
Start pulseaudio as a deamon (in the background)
ALSA config file in Ubuntu.
Sound card config file in Ubuntu.
Use this command to play a test sound. Very useful to see if anything is actually happening.