VMware Communities
jamespharaoh
Contributor
Contributor

Make ALSA sound work in VMWare

It is easy to get vmware to use alsa in linux, but this is not supported:

\- Install the libaoss library (part of alsa-oss on my ubuntu distribution).

\- Ensure the /usr/lib/libaoss.so.0.0.0 library is setuid (chmod +s /usr/lib/libaoss.so.*)

\- Rename vmware-vmx to vmware-vmx-real

\- Replace vmware-vmx with the following script:

#!/bin/sh

PATH_TO_VMWARE_BIN=`dirname $0`

LD_PRELOAD=libaoss.so exec $PATH_TO_VMWARE_BIN/vmw

This shouldn't cause any problems if the libaoss library is not installed or not setuid, it will simply work through the old OSS library as normal.

This could probably be quite easily be integrated as a configuration option into a future version of your product.

It does actually provide useful functionality as the sound is mixed with other applications using dmix.

0 Kudos
31 Replies
DaveP
Commander
Commander

Thanks for that very useful.

Dave

0 Kudos
jamespharaoh
Contributor
Contributor

One more point actually, this tip is posted around the net for vmware 3 but used to break in 4 and 5. I think the reason it now works again is that the newer versions of libaoss override the open64 function in addition to the open function, the newer versions of vmware use this to open the sound device.

0 Kudos
crys0000
Contributor
Contributor

Could you please explain what is "vmw" in your script? No files with that name exist, maybe you mean vmware-vmx-real?

This is my vmware-vmx script:

#!/bin/sh

PATH_TO_VMWARE_BIN=`/usr/lib64/vmware/bin $0`

LD_PRELOAD=libaoss.so exec $PATH_TO_VMWARE_BIN/vmware-vmx-real[/i]

Unfortunately now when I try to power on the virtual machine I get this fatal error:

Unable to change virtual machine power state: Failed to connect to peer process.[/i]

Where is the problem?

Thanks.

0 Kudos
crys0000
Contributor
Contributor

Finally I've made it work, it's very simple, you don't need to rename anything.

Just use this script:

#! /bin/bash

LD_PRELOAD=libaoss.so exec /opt/vmware/workstation/bin/vmware "$@"

Obviously the path depends on where you have vmware installed.

I hope this can help.

Cristiano

0 Kudos
KnuX
Contributor
Contributor

I notice yesterday that running "/usr/share/alsa-base/snddevices" (as root) will set a working "/dev/dsp". Only a "/dev/snd" directory exists on my Debian Unstable if I doesn't run it.

All features are on : mixer, micro support, etc.

For the virtual machine, "/dev/dsp" is the sound card, windows mixer is OK Smiley Happy

Message was edited by:

KnuX

0 Kudos
KnuX
Contributor
Contributor

Hm sorry, vmware's sound are not mixed with alsa's sound (alsaplayer for example)

0 Kudos
KnuX
Contributor
Contributor

I made a script called "starvmware" which is located in my ~/ directory :

#! /bin/bash

LD_PRELOAD=libaoss.so exec /usr/bin/vmware "$@"[/i]

It works, but for example I can't run a virtual machine which works without the script, I got this message :

Cannot open the disk '/home/knux/vmware/Windows XP Professional/Windows XP Professional.vmdk' or one of the snapshot disks it depends on.

Reason: File too large.[/i]

File is :

-rw------- 1 knux knux 2,9G 2006-05-18 18:56 Windows XP Professional.vmdk[/i]

The unique virtual machine I can use, is one with a 6Gb .vmdk file, pre-allocated. Others virtual machines have their .vmdk file > 2Gb, not pre-allocated.

Is there a workaround for this problem ? I'm on Debian Unstable and I don't understand why this happens 😕

0 Kudos
p2k
Enthusiast
Enthusiast

Well I'd love to see that Petr's esd and arts wrappers would also support alsa natively. I once tried to patch something together, but never got very far.

I think that would really solve everyone's problems. Or even better, get ALSA support natively into vmware. Maybe for version 6.0?

thanks

Philipp

0 Kudos
KnuX
Contributor
Contributor

$ LD_PRELOAD=libaoss.so exec vmware "$@"

/usr/lib/vmware/bin/vmware: /usr/lib/vmware/lib/libpng12.so.0/libpng12.so.0: no version information available (required by /usr/lib/libcairo.so.2)

ERROR: ld.so: object 'libaoss.so' from LD_PRELOAD cannot be preloaded: ignored.

It seems to be hard for the moment to get vmware working with alsa on Debian Testing...

Anyone has an idea of why I can diagnostic this problem in order to resolve it ? Smiley Wink

0 Kudos
KnuX
Contributor
Contributor

Preloading is possible using root access...

"sudo aoss vmware"

I don't know how to adjust libaoss permissions...

$ ll /usr/lib/libaoss*

-rw-rr 1 root root 15K 2006-09-11 13:26 /usr/lib/libaoss.a

-rw-rr 1 root root 851 2006-09-11 13:26 /usr/lib/libaoss.la

lrwxrwxrwx 1 root root 16 2006-10-10 23:10 /usr/lib/libaoss.so -> libaoss.so.0.0.0

lrwxrwxrwx 1 root root 16 2006-10-10 23:10 /usr/lib/libaoss.so.0 -> libaoss.so.0.0.0

-rw-rr 1 root root 15K 2006-09-11 13:26 /usr/lib/libaoss.so.0.0.0

0 Kudos
noend
Contributor
Contributor

This is what I did in order to have VMware alsa sound on Debian:

1. sudo aptitude install alsa-oss

2. sudo chmod +s /usr/lib/libaoss.so.*

3. sudo mv /usr/bin/vmware /usr/bin/vmware2

4. sudo touch /usr/bin/vmware

5. echo '#!/bin/bash' >> /usr/bin/vmware

6. echo 'LD_PRELOAD=libaoss.so exec /usr/bin/vmware2 "$@"' >> /usr/bin/vmware

7. vmware

Tested on VMware version 5.5.2 build-29772.

Hope it helps.

0 Kudos
hsk
Contributor
Contributor

Step 6.5:

chmod +x /usr/bin/vmware

Message was edited by:

hsk

0 Kudos
Sigmoid
Contributor
Contributor

Well, with 6.0, things got even worse.

Now absolutely no preloaded libs work. This basically means for me that I have no sound. Absolutely no sound.

I wonder how much work it would have been to add ALSA support. Not too much I reckon.

Is there any way of getting sound out of vmware workstation 6.0 on an ALSA system without kernel level OSS emulation? As I stated, libaoss doesn't work, and it just simply doesn't, no preload errors or anything, Vmware just states that it failed to open /dev/dsp.

0 Kudos
Edoardo
Contributor
Contributor

with WS6 I got rid of the /dev/dsp busy ... sound will start disconnected ... message by forcing the preloading of libaoss on all vmware executable by

installing libaoss (ny host is ubuntu 704)

and then editing

/usr/lib/vmware/lib/wrapper-gtk24.sh

by inserting at the end (before the call to vm_run) the following export statement

export LD_PRELOAD=libaoss.so:$LD_PRELOAD

vm_run "$@"

seems to work for me now.

0 Kudos
mrkrell
Contributor
Contributor

Arghh...That does not work in Fedora Core 7

There seems to be no sound adaptor detected by the windows XP guest/

I can't believe vmware support for linux is so poor..do they think we will listen

to sound in only the guest OS or the Host but not both at the same time?

0 Kudos
kkalinux
Contributor
Contributor

mrkrell,

I am also running Fedora 7 . I yum install alsa-oss , then after it installed, I restarted vmware. I then had sound on XP guess and also Fedora host at same time. I still have to get the internet going yet but maybe this will help you . Smiley Happy

Kurt

0 Kudos
Thomas_J
Contributor
Contributor

Hi folks,

I have added to Petr's vmdsp driver an ALSA-plugin. It works so far pretty well with only a few quirks:

\* No mixer control. - Well, I use the ALSA-mixer in Linux or my speakers anyway, so I did not implement this yet.

\* Sometimes (Might and Magic VI, intro video) the playback rate is wrong. You might her the sound being played at a too high rate. I have not found the reason for this yet.

\* I did not test the recording interface.

\* I removed 64-bit support for the time being to have a cleaner build structure.

Besides this, like I said above, it works pretty well. Feel free to download the source code from here:

