mapping host audio hardware to lxc

JimLS

New Member
Mar 20, 2025
18
0
1
Set up a Debian container and want to run a python program that accesses the audio hardware to play sounds and a USB serial connection. For now I am just working on the audio. Got audio working on host. I made a user on the LXC system and added it to sudo and audio groups. I added this to conf file on host:
Code:
lxc.cgroup2.devices.allow: c 116:* rwm
lxc.mount.entry: /dev/snd dev/snd none bind,optional,create=dir
I can see the devices in the container at /dev/snd owned by nobody. Am confused by the mapping needed and seen conflicting information. I think this is the user info needed to set that up.
Code:
root@proxmox1:~# grep audio /etc/group
audio:x:29:root
root@proxmox1:~# id -g root
0
On Debian (103) lxc:
jim@Debian:~$ id -g jim
1000
jim@Debian:~$ id -g root
0
What do I need to put in the config file to properly map the audio to the LXC?

If it matters here is the device info shown by lspci:
00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31)
 
you could try a device passthrough with /dev/snd by selecting your container in the web interface and then clicking through Resources -> Add -> Device Passthrough
 
you could try a device passthrough with /dev/snd by selecting your container in the web interface and then clicking through Resources -> Add -> Device Passthrough
I got the error "/dev/snd is not a device". I didn't know what to put in the other fields such as UID in CT and GID in CT so left them blank. Did some reading at found you can't pass to root on the host for security reasons so looks like I need to add a user to host and make sure that user can access audio on host first. Then try to link container to that.