Saturday, December 22, 2007

Hack: Getting Audio to Work in VMware

Ubuntu is my Linux distro of choice, and due to the 6-month release schedule they're following, I reinstall everything on my machine -- at least -- twice every year. I know it's painful, but I just don't believe in upgrades. This is in part due to an incident where upgrading left my system in limbo, and in part due to that false feeling that everything is going to work just right if you opt for a fresh install....Ahh!

Usually, I have to do a LOT of tweaks after installation, and since I don't keep a list of these modifications (or even how to apply the complicated ones), I tend to forget many of them, which leads to a lot of wasted time digging up information which I had already known but that has gone into oblivion. That's why I decided to document them here, for all the selfish reasons mentioned, and in case they're of any use to other miserable souls...

Ever started a VMware virtual machine hosted on Ubuntu just to be greeted by a dialog box telling you that sound won't be available because /dev/dsp is busy? This is because VMware uses OSS for audio output, which isn't going to work while ALSA (Ubuntu's default) is controlling the audio device. The solution is to use a wrapper (or adapter) that plugs VMware's output into ALSA instead of directly into the audio device. Here are the steps to do that:

1. Install alsa-oss:

apt-get install alsa-oss

2. Wrap the vmware-vmx binary in a script that preloads libaoss:

mv /usr/lib/vmware-server/bin/vmware-vmx /usr/lib/vmware-server/bin/vmware-vmx.original

echo -e '#!/bin/sh\n\nLD_PRELOAD=libaoss.so exec /usr/lib/vmware-server/bin/vmware-vmx.original "$@"' > /usr/lib/vmware-server/bin/vmware-vmx

chmod u=rwxs,g=rx,o=rx /usr/lib/vmware-server/bin/vmware-vmx


This was tested on the following configurations:
  • Ubuntu Feisty 7.04 + VMware Server 1.0.2/3
  • Ubuntu Gutsy 7.10 + VMware Server 1.0.4


Source: HOWTO: Solve VMWare sound (mixing?) problem once and for all

1 comments:

Steve said...

Reinstall twice a year? Ouch. I've had trouble multiple times with Ubuntu upgrades, so I know how you feel. The solution? Ever since I switched to Debian unstable, I've been much happier. No upgrades, ever, and I'm always running the latest version of everything. Maybe once a year a program I use is broken since unstable's so bleeding edge, but I've found unstable to be more stable than Ubuntu. I encourage you to give it a try.