https://www.sokrates.homelinux.net/~thomas/Private/Soft/vmwaredsp/vmwaredsp-1.4.tar.bz2

This file includes the ESD and the ARTS portion as well. This tarball (https://www.sokrates.homelinux.net/~thomas/Private/Soft/vmwaredsp/vmwaredsp-alsa-1.4.tar.bz2) contains the two additional files only.

Any feedback is appreciated.

0 Kudos
cdma
Contributor
Contributor

Just use 'lowlatency' kernel packages and leave all presets as original. You will get sound through ALSA (and/or OSS if you want), on any simultaneous applications that you dare to run at once, including VMWARE, INNOTEK, PARALLELS, WIN4LIN PRO, AMAROK, name it!

It works perfectly on Kubuntu Feisty 704 (kernel 2.6.20-16-lowlatency)

0 Kudos
neuropa
Contributor
Contributor

Hi Thomas_J,

when I try to make install (Fedora 7) of your source code I get the following error:

\# make install

make -C src install

make[1]: Entering directory `/tmp/vmwaredsp-1.4/src'

cc -c -g -W -Wall -O2 -fPIC -o vmdsp.o vmdsp.c

cc -shared -Wl,-version-script=vmdsp.map -o libvmdsp.so vmdsp.o -lpthread -ldl -lc

cc -c -g -W -Wall -O2 -fPIC -o vmdsp_esd.o vmdsp_esd.c

vmdsp_esd.c:18:17: error: esd.h: No such file or directory

vmdsp_esd.c:24: error: ‘ESD_NAME_MAX’ undeclared here (not in a function)

vmdsp_esd.c: In function ‘esdp_new_dsp’:

vmdsp_esd.c:80: warning: implicit declaration of function ‘esd_open_sound’

vmdsp_esd.c: In function ‘esdp_find_player’:

vmdsp_esd.c:147: error: ‘esd_info_t’ undeclared (first use in this function)

vmdsp_esd.c:147: error: (Each undeclared identifier is reported only once

vmdsp_esd.c:147: error: for each function it appears in.)

vmdsp_esd.c:147: error: ‘ei’ undeclared (first use in this function)

vmdsp_esd.c:149: warning: implicit declaration of function ‘esd_get_all_info’

vmdsp_esd.c:151: error: ‘esd_player_info_t’ undeclared (first use in this function)

vmdsp_esd.c:151: error: ‘player’ undeclared (first use in this function)

vmdsp_esd.c:154: error: ‘ESD_MASK_FUNC’ undeclared (first use in this function)

vmdsp_esd.c:162: warning: implicit declaration of function ‘esd_free_all_info’

vmdsp_esd.c: In function ‘esdp_set_volume’:

vmdsp_esd.c:178: warning: implicit declaration of function ‘esd_set_stream_pan’

vmdsp_esd.c: In function ‘dspp_start_playback’:

vmdsp_esd.c:199: error: ‘ESD_PROTO_STREAM_PLAY’ undeclared (first use in this function)

vmdsp_esd.c:200: error: ‘ESD_STREAM’ undeclared (first use in this function)

vmdsp_esd.c:200: error: ‘ESD_PLAY’ undeclared (first use in this function)

vmdsp_esd.c:201: error: ‘ESD_BITS16’ undeclared (first use in this function)

vmdsp_esd.c:201: error: ‘ESD_BITS8’ undeclared (first use in this function)

vmdsp_esd.c:202: error: ‘ESD_STEREO’ undeclared (first use in this function)

vmdsp_esd.c:202: error: ‘ESD_MONO’ undeclared (first use in this function)

vmdsp_esd.c: In function ‘mixerp_set_volume’:

vmdsp_esd.c:368: error: ‘ESD_RECORD’ undeclared (first use in this function)

vmdsp_esd.c:373: error: ‘ESD_MONITOR’ undeclared (first use in this function)

vmdsp_esd.c:378: error: ‘ESD_PLAY’ undeclared (first use in this function)

make[1]: *** \[vmdsp_esd.o] Error 1

rm vmdsp.o

make[1]: Leaving directory `/tmp/vmwaredsp-1.4/src'

make: *** \[install] Error 2

Where am I wrong?

0 Kudos