Error in playing a sound using ALSA inside LXC container - Ask Ubuntu


i using host ubuntu 16.0.4 system run lxc container. uninstalled pulseaudio wanted use alsa directly.

after uninstalling pulseaudio host machine, able play sounds using command 1 below(on host machine):

aplay /usr/share/sounds/alsa/rear_right.wav 

inside lxc container, have installed alsa libs , alsa utils. when use same command above inside container, following errors:

alsa lib confmisc.c:768:(parse_card) cannot find card '0' alsa lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: no such file or directory alsa lib confmisc.c:392:(snd_func_concat) error evaluating strings alsa lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: no such file or directory alsa lib confmisc.c:1251:(snd_func_refer) error evaluating name alsa lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: no such file or directory alsa lib conf.c:4727:(snd_config_expand) evaluate error: no such file or directory alsa lib pcm.c:2239:(snd_pcm_open_noupdate) unknown pcm default aplay: main:654: audio open error: no such file or directory 

the sound devices inside container are:

bash-4.2# ls -al /dev/snd/* crw-rw---- 1 root   29 116,  5 nov  1 17:21 /dev/snd/controlc0 crw-rw---- 1 root   29 116,  2 nov  1 17:21 /dev/snd/controlc1 crw-rw---- 1 root   29 116, 10 nov  1 17:21 /dev/snd/controlc2 crw-rw---- 1 root   29 116,  9 nov  1 17:21 /dev/snd/hwc0d0 crw-rw---- 1 root   29 116, 13 nov  1 17:21 /dev/snd/hwc2d0 crw-rw---- 1 root   29 116,  6 nov  1 17:21 /dev/snd/pcmc0d3p crw-rw---- 1 root   29 116,  7 nov  1 17:21 /dev/snd/pcmc0d7p crw-rw---- 1 root   29 116,  8 nov  1 17:21 /dev/snd/pcmc0d8p crw-rw---- 1 root   29 116,  4 nov  1 17:21 /dev/snd/pcmc1d0c crw-rw---- 1 root   29 116,  3 nov  1 17:27 /dev/snd/pcmc1d0p crw-rw---- 1 root   29 116, 11 nov  1 17:21 /dev/snd/pcmc2d3p crw-rw---- 1 root   29 116, 12 nov  1 17:21 /dev/snd/pcmc2d7p crw-rw---- 1 root   29 116,  1 nov  1 17:21 /dev/snd/seq crw-rw---- 1 root   29 116, 33 nov  1 17:21 /dev/snd/timer  /dev/snd/by-id: total 0 drwxr-xr-x 2 root root  60 nov  1 17:21 . drwxr-xr-x 4 root root 360 nov  1 17:21 .. lrwxrwxrwx 1 root root  12 nov  1 17:21 usb-126c_4.1_amplifier-00 -> ../controlc1  /dev/snd/by-path: total 0 drwxr-xr-x 2 root root 100 nov  1 17:21 . drwxr-xr-x 4 root root 360 nov  1 17:21 .. lrwxrwxrwx 1 root root  12 nov  1 17:21 pci-0000:00:03.0 -> ../controlc0 lrwxrwxrwx 1 root root  12 nov  1 17:21 pci-0000:00:14.0-usb-0:5:1.0 -> ../controlc1 lrwxrwxrwx 1 root root  12 nov  1 17:21 pci-0000:01:00.1 -> ../controlc2 

i able play sounds inside lxc container.

first, have make sure lxc device cgroup enabled sound devices. can adding following in container config file:

#sound device nodes lxc.cgroup.devices.allow = c 116:* rwm  lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir 

next, since using alsa on host system play sounds , want use alsa again inside lxc container, make sure alsa configuration file copied inside container.

i copied alsa config file host @ location /etc/asound.conf inside lxc container. reason doing because alsalib inside container has have same configration use host machine.

after , able play sounds inside container. tested running following :

aplay /usr/share/sounds/alsa/rear_right.wav 

Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User