No audio in Ubuntu 16.04 LTS with VirtualBox 5.0.20
I have been breaking my head on this for a day and a half now. I am running VirtualBox 5.0.20 r106931 in Windows 8.1. My Guest system is Lubuntu 16.04 LTS, and I have successfully installed the VirtualBox Guest Additions. Afer all this, I cannot hear any audio when running either a video in Firefox, or an mp3 file in Audacious on my Guest Lubuntu system. I have tried all three Audio settings: SoundBlaster 16, ICH AC97, and Intel HD Audio. I have checked all of the sound levels that I can find, and none of them is set to mute. When I am running Audacious, the app shows that sound is being played and when I run a video in Firefox, the PulseAudioVolumeControl likewise shows that sound is being played [through something called the CubebUtils Audio Stream]. Any suggestions gratefully received.
Hmmmm, it sounds to me that you have not enabled the audio interface in the Devices menu when the VB is running. You’re sure it is enabled?
No audio interface is shown in the Devices menu. The choices are Optical Drives, Network, USB, Webcams, Shared Folders, Shared Clipboard, Drag and Drop, and Insert Guest Additions CD Image. I’ve looked at each of these, and in no place does an Audio Interface show up.
Further reading of documentation suggests that it doesn’t matter which processor [Intel/AMD] is on the machine
I think that I may have figured this out. When I was installing lubuntu, I originally chose to install a «Minimum Virtual Server». Evidently this minimal version did not have something that was needed to play sound through my host machine, and though I tried very hard to figure out what was missing, I could never do so.
Fixing Audio in Linux Guests | VirtualBox
I use VirtualBox to use Ubuntu in a Windows host environment. It’s not perfect, but it’s free and it works fairly well. The one major issue I have is the audio in the Linux (Ubuntu) guest. Sometimes, especially after using RDP to log into the Windows host, the audio in the Ubuntu guest gets screwed up. I’ve found several workarounds and a potential fix for audio issues with Ubuntu guests under VirtualBox, so I thought I’d share.
The first thing to do in this situation is to make sure your host audio (ie, Windows audio) works. Usually changing the volume level will make a sound, or you can load up the Sounds control panel and play some of the sample sounds there. If you can’t hear anything from these Windows sounds, you’ve got a Windows sound related issue, and your problem is probably not VirtualBox or your Ubuntu guest.
Then, you want to make sure that you’re not just having a problem with the application playing sounds. The easy way to test and see if this is the case is using aplay:
[bash][email protected]$ aplay /usr/share/sounds/alsa/Front_Center.wav[/bash]
This should play a sound out your speakers or your headphones. If you can’t hear this, and you’ve confirmed that the volume is up in your Ubuntu guest, you may find some of these fixes useful.
The Messy Way
The «hard way» to work around this is to:
- Shut down your Linux (ie, Ubuntu) guest
- Load the VirtualBox app again in your host OS (ie, Windows/OSX)
- Change the Audio Controller setting of the Linux guest. Usually I switch between the «Intel HD» and the «AC 97» audio options. Whichever one it was previously, I switch to the other.
- Start the Ubuntu guest again
Audio ought to work for a while after this.
However, this is messy, and requires that you shut down your Linux guest virtual machine and restart VirtualBox. This means you’ve got to stop whatever you’re doing, which sucks. Recently I found another solution.
Fixing the AC97 Driver
First, make sure you’ve set your audio to ICH AC97 in the Audio tab of the configuration interface.
Then, check to see if you’re having a clocking problem. Use this command:
Search for «ac97» by typing /ac97 and hitting enter.
[bash] intel8x0_measure_ac97_clock: measured 853869 usecs intel8x0: clocking to 41161 [/bash]
. then this fix will probably work for you. Apparently the Intel AC97 driver tries to guess the clock rate of the emulated chip and fails. This bug was reported here and that’s where I got this workaround from.
Edit the file /etc/modprobe.d/alsa-base.conf in your favorite editor. (Note: the file and location may vary depending on the Linux distro — this works in Ubuntu 12.04 LTS, though)
You’ll have to be root for this. For instance:
[bash] sudo nano /etc/modprobe.d/alsa-base.conf [/bash]
At the bottom of the file, add this line:
[bash]options snd-intel8x0 ac97_clock=48000[/bash]
Then save and exit. (In nano, this is Ctrl-O to save, then Ctrl-X to exit)
You’ll have to reboot, but hopefully afterwards your audio problems will be solved and stay that way!
The «Reset Linux Audio» Fix
Sometimes I’ve run into situations where the audio subsystem glitches for whatever reason, and nothing short of a reboot seems to fix it. I’ve found that the following command helps though:
[bash] pulseaudio -k && sudo alsa force-reload [/bash]
This will kill the audio subsystem and reload it, which will often immediately fix an ongoing audio issue.
If you’ve got other VirtualBox Linux audio issues that you managed to solve, feel free to leave a comment to help the rest of us.
VirtualBox Linux Guest
To restore a non working sound system in Linux guest under VirtualBox, make sure that «Intel HD Audio» is used as the audio controller for the Linux guest in VirtualBox Manager.
In the Linux guest, when the issue occurs, run the following two commands in sequence:
sudo modprobe snd_hda_intel power_save=0 power_save_controller=N
Note: your user account must have root privilege. You can then test the sound using the following command:
aplay /usr/share/sounds/alsa/Front_Center.wav
If the sound still does not work, adjust the host machine’s volume a little. That will make the sound work. I have verified this trick multiple times in the 6 days after the boot up of my Debian virtual machine.
To make it easier, you can create two aliases:
alias resetsound=’sudo rmmod -f snd_hda_intel;sleep 1;sudo modprobe snd_hda_intel power_save=0 power_save_controller=N;sleep 1′
alias testsound=’aplay /usr/share/sounds/alsa/Front_Center.wav’
The Issues
I use Debian Stretch/Xfce as my Linux guest. It is a stable/speedy OS. VirtualBox guest additions are properly installed.
Under VirtualBox version 6.0.4, the noises are gone. But after a random period the guest won’t play sound. Youtube will flash a waiting circle on any videos. This can be verified by the following command in a Terminal:
The above command won’t return when the guest experiences this issue. A guest reboot will regain the sound.
Noticed the following error during Debian boot up:
snd_intel8x0 measure — unreliable dma position
Also the following error in syslog:
Mar 12 11:23:58 Angular pulseaudio[1534]: [alsa-sink-Intel ICH] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write.
Mar 12 11:23:58 Angular pulseaudio[1534]: [alsa-sink-Intel ICH] alsa-sink.c: Most likely this is a bug in the ALSA driver ‘snd_intel8x0’. Please report this issue to the ALSA developers.
Mar 12 11:23:58 Angular pulseaudio[1534]: [alsa-sink-Intel ICH] alsa-sink.c: We were woken up with POLLOUT set — however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
No sound in 12.04 on VirtualBox
No sound when installed in VirtualBox. When I boot from the live CD in Windows, sound works fine on my speakers. When in boot the live CD in VirtualBox it does not see my speakers. In sound properties only digital output built in S/PDIF and headphones! I’ve done the pavcontrol — alsamixer — all settings are OK. I’ve tried both 32/64 versions of Ubuntu. Running current version VirtualBox. System: Windows 7 64 — i5. What am I overlooking?
6 Answers 6
For a windows guest, Ubuntu host system, set the VM to use ALSA on the host and the VM soundcard to Intel HD.
Is your audio setting for your Ubuntu guest virtual machine set to ICH AC97 ?
ICH AC97 is the only VirtualBox VM audio setting which allows me to get sound when running Ubuntu as a guest and either Windows or OS X (10.6.8) as the host.
In particular, if a VM’s audio setting is Intel HD Audio then sound does not work in an Ubuntu 12.04 desktop guest.
On the other hand, sound will only work for a Windows 7 (64-bit) guest when the audio setting is Intel HD Audio . This can be rather annoying when you are working with a VM which dual boots either Ubuntu or Windows 7 as the guest OS.
I have never investigated this further to find out why it works this way or if there is a way to work around it. If you happen to find one, please let us know about it.
Note: You will have to «power off» your VM to change its audio setting.