Skip to contentSkip to conversation

Can't aplay/arecord simultaneously inside and outside of linux container

DISCUSSION GitHub issues - opened 1 participant 1 message Oct 12, 2020 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

alsa-project/alsa-utils issue #62 was opened from fearless-fan:

Hi,
I run into a problem that can't aplay/arecord simultaneously inside and outside of linux container.

Steps to reproduce:
1. go into container's shell and exec a record command.

~ # lxc-attach -n Default -P /tmp/run/lxc
/ # arecord -d 60 /tmp/test.wav &
/ # Recording WAVE '/tmp/test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono / # ps
PID USER TIME COMMAND
1 root 0:00 /sbin/init
3 root 0:00 /bin/sh

1519 root       0:00 arecord -d 60 /tmp/test.wav
1520 root       0:00 /bin/ash
1521 root       0:00 ps

2. exit and exec another record command outside of container

/ # exit
~ # arecord -d 60 /tmp/test.wav &
~ # ALSA lib pcm_dsnoop.c:641:(snd_pcm_dsnoop_open) unable to open slave
arecord: main:830: audio open error: Device or resource busy

[1]+ Done(1) arecord -d 60 /tmp/test.wav

3. playback has same problem as below

ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
aplay: main:830: audio open error: Device or resource busy

Expect:
It should be allowed to play/record simultaneously inside and outside of linux container.

Here's my asound.conf:

~ # cat etc/asound.conf

pcm.asymed {
    type asym
    playback.pcm "dmix:0,0"
    capture.pcm "dsnoop:0,0"
}

pcm.!default {
type plug
slave.pcm "asymed"
}

ctl.!default {
type hw
card 0
}

Is there anyone has experience of how to address it? Thank you.

Issue URL : https://github.com/alsa-project/alsa-utils/issues/62
Repository URL: https://github.com/alsa-project/alsa-utils