How to get Audio to work on OpenSolaris on VirtualBox

Man playing a big trumpet My regular working environment on the go or when working from home is, of course, OpenSolaris. I've been using it on an Acer Ferrari Laptop for years now and I can say I'm very happy with it, and that's not just because I work for Sun.

Lately, I tried OpenSolaris on VirtualBox on my private MacBook Pro. This configuration turned out to work better than the native OpenSolaris on my company's Acer Ferrari laptop! Due to the MBP being 2 years newer and it having a dual-core CPU plus 4 GB of RAM, it turned out to be the better machine to host my OpenSolaris work environment.

With one exception: Audio.

Audio isn't enabled in VirtualBox by default in the Mac version and that has already been blogged elsewhere. The solution is simply to enable Audio in VirtualBox settings and select the Intel ICH AC97 soundchip.

Then, OpenSolaris doesn't come with an ICH AC97 audio driver and even the new SUNWaudiohd driver doesn't support it. The solution here is to download the OSS sound drivers from 4Front technologies. So far, so good.

But this didn't work for me: Either the sound would play for a few seconds, then hang, or the sound drivers wouldn't be recognized by GNOME/GStreamer at all, resulting in a crossed-out loudspeaker icon at the top! This is very frustrating if you want to show Brandan's excellent shouting video to an audience and have to switch out of OpenSolaris/VirtualBox back to Mac OS X just for that.

Apparently others suffered from the same annoyance, too, but neither of the solutions I found seemed to help: I installed and uninstalled and reinstalled the OSS drivers a number of times, ran the ossdevlinks script to recreate device links, even installed a newer, experimental version of the SUNaudiohd driver. No luck yet.

Then Frank, a Sun sales person who happens to use OpenSolaris on his laptop as well (Yay! a salesrep using OpenSolaris! Kudos to Frank!) suggested to uninstall the SUNWaudiohd driver, then install the OSS sound driver, which worked for him. It didn't occur to me that uninstalling SUNWaudiohd might be the solution, so I wanted to give it a try.

But, alas "pfexec pkg uninstall SUNaudiohd" didn't work for me either! Apparently there's a dependency between this package and the slim_install package bundle. Again, Google is your friend and it turned out to be a known bug that prevented me from uninstalling SUNWaudiohd. The workaround is simply to "pfexec pkg uninstall slim_install" which is no longer needed after the installation process anyway.

So lo and behold, gone is slim_install, gone is SUNWaudiohd, installed the OSS drivers, logged out and back in and audio works fine now! (Notice: no reboot required).

Here's the sweet and short way to audio goodness on OpenSolaris on VirtualBox:

  1. Shutdown your OpenSolaris VirtualBox image if it is running, so you can change it's settings.
  2. Activate audio for your OpenSolaris VM in VirtualBox. Select the ICH AC97 Chip. Here's a blog entry that describes the process.
  3. Boot your OpenSolaris VirtualBox image.
  4. Uninstall the slim_server package: "pfexec pkg uninstall slim_server"
  5. Uninstall the SUNWaudiohd driver: "pfexec pkg uninstall SUNWaudiohd"
  6. Download the OSS sound driver for OpenSolaris.
  7. Install the OSS sound driver: "pfexec pkgadd -d oss-solaris-v4.1-1051-i386.pkg" (Or whatever revision you happened to download).
  8. Log out of your desktop and log back in. Sound should work now.

THX for the kudos! We have to discuss the 'a sales-rep ... ' comment this evening in Auerbachs Keller ;-)

btw, see this
to get the sound prefs partially working. I was curious to her the OpenSolaris startup jingle.

on a fresh 2008.11 install I did not run into this ips slim-install bug. Maybe this is only happening after upgrading from 2008.5 and/or the various 2008.11 pre-release builds.

Posted by Frank on January 14, 2009 at 09:46 AM CET #

Hmm, doesn't work for me-- I still have the same behaviour I've always had with VirtualBox+OpenSolaris+OSS. Namely, the first app that tries to play a sound works fine, after that, anything else gives me a 'device busy' error.

(I thought uninstalling SUNWaudiohd might be the key, as I hadn't done that before, but no dice...)

Posted by Calum Benson on January 14, 2009 at 05:18 PM CET #

Hi Calum,

yes, I see the same issue now :(. Unfortunately this seems to happen irregularly. It can be worked around by killing the app that holds the audio device (it doesn't close correctly, probably because of a locking issue), so a login/logout or a reboot is not necessary.

Let's wait for the next OSS version then, but fortunately, the procedure to get them started is now known :).

Posted by Constantin Gonzalez on January 15, 2009 at 12:57 AM CET #

I have downloaded the OSS driver as detailed here. When I run the command to install it i get "pkgadd: ERROR: no packages were found in /var/spool/pkg".
I have copied the package into that directory, and checked that it is there. In fact it is the only one there, but i still get the same error. Any ideas what the problem might be?

Posted by Phil Norris on January 17, 2009 at 05:40 AM CET #

You shouldn't need to copy the pkg to /var/spool/pkg, just specify the '-d' argument to pkgadd:

% cd /download/directory
% pkgadd -d <the-oss-pkg>.pkg

Posted by guest on January 17, 2009 at 05:54 AM CET #

Hi Phil,

sorry for the typo. It should indeed be: "pfexec pkgadd -d oss-solaris-v4.1-1051-i386.pkg" as pointed out already.

Meanwhile, my audio is working for some time, then it stops working for some reason, until I kill the application. I assume this is now a driver problem inside OSS. I've heard somewhere that the OpenSolaris people are planning to integrate OSS drivers into OpenSolaris, so hopefully it'll also work more stable then...


Posted by Constantin Gonzalez on January 17, 2009 at 09:30 AM CET #

Thanks for your help guys. All sorted now.

Posted by Phil Norris on January 18, 2009 at 04:59 AM CET #

I found a slightly less drastic workaround when OSS stops working in VirtualBox:

% pfexec /usr/sbin/soundoff
% pfexec /usr/sbin/soundon

seems to fix it for me.

Posted by Calum on January 28, 2009 at 11:49 AM CET #

Thanks Calum, I didn't know that. This is a very good help until the drivers are fixed!


Posted by Constantin Gonzalez on January 29, 2009 at 03:26 AM CET #

Post a Comment:
Comments are closed for this entry.

Tune in and find out useful stuff about Sun Solaris, CPU and System Technology, Web 2.0 - and have a little fun, too!


« April 2014