Hello,
Some backstory. I am running Proxmox on a 12th gen NUC. I have a Rocky Linux 9.1 LXC unprivileged container running successfully, complete with xrdp remote desktop. The only thing not working is sound. I am replicating a physical NUC deployment of this environment into a container so that the NUC can be repurposed for other things.
Admittedly, this was a bear to get audio working on the physical NUC when I did it 6 months ago. Much fighting with pulseaudio and alsa. Somehow, I got it working, but I had tried so many things, I lost track. Even looking at my .bash_history, I was able to reconstruct some things, but not all.
Getting the USB audio card working on the Proxmox Debian host was fairly straightforward. I installed alsa and then had to tell it to set the USB card in slot 0 so that it would be used over the default onboard audio. Once that was done, I can play sound via the CLI on the Proxmox host.
Now, this leads me to try to get it working in the LXC container. I have installed xrdp and have Gnome running, giving me a working Windows Remote Desktop connection session (mirroring the other physical NUC that I am using). The LXC container running Rocky Linux 9,1 reports that there are no audio cards, yet I can see it using the same commands as from the host. Here is what I've ran on the host to get it working, as well as the results of running the same commands on the LXC Container.
I would appreciate any help to get over this last hurdle and get sound working. Thanks so much!
Host
> Audio plays through USB sound card/speakers
LXC Container
> No sound plays
Some backstory. I am running Proxmox on a 12th gen NUC. I have a Rocky Linux 9.1 LXC unprivileged container running successfully, complete with xrdp remote desktop. The only thing not working is sound. I am replicating a physical NUC deployment of this environment into a container so that the NUC can be repurposed for other things.
Admittedly, this was a bear to get audio working on the physical NUC when I did it 6 months ago. Much fighting with pulseaudio and alsa. Somehow, I got it working, but I had tried so many things, I lost track. Even looking at my .bash_history, I was able to reconstruct some things, but not all.
Getting the USB audio card working on the Proxmox Debian host was fairly straightforward. I installed alsa and then had to tell it to set the USB card in slot 0 so that it would be used over the default onboard audio. Once that was done, I can play sound via the CLI on the Proxmox host.
Now, this leads me to try to get it working in the LXC container. I have installed xrdp and have Gnome running, giving me a working Windows Remote Desktop connection session (mirroring the other physical NUC that I am using). The LXC container running Rocky Linux 9,1 reports that there are no audio cards, yet I can see it using the same commands as from the host. Here is what I've ran on the host to get it working, as well as the results of running the same commands on the LXC Container.
I would appreciate any help to get over this last hurdle and get sound working. Thanks so much!
Host
Bash:
root@proxmox:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: G1 [Sound BlasterX G1], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: Generic Analog [Generic Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
root@proxmox:~# ls -la /dev/snd/by-id/
total 0
drwxr-xr-x 2 root root 60 Apr 25 17:11 .
drwxr-xr-x 4 root root 520 Apr 25 17:11 ..
lrwxrwxrwx 1 root root 12 Apr 25 17:11 usb-Creative_Technology_Ltd_Sound_BlasterX_G1_00139408-00 -> ../controlC0
root@proxmox:~# ls -la /dev/snd
total 0
drwxr-xr-x 4 root root 520 Apr 25 17:11 .
drwxr-xr-x 21 root root 4820 Apr 25 17:11 ..
drwxr-xr-x 2 root root 60 Apr 25 17:11 by-id
drwxr-xr-x 2 root root 80 Apr 25 17:11 by-path
crw-rw---- 1 root audio 116, 4 Apr 25 17:11 controlC0
crw-rw---- 1 root audio 116, 21 Apr 25 17:11 controlC1
root@proxmox:~# cat /proc/asound/cards
0 [G1 ]: USB-Audio - Sound BlasterX G1
Creative Technology Ltd Sound BlasterX G1 at usb-0000:00:14.0-8, full speed
1 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0x603d1a0000 irq 175
root@proxmox:~# cat /etc/modprobe.d/alsa.conf
options snd-usb-audio index=0
options snd-hda-intel index=1
root@proxmox:~# lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 041e:3249 Creative Technology, Ltd Sound BlasterX G1
Bus 003 Device 002: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 003 Device 004: ID 8087:0026 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@proxmox:~# ls -al /dev/bus/usb/003/003
crw-rw-r-- 1 root root 189, 258 Apr 25 17:11 /dev/bus/usb/003/003
root@proxmox:~# cat /etc/pve/lxc/101.conf
#lxc.mount.entry: /dev/bus/usb/003 dev/bus/usb/003 none bind,optional,create=dir
#lxc.cgroup2.devices.allow: c 189:* rwm
#lxc.mount.entry: /dev/bus/usb/003/003 dev/bus/usb/003/003 none bind,optional,create=file
arch: amd64
cores: 4
features: nesting=1
hostname: container
memory: 4096
nameserver: 10.0.0.8
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=D6:0C:E7:36:4F:2F,ip=dhcp,type=veth
ostype: centos
rootfs: local-lvm:vm-101-disk-0,size=15G
swap: 4096
unprivileged: 1
lxc.cgroup2.devices.allow: c 116:* rwm
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/snd dev/snd none bind,create=dir 0 0
lxc.mount.entry: /dev/bus/usb/003/003 dev/bus/usb/003/003 none bind,create=file 0 0
root@proxmox:~# aplay /usr/share/sounds/alsa/Front_Left.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
> Audio plays through USB sound card/speakers
LXC Container
Bash:
userland@container:~# arecord -l
arecord: device_list:275: no soundcards found...
userland@container:~# ls -la /dev/snd/by-id/
total 0
drwxr-xr-x 2 nobody nobody 60 Apr 25 17:11 .
drwxr-xr-x 4 nobody nobody 520 Apr 25 17:11 ..
lrwxrwxrwx 1 nobody nobody 12 Apr 25 17:11 usb-Creative_Technology_Ltd_Sound_BlasterX_G1_00139408-00 -> ../controlC0
userland@container:~# ls -la /dev/snd
total 0
drwxr-xr-x 4 nobody nobody 520 Apr 25 17:11 .
drwxr-xr-x 8 root root 520 Apr 25 21:27 ..
drwxr-xr-x 2 nobody nobody 60 Apr 25 17:11 by-id
drwxr-xr-x 2 nobody nobody 80 Apr 25 17:11 by-path
crw-rw---- 1 nobody nobody 116, 4 Apr 25 17:11 controlC0
crw-rw---- 1 nobody nobody 116, 21 Apr 25 17:11 controlC1
userland@container:~# cat /proc/asound/cards
0 G1 ]: USB-Audio - Sound BlasterX G1
Creative Technology Ltd Sound BlasterX G1 at usb-0000:00:14.0-8, full speed
1 PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0x603d1a0000 irq 175
userland@container:~# cat /etc/modprobe.d/alsa.conf
cat: /etc/modprobe.d/alsa.conf: No such file or directory
userland@container:~# lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 041e:3249 Creative Technology, Ltd Sound BlasterX G1
Bus 003 Device 002: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 003 Device 004: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
userland@container:~# ls -al /dev/bus/usb/003/003
crw-rw-r-- 1 nobody nobody 189, 258 Apr 25 17:11 /dev/bus/usb/003/003
userland@container:~# aplay /usr/share/sounds/gnome/default/alerts/drip.ogg
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused
aplay: main:867: audio open error: Connection refused
> No sound plays
Last edited: