VMware Communities
ritterwolf
Enthusiast
Enthusiast

VMWare PulseAudio HOWTO

Disclaimer: I accept no resposnsibility for any horrible things that happen to you, your computer, and those around you as a result of you following this HOWTO. It may cause you, or those around you, to get fired, kill your dog, insult your mother or make your computer explode and various other things that you might have thought impossible. You follow these instruction at your own risk.

I did this with Workstation 6.5 RC1 build 110068 on Ubuntu 8.04 64-bit.

With that out of the way, the instructions

1. shut down all your virtual machines

2. remove OSS emulation from ALSA, by adding the following lines to the bottom of /etc/modprobe.d/blacklist-oss

blacklist snd_pcm_oss

blacklist snd_mixer_oss

blacklist snd_seq_oss

3. unload those modules

$ sudo modprobe -r snd_pcm_oss

$ sudo modprobe -r snd_mixer_oss

$ sudo modprobe -r snd_seq_oss

4. we move the real vmware-vmx executable aside, and create a wrapper script

$ cd /usr/lib/vmware/bin

$ sudo mv vmware-vmx vmware-vmx.real

$ sudo touch vmware-vmx

edit this new vmware-vmx file in your favorite text editor, remembering to start is as root, eg 'sudo vim vmware-vmx'

        • start: vmware-vmx ----

#!/bin/bash

padsp $0.real "$@"

        • end: vmware-vmx ----

5. Now to set the required permissions on the wrapper script.

$ sudo chmod ax,us vmware-vmx

6. Now to set the permissions on the library used to send OSS calls to PulseAudio.

$ sudo chmod u+s /usr/lib/libpulsedsp.so

That's it!

I tested this by playing music out of rhythmbox, and logging into a Windows XP guest. When I heard that dreaded login sound, I knew it was all working.

If you get stuttering sound, do the following:

$ sudo adduser $USER pulse-access

$ sudo adduser $USER pulse-rt

and add the following lines to $HOME/.pulse/daemon.conf

-


start: daemon.conf

high-priority = yes

nice-level = -11

realtime-scheduling = yes

realtime-priority = 5

default-fragments = 8

default-fragment-size-msec = 5

resample-method = speex-float-3

-


end: daemon.conf

restart the daemon, and stuttering should be better. Try tuning the values in daemon.conf if there is still stuttering.

Reply
0 Kudos
26 Replies
sseremeth
Contributor
Contributor

Anyone get this working with vmplayer (on Ubuntu Hardy)? I'm having no luck.

Reply
0 Kudos
dowhurst
Contributor
Contributor

I did this with VMware 6.5.0 and Ubuntu 8.0.4.1 32bit exactly as described yet do not get sound. The guest WinXP is set to autodetect sound. No sound is detected. Pulsed is running so I've obviously got some difference going on here. 32 bit vs 64 bit should not make a difference based on your procedure. Not sure why padsp didn't provide the answer.

Thanks for your procedure though! It is a start.

Dow

Reply
0 Kudos
ritterwolf
Enthusiast
Enthusiast

Interesting. I only use 32-bitLinux in VMs, so I can't really help.The only thing I can suggest is rebooting to make sure there's no OSS compatibility in the kernel.

I've got it working with Workstation 6.5 final and Ubuntu 8.10 now, using those exact instructions.

Reply
0 Kudos
HNH90
Contributor
Contributor

Hi,

I think that you should set the sound card "/dev/dsp" manually on your virtual machine settings.

VMware WS can't detect the sound card after unloading the modules "snd_oss_*" because "/dev/dsp" is automatically deleted when these modules are unloaded on recent Linux distributions.

I got sound with VMware WS 6.5.0 and PulseAudio 0.9.8 in Fedora 8 on 32bit box after changing the setting to "/dev/dsp".

