My Devuan container’s apt command couldn’t find any dbus-user-session, just installed the pulseaudio-utils package.
At the container, there was no alsa, nor pipewire working, just pulseaudio.
Followed the troubleshooting webpage that you suggested, in particular this:
Audio
To test audio, run pactl info command couple of times, fast. If it shows Connection failure: Access denied at least once, then try copying pulseaudio cookie from host ~/.config/pulse/cookie to the container:
After copying the cookie, sound started working.
This cookie file is different than the one that was at the <instance_name>/home/MYUSER/.confg/pulse/.
This issue is solved.
Still, if I want to have sound coming from other containers, can I have the same cookie for all of them?
Another question: the video rendering inside the container is sub-optimal. Can containers (one or more) use video rendering by hardware without excluding the host system to do the same?
Thank you very much for your help on this @qkiel and @simos.
The PulseAudio Cookie is some secret information. Whichever process tries to connect to the PulseAudio socket, they have to authenticate with the PulseAudio server by providing the secret information of the cookie.
A process in an Incus container is not much different from a process on the host, like a browser or a music player. Those processes on the host have access to the ~/.config/pulse/cookie PulseAudio cookie, and can then authenticate to the PulseAudio server through the PulseAudio socket at /run/user/1000/pulse/native.
By giving access to 1) the PulseAudio socket to the container and 2) the PulseAudio cookie, any process in an Incus container can play audio. Therefore, you can replicate this process and give audio to any Incus container through the same way. Multiple containers is fine.
@qkiel has a guide on how to setup hardware accelerated graphics in a container. Most likely your setup gives software emulation to the apps in the container. Go through the guide.
Here, as well, we are using special tricks to make processes in selected containers to have access to the graphics and audio subsystems. When we do it properly, the host does not differentiate between processes on the host, and processes in containers of the host.
Hardware video rendering can be enabled inside the container without excluding the host or any other container. First, you need to check what uid the video group has on the host:
getent group video
In my case it’s 44. So I have to add GPU to the container using this command: