Search code examples
ubuntuaudioubuntu-18.04lxd

LXD container ALSA audio support question


host: Ubuntu 18.04 LXD/LXC 3.0.3

I am trying to use ALSA in my ubuntu 18.04 container. ALSA on host works. I have seen this post but it doesn't work for me.

My configuration:

lxc config set mycontainer raw.lxc "lxc.cgroup.devices.allow = c 116:* rwm"
lxc config set mycontainer raw.lxc "lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir 0 0"

aplay: aplay -l aplay: device_list:270: no soundcards found..

ALSA on the host works perfectly well.

What else do I need to do to make it work?


Solution

  • I guess, I have managed to get it working. Found this post

    lxc config device add <container> pcmC0D2c unix-char path=/dev/snd/pcmC0D2c
    

    I have added all devices listed in/dev/snd:

    hwC0D0 hwC0D2 pcmC0D0c pcmC0D0p pcmC0D10p pcmC0D1p pcmC0D2c pcmC0D3p pcmC0D7p pcmC0D8p pcmC0D9p seq timer
    

    It is important to add seq and timer, as well.