View source for Virtual ALSA
Jump to:
navigation
,
search
= Page Objective = This page contains information about emulating ALSA in OpenVZ and/or KVM. There is no consideration given for the case of connecting to the hardware audio. The goal is to be able to have multiple audio apps that require ALSA emulation for one reason or another running on the same virtualization host. Note that I have a preference for OpenVZ over KVM when it can be used... because it's easier to use. So, this page will tend to focus on OpenVZ solutions. == Assessment == https://github.com/silkentrance/openvz-openvz-2.6.32/blob/master/Documentation/sound/alsa/HD-Audio.txt <pre> alsa-info ~~~~~~~~~ The script `alsa-info.sh` is a very useful tool to gather the audio device information. You can fetch the latest version from: - http://www.alsa-project.org/alsa-info.sh Run this script as root, and it will gather the important information such as the module lists, module parameters, proc file contents including the codec proc files, mixer outputs and the control elements. As default, it will store the information onto a web server on alsa-project.org. But, if you send a bug report, it'd be better to run with `--no-upload` option, and attach the generated file. </pre> == ALSA Dummy Driver == * The Official ALSA Wiki Article on the snd_dummy driver: http://www.alsa-project.org/main/index.php/Matrix:Module-dummy There are two ways of getting Linux drivers to work, you can either compile them into the kernel or build them separately as modules. Read the Kernel-HOWTO http://www.tldp.org/ for details of how to compile a kernel. You must turn on the sound support soundcore module. This is in the kernel. Look in the sound drivers directory and it should be the first option. Most people enable the module setting. That way you can load and unload the module manually if you have multiple soundcards/devices or if you intend to debug or use cutting edge software which may cause your drivers to halt sometimes. Of course it also means you have more control of your system. Most modern distros come with soundcore compiled as a module. You can check this in numerous ways. The easiest way is to type: <pre> modinfo soundcore </pre> Problem: debian VM doesn't have it. Document load procedure. Additional problem: even if it's there, third party VPS vendors don't place the support files necessary to see it on their boxen (example: creek). As a reference, Virtual Box doesn't do that, and so may provide a model in some respects: <pre> VBX:~$ modinfo soundcore filename: /lib/modules/3.2.0-55-generic/kernel/sound/soundcore.ko alias: char-major-14-* license: GPL author: Alan Cox description: Core sound module srcversion: 4DECB476393C345C541D37D depends: intree: Y vermagic: 3.2.0-55-generic SMP mod_unload modversions 686 parm: preclaim_oss:int </pre> * See also: http://superuser.com/questions/344760/how-to-create-a-dummy-sound-card-device-in-linux-server If this command returns that you have this module, then you don't need to recompile your kernel. In VBX the module loads no problem: <pre> # modprobe snd-dummy (note hyphen, not underscore!) # </pre> == ALSA on OpenVZ == The best article I've found to-date is cached here from http://myatus.com/p/x-server-with-sound-inside-an-openvz-proxmox-container/ circa 12/5/2013. === Notes on .114 Debian Slice === Troubleshooting. Not to where snd_dummy can be installed yet. http://ubuntuforums.org/showthread.php?t=205449 * aplay -l - checks for 'soundcard' * lspci -v - checks the hardware (useless in this case) * modprobe snd- <pre> # modprobe snd- WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/. FATAL: Module snd_ not found. # cd /etc deb6:/etc# ls modprobe.conf modprobe.conf deb6:/etc# ls modprobe.d aliases.conf alsa-base.conf fbdev-blacklist.conf alsa-base-blacklist.conf blacklist.conf linux-sound-base_noOSS.conf deb6:/etc# mv modprobe. sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils sudo apt-get install linux-sound-base alsa-base alsa-utils </pre> Had to add packages: * alsa-utils * snd (was: soundcore on other distros) === Preparing the host node === The host node requires the proper sound modules installed. For example, on a server that does not require actual output through attached speakers, snd_dummy is sufficient. Enter the following command to load the snd_dummy module: <pre> modprobe snd_dummy </pre> You can verify if everything went well with: <pre> lsmod | grep snd </pre> Which will display an output similar to: <pre> snd_dummy 23168 0 snd_pcm 97288 1 snd_dummy snd_timer 35464 1 snd_pcm snd 79784 3 snd_dummy,snd_pcm,snd_timer soundcore 18208 1 snd snd_page_alloc 19984 1 snd_pcm </pre> If this is the case, then you’d want to make sure the snd_dummy will be loaded at boot time. Simply issue the following command: <pre> echo "snd_dummy" >> /etc/modules </pre> === Preparing the container === ==== Setting device privileges ==== The next step is preparing the OpenVZ or Proxmox container. By default, the container does not have access privileges to the sound device, so this needs to be setup from the host node (assuming “100″ is the actual container ID): <pre> vzctl set 100 --devices c:116:all:rw --devices c:4:all:rw --save </pre> ==== Cloning the sound devices ==== The following step involves recreating the /dev/snd layout from the host node in the container. Let’s first see what the layout looks like on the host node: <pre> ls -la /dev/snd </pre> This will give an output similar to: <pre> crw-rw---- 1 root audio 116, 6 2009-08-14 20:42 controlC0 crw-rw---- 1 root audio 116, 5 2009-08-14 20:42 pcmC0D0c crw-rw---- 1 root audio 116, 4 2009-08-14 20:42 pcmC0D0p crw-rw---- 1 root audio 116, 3 2009-08-14 20:42 seq crw-rw---- 1 root audio 116, 2 2009-08-14 20:42 timer </pre> It is important that the same device IDs are being recreated in the container. I.e., the device ID for seq is 116,3 in the above example. Enter the container and start and issue the following commands, depending on the output given on the host node: <pre> vzctl enter 100 rm -r /dev/snd mkdir /dev/snd mknod /dev/snd/controlC0 c 116 6 mknod /dev/snd/pcmC0D0c c 116 5 mknod /dev/snd/pcmC0D0p c 116 4 mknod /dev/snd/seq c 116 3 mknod /dev/snd/timer c 116 2 chmod 660 /dev/snd/* chown :audio /dev/snd/* </pre> At this point you have cloned copy of the host node’s sound devices and are ready to be used. Please note that the application that wishes to use the sound devices require the proper privileges. The easiest method is to add the UID to the audio group. For example, if Skype runs under uid “skype”, issue this command: <pre> adduser skype audio </pre> == ALSA on KVM == === Links === http://www.linux-kvm.com/content/sound-problem-solved == ALSA on CentOS VM Host Rack Box == ALSA picks up the hardware on the base OS of this OpenVZ server. Working out the process/problems to get the OpenVZ to work properly in progress. Updated OS & Kernel 2/25/2014. == ALSA on Virtual Box == It just works, but only the way it wants to. The Null device seems to have been loaded by default (Xubuntu 12.04). === Links === http://www.withoutthesarcasm.com/fixing-audio-in-linux-guests-virtualbox/ == More How-To == For post "install" (and debug) open the following doc, and scroll down to (or search for) "Using alsamixer" http://ubuntuforums.org/showthread.php?t=205449 = My Favorite Packages = Tower load - moved to notes.
Return to
Virtual ALSA
.
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
Actions
Search
Navigation
Main page
Community portal
Current events
Recent changes
Random page
Help
Toolbox
What links here
Related changes
Special pages
Page information