(I didn't get sound with "Auto Detect". )

Reply
0 Kudos
Aaron44126
Contributor
Contributor

Any other suggestions to fix the stuttering?

I got VMware working with PulseAudio using the information here with no trouble, but audio coming from guests makes a terrible stuttering sound. I tried adding the recommended stuff to daemon.conf and even changing the values but it doesn't seem to make any difference. 😛

I still prefer the stuttering to VMware complaining that the audio device is in use all the time, so thanks for this info!

Reply
0 Kudos
kdart
Contributor
Contributor

> Just change the sound device to "/dev/dsp" in sound device settings.

THIS is all it took for me to finally get sound working in the guest OS. I dind't even you you could edit that field in settings. Thanks.

Reply
0 Kudos
Mulchman
Contributor
Contributor

Any other suggestions to fix the stuttering?

I got VMware working with PulseAudio using the information here with no trouble, but audio coming from guests makes a terrible stuttering sound. I tried adding the recommended stuff to daemon.conf and even changing the values but it doesn't seem to make any difference. 😛

I still prefer the stuttering to VMware complaining that the audio device is in use all the time, so thanks for this info!

I too could use some suggestions to fix the stuttering. Even after making changes to daemon.conf enabling real time scheduling and high priority (and making the subsequent changes to the system limits file so the group pulse-rt can actually run pulseaudio at those levels) there is still stuttering. I've tweaked lots of settings and keeping default-fragments & default-fragment-size-msec to low values (like 4 each) makes it sound the best but there is still stuttering and skipping and pulseaudio seems a lot less stable running with high priority and real time scheduling.

My host OS is Ubuntu 8.10 (64 bit) and these are the additions I made to /etc/security/limits.conf for pulseaudio (and make sure the user pulseaudio runs as is in the pulse-rt group):

@pulse-rt - rtprio 99

@pulse-rt - nice -20

Anyway, a native option to route all sound through PulseAudio - like what VirtualBox does - would be a godsend.

Reply
0 Kudos
Mulchman
Contributor
Contributor

I'm having really good success - much better than before - with Ubuntu 9.04 (64 bit), VMware Workstation 6.5.2 (build-156735), Luke Yelavich's PPA (brings PulseAudio up to 0.9.15), and wrapping vmware-vmx with libaoss.so (instead of padsp).

  • Luke's PPA is here:

  • Instructions for wrapping vmware-vmx with libaoss can be found here:

  • I also have a slightly modified daemon.conf for PulseAudio: default-fragments & default-fragment-size-msec are both set to 4

With this setup I'm finally able to have sound in both the Host Ubuntu OS and (non-choppy & non-stuttering sound) in a Windows XP Professional (32 bit) virtual machine. Your mileage may very (YMMV) depending on your hardware and what not...

Reply
0 Kudos
bobdevis
Contributor
Contributor

I tried a lot of stuff but ended up using the surefire permanent way of fixing this by adding an extra soundcard. If you have free PCI/PCIe slots I can reccomend this solution as you do not have to upset your distro sound settings to pull this off.

Appart from needing extra hardware the only inconvinience is that you can not control the volume of your guest with any tool on the host. Just change the volume settings inside the guest!

You need one extra soundcard and one male-male audio cable to connect the output (green) of soundcard A with the line-in (blue) of soundcard B. Use the output of soundcard B for your speakers/headphones.

Once your 2nd audio card is installed, you should have a /dev/dsp and a /dev/dsp1 device or something like that. If you do NOT have 2 dsp devices, your host does not see the 2nd soundcard correctly and there may be a driver issue.

Install "pavucontrol", the Pulseaudio management tool.

In Pavucontrol mute the output device (audio card) that you would like to use for VMWare. What device name corresponds to what dsp device is something you may have to establish expermentally.

If some applications stop making sound now, it means you have to kick their playback stream to the other output device in Pavucontrol.

Now you have one /dev/dsp* device (the one you muted with Pavucontrol) that will not be touched by Pulseaudio. Point VMWare to that device and you are all done!

Reply
0 Kudos
fermulator
Contributor
Contributor

I've tried the above instructions on:

  • Ubuntu Jaunty 9.04 Desktop (2.6.28-11-server)

  • vmware 2.01 (VMware-server-2.0.1-156745.i386)

And I still receive the error: Failed to open sound device /dev/dsp: Connection refused Virtual device sound will start disconnected.

A couple of notes:

  • In Jaunty (latest released Ubuntu as of this date), all of the oss modules are already removed from the system. So blacklisting wasn't required.

  • Wrapping vmware-vmx with padsp makes a lot of sense (although most applications don't require this), it still didn't help to enable sound with vmware

  • The notion of editing "$HOME/.pulse/daemon.conf" is a good idea, but doesn't the vmware-vmx process run as root? So configuring pulse settings for our currently running $USER doesn't make much sense does it? (I could be wrong here though)

What now?

This problem with VMware and PulseAudio is littered all over the Internet. It would be really nice to find a solution that works 100%. (I remember trying this solutionon a previous version of Ubuntu, Hardy I believe, and it worked great!)

To elaborate: I'm very interested in a PROPER solution. Uninstalling PulseAudio, forcing VMware to use OSS, or anything like that isn't really the "right" solution. PulseAudio is a nice audio server, and I'm very much interested to hear if/how people have got VMWare to run with PulseAudio (AND without the stuttering audio problem). crosses fingers !

Reply
0 Kudos
bobdevis
Contributor
Contributor

fermulator,

Do you refer with the "above instructions" to my 2nd soundcard solution or to the original post?

In case you are referring to mine, here is something you can try;

After your 2nd soundcard is propperly installed, the loopback cabe is in place, do the following;

Make sure pavucontrol is not running

Make sure nothing is making any sound.

Now give the "killall pulseaudio" command in the console.

Start VMWare, start a vm (with its sound output pointed to a dsp device) and let the vm make some sound (*let it play an mp3 or so). You should hear it just fine now.

Now while the mp3 is playing, start pulseaudio again in the console.

Pulseaudio will now fail to hook up to the soundcard that is used by the vm, and will use the other one instead exclusively. This is what you want.

With the soundcard that you are reserving for VMWare muted in pavucontrol AND with pulseaudio failing to hook up to it once, pulseaudio will surely leave that card alone. Also after rebooting.

Reply
0 Kudos
sile
Contributor
Contributor

Original post method worked for me:

Jaunty 9.04 x64 (Dell D620)

VMWare 6.5.2

I changed /etc/pulse/daemon.conf to:

high-priority = yes

nice-level = -11

realtime-scheduling = yes

realtime-priority = 5

default-fragments = 4

default-fragment-size-msec = 4

resample-method = speex-float-3

Reply
0 Kudos
RDaly
Contributor
Contributor

I tried using the padsp method... It worked once, but then VMware started complaining 'cause /dev/dsp was no longer present on the system (modprobe -r removed the device nodes).

I also tried using the LD_PRELOAD, but that just isn't working. The sound adapter won't even connect (I get the little red X over the device on guest startup).

VMware - please fix.

Reply
0 Kudos
raywood
Enthusiast
Enthusiast

Has there been a clear solution to the problem of stuttering audio yet? I am using WinXP in a VMware Workstation 6.5.2. VM on Ubuntu 9.04 (Jaunty). I have tried a number of suggestions. A couple of them seemed to work for a day or so, but then the problem returned. This seems, so far, to be one of those situations where what works for one person does not work for another, and vice versa, possibly because of some larger underlying issue.

Reply
0 Kudos
raywood
Enthusiast
Enthusiast

By the way, I've just discovered that shutting down the computer overnight has at least temporarily fixed the problem. Possibly this was a factor behind the appearance that other "solutions" actually made a difference. Maybe we all just needed to take a break.

Reply
0 Kudos
Mulchman
Contributor
Contributor

Shutting down the computer overnight doesn't have anything to do with this. What does have to do with this is the hardware in your computer and that's also why many people have many different results (because everybody has different hardware).

The best results I had with this problem were right around April 7th when Ubuntu 9.04 had just come out and I moved to Luke's PPA (+ I was using a Turtle Beach sound card). Everything worked fantasticly at that time. Since then, the Turtle Beach card mysteriously died and I've had to switch to a card that came with the motherboard that uses the HDA Intel driver and it's just awful. I can't play any sound on the host OS for longer than a couple of seconds without ALSA dying and spamming the syslog.

Anyway, my point is that there are solutions out there that have been posted by many people but those solutions really only work if you have matching hardware. Until VMware Workstation supports PulseAudio natively we're just going to have to suffer with "fixes" and "solutions" that don't really fix or solve anything.

Reply
0 Kudos
Mulchman
Contributor
Contributor

One other thing I suggest people with this issue to do is submit a feature request to VMware for supporting PulseAudio in future versions.

Reply
0 Kudos
keithdart
Contributor
Contributor

Shoot, even supporting the ALSA interface would be great. The OSS interface they still use has been deprecated long ago.

Reply
0 Kudos
sile
Contributor
Contributor

Maybe our distributions should make it easy to swtich from alsa over to oss4.

Reply
0 Kudos