In a follow on post to my previous GUI From an LXC Container on the Host entry, here are some notes on linking sound in an LXC container to the host's sound system.
The primary reason for this was to get around Interactive Broker's broken sound requirements for really old libav libraries. Which is back to the version x53 libraries from the Debian Jessie / Ubuntu Precise 12.04 days. Long story short, I don't have this working yet. The basic issue I have is that, when running TWS in an LXC container, all the configuration menu options but one work. When I click on the 'Sound Manager' menu item, TWS locks up, and I don't see any log messages anywhere as to why this might happen. So there is something special in an LXC container environment which is locking up sound in TWS.
But I did get sound from FireFox / Youtube to work.
This on a Debian Bullseye system.
The basic solution is, in the LXC container configuration file, to mount the Pulse Audio socket from the user's account of the host into the container and set an environment for the user in the container. In this case, the user has UID of 1000:
lxc.mount.entry = /run/user/1000/pulse/native tmp/pulse/native none rw,bind,create=file 0 0 lxc.environment = PULSE_SERVER=unix:/tmp/pulse/native
For completeness, these can be added (helps with ALSA):
lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir lxc.cgroup.devices.allow = c 116:* rwm
That is about all to make it all work. Some or all of the following package installs in the container might help:
Continue reading "Sound in an LXC Container" »sudo apt install \ pulseaudio \ pulseaudio-utils \ pavucontrol \ gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-pulseaudio \ mpg123