[lxc-users] lxc guest cannot play sound using pulseaudio. tcp module is loaded with permission.

Fajar A. Nugraha list at fajar.net
Mon May 25 04:36:35 UTC 2015


On Sun, May 24, 2015 at 11:57 PM, Oz Dror <odror7 at gmail.com> wrote:
> Hi I have been trying unsuccessfully to use pulseaudio with lxc.
>
>
> host: Ubuntu 15.04, with nvidia cuda (runs X11 gnome 3.14) on vt7
>
> lxc guest: Archlinux with nvidia cuda driver (runs X11 gnome 3.16) on vt8

works for me with ubuntu host & container.

Note that this setup (forwarding audio via tcp) is generic and not
lxc-specific. If you're stuck, search for documentation specific on
your OS (i.e. archlinux)

>
>
> pulseaudio is running in the host (192.168.x.x)
>
> the lxc guest connects to the host as follows (done in .xinitrc):
>
>
> pactl load-module module-native-protocol-tcp auth-ip-acl="192.168.0.3"
>
> export PULSE_SERVER=192.168.x.x:4713
>
>
> in the server I have  the following in /etc/pulse/default.pa
>
>
> load-module module-native-protocol-tcp
>
> load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24
> auth-anonymous=1


Does sound work on the host? If yes, then change your settings to make
it work first.

Does "pactl list  modules" on the host show the module loaded and
correctly configured? An example output on my host setup
$ pactl info
Server String: unix:/run/user/1000/pulse/native
...
Is Local: yes
...

$ pactl list modules
Module #0
Name: module-device-restore
...
Module #33
Name: module-native-protocol-tcp
Argument: auth-ip-acl=192.168.124.0/24 auth-anonymous=1
...

Can you access pulseaudio tcp port on the host? An example of open port:
$ telnet 192.168.124.1 4713
Trying 192.168.124.1...
Connected to 192.168.124.1.
Escape character is '^]'.
^]q

telnet> q
Connection closed.

If you CAN'T access the port, try unloading and reloading
module-native-protocol-tcp


Does the module load successfully on the container? An example of
correct loading
# export PULSE_SERVER=192.168.124.1:4713
# pactl load-module module-native-protocol-tcp
auth-ip-acl=192.168.124.0/24 auth-anonymous=1
xcb_connection_has_error() returned true
33

Then run "pactl list modules" on the container. The output should be
the same as the one you get on the host.

>
>
> aplay -l | grep card: (in the guest and host):

That shouldn't be necessary as with the correct setup:
- alsa uses pulseaudio (IIRC "pulseaudio" package set it up
automatically on ubuntu)
- pulseaudio on the container forwards all sound packets to the host
(PULSE_SERVER).

What you need is that "pactl info" on the CONTAINER to return the
correct settings, based on the host. This is on my container (the host
is 192.168.124.1, hostname "vivid")
# pactl info
xcb_connection_has_error() returned true
Server String: 192.168.124.1:4713
...
Is Local: no
...

> When I play in the lxc guest I get the following
>
>
> mplayer /usr/share/sounds/alsa/Front_Right.wav:

> Starting playback...
>
> A:   0.0 (unknown) of 1.0 (01.0) ??,?%


You didn't set it up correctly. If you had, both "aplay" and "mplayer"
wil be able to play it.

-- 
Fajar


More information about the lxc-users mailing list