Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulseaudio 12 not working anymore #71

Closed
sandrokeil opened this issue Aug 8, 2018 · 29 comments
Closed

Pulseaudio 12 not working anymore #71

sandrokeil opened this issue Aug 8, 2018 · 29 comments
Labels

Comments

@sandrokeil
Copy link
Contributor

I don't know if this issue is related to x11docker, but maybe someone has some hints for me to solve it.

After an upgrade of different packages inclusive pulseaudio and nvidia driver (arch linux), pulseaudio has stopped working with Docker. Downgrading of pulseaudio has no effect. For example vlc error message is vlcpulse audio output error: PulseAudio server connection failure: Timeout. It's not connection refused! See logs

vlc_docker.log

If I install vlc on host system, it can connect to pulseaudio via socket and sound is working. See logs

vlc_host.log

Pulseaudio native is mounted to the container but I don't know why it can not connect anymore. Any hints appreciated.

@mviereck
Copy link
Owner

mviereck commented Aug 8, 2018

Can you please run pavucontrol in container and check whether it connects to pulseaudio server?

I did a test here with debian on host and in image, and vlc plays sound with --pulseaudio.

The host shows pulseaudio version 11.1, the container 10.0. What is your pulseaudio version?

@sandrokeil
Copy link
Contributor Author

sandrokeil commented Aug 8, 2018

Maybe it's a pulseaudio version or GNOME issue. I've installed version 12.2 on host and Docker container.

I've got the pavucontrol error (pavucontrol:71): dbind-WARNING **: 22:55:33.699: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-DdUV4iwaoC: Connection refused. Have you an idea why dbus is used here or is it normal? Also from the logs x11docker: Running dbus user session with: (none), is this correct?

x11docker.log

Must be the DBUS session bus address the same in the container like on host, because they are different?

$ dbus-launch
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-yKODRF60NR,guid=ff412fd3b5eb00d09b0bc6ff5b6b5fa9
DBUS_SESSION_BUS_PID=97505
DBUS_SESSION_BUS_WINDOWID=54525953

Here are some pulseaudio infos. Do you have the same?

$ ps aux | grep pulse
gdm        1786  0.0  0.0 1199012 11980 ?       Ssl  19:27   0:00 /usr/bin/pulseaudio --daemonize=no
gdm        1817  0.0  0.0 290548  6356 ?        Sl   19:27   0:00 /usr/lib/pulse/gsettings-helper
skeil      2255  0.0  0.0 1473008 14364 ?       S<sl 19:27   0:01 /usr/bin/pulseaudio --daemonize=no
skeil      2263  0.0  0.0 290552  6488 ?        Sl   19:27   0:00 /usr/lib/pulse/gsettings-helper
$ ls -la /run/user/1000/pulse
total 4
drwx------  2 skeil users 100  8. Aug 19:27 .
drwx------ 11 skeil users 260  8. Aug 22:55 ..
srwxrwxrwx  1 skeil users   0  8. Aug 19:27 dbus-socket
srw-rw-rw-  1 skeil users   0  8. Aug 19:27 native
-rw-------  1 skeil users   5  8. Aug 19:27 pid

@sandrokeil
Copy link
Contributor Author

sandrokeil commented Aug 8, 2018

Can you also try if it works for you with this Dockerfile (Arch Linux)?

FROM base/archlinux:2018.08.01
RUN pacman -Sy --noconfirm pulseaudio pulseaudio-alsa pavucontrol
CMD ["pavucontrol"]

@mviereck
Copy link
Owner

mviereck commented Aug 8, 2018

dbus warnings are mostly harmless.
Though, ls -la /run/user/1000/pulse does not show a dbus-socket here, but only native and pid.
Maybe it makes a difference to share dbus-socket with --sharedir /run/user/1000/pulse/dbus-socket

ps aux | grep pulse only shows one entry of /usr/bin/pulseaudio --daemonize=no

What do you see in the GUI of pavucontrol within container? Does it show an error message, or is there an "output devices" tab? If a connection is established, you should see and control your host audio device in "output devices".

I will try the Dockerfile you provided.

@sandrokeil
Copy link
Contributor Author

sandrokeil commented Aug 8, 2018

The GUI said Establish connection to PulseAudio. Please wait. I've updated a bit my previous comments with more infos, sorry for that.

Here is the Arch Linux VLC Dockerfile.

FROM base/archlinux:2018.08.01
RUN pacman -Syu --noconfirm pulseaudio pulseaudio-alsa fmpeg libfdk-aac lame a52dec libvorbis flac wavpack libmpeg2 xvidcore vlc
CMD ["vlc", "-vv"]

Edit: added pulseaudio pulseaudio-alsa

@mviereck mviereck added the bug label Aug 8, 2018
@mviereck
Copy link
Owner

mviereck commented Aug 8, 2018

pavucontrol on arch image crashes with a segmentation fault here.

I once decided to connect to pulseaudio with shared unix sockets to provide best possible performance. But if it is incompatible now, I may have to provide pulseaudio with a TCP connection instead.
That is less secure and has some issues with the TCP module. I can load pulseaudio TCP module on host with a specified container IP to allow. But unloading the module caused pulseaudio to terminate at all.

@mviereck
Copy link
Owner

mviereck commented Aug 8, 2018

I did some tests with the VLC Dockerfile/image you've provided.

It already shows an error during build, but build finishes:

(6/6) Updating the vlc plugin cache...
error: command terminated by signal 11: Segmentation fault

If I try to run vlc or pavucontrol, both fail with segmentation faults or core dumps. This happens with and without --pulseaudio. At least an additional xterm does not crash.
I also tried a TCP setup for pulseaudio, but that does not help either.
(The TCP setup works well with my debian image, btw.)

I assume a serious underlying issue in either arch, vlc or pulseaudio. Do you have an idea about those crashes? At least without providing puleaudio from host there should not be a crash.

Is there a possibility to install an older pulseaudio version in arch image? Maybe the arch version of pulseaudio is a buggy 'bleeding edge' one.

Edit: I've build an image based on debian sid with pulseaudio 12.0. --pulseaudio works with shared unix socket as well as with TCP connection. (pulseaudio 11.1 on host).
I did not test a setup with pulseaudio 12.0 on host, maybe I could create a VM for this.

@mviereck
Copy link
Owner

mviereck commented Aug 9, 2018

Can you run a test with:

FROM debian:sid
RUN apt-get update
RUN apt-get install -y pavucontrol
CMD pavucontrol

debian sid provides pulseaudio 12.0.

@sandrokeil
Copy link
Contributor Author

No success, same behaviour with debian. From my pacman logs, pulseaudio should work until version 12.2-1.

This may be an interesting pacman log detail, but /usr/lib/systemd/user/pulseaudio.socket is still there. Any idea why multiple pulseaudio sockets exists? But I think it was working with /run/user/1000/pulse/dbus-socket

 574 [2018-07-07 15:38] [ALPM] installed pulseaudio (12.0-1)
 575 [2018-07-07 15:38] [ALPM-SCRIPTLET] Created symlink /etc/systemd/user/sockets.target.wants/pulseaudio.socket → /usr/lib/systemd/user/pulseaudio.socket.

At this time it was stop working but it could also be an issue with another package. Here are the full pacman log.

pacman.log

2242 [2018-08-02 22:51] [ALPM] upgraded pulseaudio (12.2-1 -> 12.2-2)
2243 [2018-08-02 22:51] [ALPM] upgraded pulseaudio-bluetooth (12.2-1 -> 12.2-2)
2244 [2018-08-02 22:51] [ALPM] upgraded gnome-bluetooth (3.28.0-1 -> 3.28.2-1)

Can you try this Dockerfile (it uses pulseaudio 12.0), it was working for me before system upgrade in august.

FROM base/archlinux:2018.07.01
RUN echo 'Server=https://archive.archlinux.org/repos/2018/07/01/$repo/os/$arch' > /etc/pacman.d/mirrorlist
RUN pacman -Sy --noconfirm pulseaudio pulseaudio-alsa pavucontrol
CMD ["pavucontrol"]

So if pulseaudio is working on host, what can be the problem that's not working in the container? Sharing the socket should be enough like for X11 right? Should I mount some other stuff too?

@mviereck
Copy link
Owner

mviereck commented Aug 9, 2018

So if pulseaudio is working on host, what can be the problem that's not working in the container? Sharing the socket should be enough like for X11 right? Should I mount some other stuff too?

Maybe it has to do with this new dbus socket. Sharing it with --sharedir /run/user/1000/pulse/dbus-socket is worth a test.

One idea: If the socket is a symbolic link only, sharing with container fails.
Please check ls -l $XDG_RUNTIME_DIR/pulse whether it contains symbolic links.

Can you try this Dockerfile

Works with shared socket as well as over TCP.


I've made an update that allows to use TCP instead of shared socket.
Try with --pulseaudio=tcp

@sandrokeil
Copy link
Contributor Author

Quite awesome, --pulseaudio=tcp works like a charm for vlc and pavucontrol. 🎉 I don't find a symlink.

ls -l $XDG_RUNTIME_DIR/pulse
total 4
srwxrwxrwx 1 skeil users 0  9. Aug 20:22 dbus-socket
srw-rw-rw- 1 skeil users 0  9. Aug 20:21 native
-rw------- 1 skeil users 5  9. Aug 20:21 pid

Maybe it has to do with this new dbus socket. Sharing it with --sharedir /run/user/1000/pulse/dbus-socket is worth a test.

If I run --sharedir /run/user/1000/pulse/dbus-socket without --pulseaudio vlc said this time vlcpulse audio output error: PulseAudio server connection failure: Connection refused. So it's no timeout.

[000055a5fe1b51c0] main audio output debug: looking for audio output module matching "any": 6 candidates
[000055a5fe1b51c0] vlcpulse audio output debug: using library version 12.2.0
[000055a5fe1b51c0] vlcpulse audio output debug:  (compiled with version 12.2.0, protocol 32)
[000055a5fe1b51c0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[000055a5fe1b51c0] alsa audio output debug: Available ALSA PCM devices:
[000055a5fe1b51c0] alsa audio output debug: Discard all samples (playback) or generate zero samples (capture) (null)
[000055a5fe1b51c0] alsa audio output debug: PulseAudio Sound Server (pulse)
[000055a5fe1b51c0] alsa audio output debug: Default ALSA Output (currently PulseAudio Sound Server) (default)
[000055a5fe1b51c0] main audio output debug: using audio output module "alsa"
[000055a5fe0f6f90] main playlist debug: keeping audio output

Works with shared socket as well as over TCP.

And this Dockerfile does not work for you via socket?

FROM base/archlinux:2018.08.01
RUN pacman -Syu --noconfirm pulseaudio pulseaudio-alsa pavucontrol
CMD ["pavucontrol"]

Is there anything that I can do to help to bring pulseaudio socket back to work? Or maybe we wait a month or so and see if it works with new updates again? This depends on your ideas how to debug. ;-) In the meantime I can live with tcp.

Thank you very much for your effort. I highly appreciate it.

@mviereck
Copy link
Owner

mviereck commented Aug 9, 2018

And this Dockerfile does not work for you via socket?

It works with both TCP and shared socket.

If I run --sharedir /run/user/1000/pulse/dbus-socket without --pulseaudio

Please test with pulseaudio: --sharedir /run/user/1000/pulse/dbus-socket --pulseaudio

Is there anything that I can do to help to bring pulseaudio socket back to work? Or maybe we wait a month or so and see if it works with new updates again? This depends on your ideas how to debug. ;-)

Maybe we can check again after next arch pulseaudio update.
Currently I don't have much ideas on how to debug.

If it turns out that socket sharing failes for pulseaudio >=12.0 on host due to internal API changes, x11docker will have to default to TCP.

Maybe if I set up an arch VM, I could do further tests. I already have one, but it fails to run updates and is quite outdated. Because I am not familar with arch and it was not easy to install, I hesitate do install it again.

@sandrokeil
Copy link
Contributor Author

Please test with pulseaudio: --sharedir /run/user/1000/pulse/dbus-socket --pulseaudio

It doesn't work either. No worries. So let's wait for new updates.

[000055cec05f61c0] vlcpulse audio output debug: using library version 12.2.0
[000055cec05f61c0] vlcpulse audio output debug:  (compiled with version 12.2.0, protocol 32)
[000055cec05f61c0] vlcpulse audio output error: PulseAudio server connection failure: Timeout

If it turns out that socket sharing failes for pulseaudio >=12.0 on host due to internal API changes.

I don't understand this, because my Docker images have the same pulseaudio version like the host or what do you mean with API changes? Ok, maybe some other package has not the same version like on host due the base Docker image difference.

Again, no worries. Let's wait for a new update round.

@mviereck
Copy link
Owner

mviereck commented Aug 9, 2018

I don't understand this, because my Docker images have the same pulseaudio version like the host or what do you mean with API changes?

You are right, that should work at least with same versions on host and in image.

One idea: There is some sort of pulseaudio cookie for authentication. I did not need it before, would have to look for it. Maybe x11docker just needs to share the cookie.

I am not sure where the cookie file resides. But it is shown in pax11publish. It may work to to run pax11publish on new X server.

Try: --runfromhost 'pax11publish -e'
Though, it may interfere with the PULSE_SERVER environment variable.

Edit: another attempt is to use environment variable PULSE_COOKIE. It seems it can either point to a file containing the cookie, or contain the cookie itself.

Try:

PULSE_COOKIE="$(pax11publish | grep Cookie | cut -d' ' -f2)"
x11docker --pulseaudio --env PULSE_COOKIE="$PULSE_COOKIE" imagename

@sandrokeil
Copy link
Contributor Author

I don't have a PULSE_SERVER environment variable on host. The pulseaudio cookie is stored in ~/.config/pulse/cookie. So should I mount it to somewhere? Regarding to the Arch Wiki how can pulseaudio work via TCP without sharing the cookie?

For this to work, it is a requirement that both the client and server share the same cookie.

@mviereck
Copy link
Owner

mviereck commented Aug 9, 2018

I don't have a PULSE_SERVER environment variable on host.

On host it is stored in X11 environment variables, done by pulseaudio. pax11publish makes them visible. In container x11docker sets it as a regular environment variable, not stored in X.

The pulseaudio cookie is stored in ~/.config/pulse/cookie.

Maybe it just needs to be shared with container. Though, --sharedir only will point correctly if option --home is set, too. Can your try:

x11docker --pulseaudio --home --sharedir ~/.config/pulse/cookie imagename

how can pulseaudio work via TCP without sharing the cookie?

x11docker loads a pulseaudio TCP module authenticated with IP address of container:

pactl load-module module-native-protocol-tcp port=$Pulseaudioport auth-ip-acl=$Containerip

@sandrokeil
Copy link
Contributor Author

I've to run pactl load-module module-x11-publish first to get an output of pax11publish but no luck with the different examples. Always connectino timeout in VLC.

@mviereck
Copy link
Owner

mviereck commented Aug 9, 2018

Always connectino timeout in VLC.

It is better to check with pavucontrol. I divides finer between timeout and refused connections.

@mviereck mviereck changed the title Pulseaudio not working anymore Pulseaudio 12 not working anymore Aug 10, 2018
@mviereck
Copy link
Owner

mviereck commented Aug 10, 2018

x11docker now copies ~/.config/pulse/cookie into container and sets PULSE_COOKIE pointing to it. (for shared socket mode / --pulseaudio=socket only).
It does not make a difference here, it works even with a wrong cookie.
But maybe it makes a difference with pulseaudio 12 on host.

Maybe it is just a pulseaudio configuration issue. If the cookie does not help, a look at daemon configuration on host may help. /etc/pulseaudio/daemon.conf has no special settings here, everything is commented out.

x11docker creates this client.conf:

# Connect to the host's server using the mounted UNIX socket
default-server = unix:/pulse/native
# Prevent a server running in the container
autospawn = no
daemon-binary = /bin/true
# Prevent the use of shared memory
enable-shm = false

Edit: I found that x11docker shared the whole pulse folder including all sockets, not only pulse/native. That means the new dbus socket was shared, too, and may have caused confusion.
Latest update only shares $XDG_RUNTIME_DIR/pulse/native. Maybe that makes a difference.

@sandrokeil
Copy link
Contributor Author

Can't get a socket pulseaudio connection in pavucontrol with the new version, only tcp works. Here are my configs:

$ cat /etc/pulse/client.conf 
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

## Configuration file for PulseAudio clients. See pulse-client.conf(5) for
## more information. Default values are commented out.  Use either ; or # for
## commenting.

; default-sink =
; default-source =
; default-server =
; default-dbus-server =

autospawn = no
; autospawn = yes
; daemon-binary = /usr/bin/pulseaudio
; extra-arguments = --log-target=syslog

; cookie-file =

; enable-shm = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB

; auto-connect-localhost = no
; auto-connect-display = no
$ cat /etc/pulse/daemon.conf 
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

## Configuration file for the PulseAudio daemon. See pulse-daemon.conf(5) for
## more information. Default values are commented out.  Use either ; or # for
## commenting.

; daemonize = no
; fail = yes
; allow-module-loading = yes
; allow-exit = yes
; use-pid-file = yes
; system-instance = no
; local-server-type = user
; enable-shm = yes
; enable-memfd = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; lock-memory = no
; cpu-limit = no

; high-priority = yes
; nice-level = -11

; realtime-scheduling = yes
; realtime-priority = 5

; exit-idle-time = 20
; scache-idle-time = 20

; dl-search-path = (depends on architecture)

; load-default-script-file = yes
; default-script-file = /etc/pulse/default.pa

; log-target = auto
; log-level = notice
; log-meta = no
; log-time = no
; log-backtrace = 0

; resample-method = speex-float-1
; avoid-resampling = false
; enable-remixing = yes
; remixing-use-all-sink-channels = yes
; enable-lfe-remixing = no
; lfe-crossover-freq = 0

flat-volumes = no
; flat-volumes = yes

; rlimit-fsize = -1
; rlimit-data = -1
; rlimit-stack = -1
; rlimit-core = -1
; rlimit-as = -1
; rlimit-rss = -1
; rlimit-nproc = -1
; rlimit-nofile = 256
; rlimit-memlock = -1
; rlimit-locks = -1
; rlimit-sigpending = -1
; rlimit-msgqueue = -1
; rlimit-nice = 31
; rlimit-rtprio = 9
; rlimit-rttime = 200000

; default-sample-format = s16le
; default-sample-rate = 44100
; alternate-sample-rate = 48000
; default-sample-channels = 2
; default-channel-map = front-left,front-right

; default-fragments = 4
; default-fragment-size-msec = 25

; enable-deferred-volume = yes
; deferred-volume-safety-margin-usec = 8000
; deferred-volume-extra-delay-usec = 0
$ cat /etc/pulse/default.pa
#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

### Automatically load driver modules for Bluetooth hardware
#.ifexists module-bluetooth-policy.so
#load-module module-bluetooth-policy
#.endif

#.ifexists module-bluetooth-discover.so
#load-module module-bluetooth-discover
#.endif

### Load several protocols
load-module module-dbus-protocol
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor

### Load additional modules from GSettings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gsettings.so
.nofail
load-module module-gsettings
.fail
.endif


### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music/video streams when a phone stream is active
load-module module-role-cork

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

### Make some devices default
#set-default-sink output
#set-default-source input
$ cat /etc/pulse/system.pa 
#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

# This startup script is used only if PulseAudio is started in system
# mode.

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev/hal support)
load-module module-detect
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### Enable positioned event sounds
load-module module-position-event-sounds

@mviereck
Copy link
Owner

mviereck commented Aug 10, 2018

On the first glance I do not see anything suspicious in the config files.


I did a deep change for --pulseaudio: Instead of sharing already existing unix socket and cookie, a new socket is created (at line 6074):


      # --pulseaudio
      case $Pulseaudiomode in
        socket) Pulseaudiomoduleid="$(pactl load-module module-native-protocol-unix socket=$Sharefolder/pulseaudio.socket)" ;;
        #socket) Pulseaudiomoduleid="$(pactl load-module module-native-protocol-unix socket=$Sharefolder/pulseaudio.socket auth-anonymous=1)" ;;
        tcp)    Pulseaudiomoduleid="$(pactl load-module module-native-protocol-tcp  port=$Pulseaudioport auth-ip-acl=$(cat $Containeripfile))" ;;
      esac

If this fails on your system, you may try to disable socket) line and enable #socket) line to run with or without auth-anonymous=1.


In container variable PULSE_COOKIE is specified at line 3237, but x11docker does not create a cookie.
Magically the specified cookie appears in /x11docker/pulseaudio.cookie. I assume there is some sort of automatic pulseaudio cookie exchange.

      Customenvironment="PULSE_SERVER=unix:$Cshare/pulseaudio.socket
PULSE_COOKIE=$Cshare/pulseaudio.cookie
$Customenvironment"

You can try whether removing PULSE_COOKIE=$Cshare/pulseaudio.cookie makes a difference.

@mviereck
Copy link
Owner

mviereck commented Aug 10, 2018

I did a test in a new arch VM with pulseaudio 12.2 and image built with:

FROM base/archlinux:2018.08.01
RUN pacman -Syu --noconfirm pulseaudio pulseaudio-alsa pavucontrol
CMD ["pavucontrol"]

It works! 🎉

@sandrokeil
Copy link
Contributor Author

Confirmed 🎉 👍 It works now with pulseaudio=socket in pavucontrol, wine (Pulseaudio ALSA) and steam ...

So x11docker must load it's own socket?

$(pactl load-module module-native-protocol-unix socket=$Sharefolder/pulseaudio.socket)

Again, thank you very much for your effort. 👏

@mviereck
Copy link
Owner

mviereck commented Aug 11, 2018

Confirmed

:-)

So x11docker must load it's own socket?

Yes. I am not sure why sharing the regular socket fails. Probably some sort of authentication issue, although we tried to share the cookie.

Again, thank you very much for your effort.

You are welcome.

Maybe you could help me? If you happen to have a Windows 10 installation (on host, not in VM), you could run some tests for me. I yet finished experimental pulseaudio support for MSYS2, Cygwin and WSL on Windows. I was hoping for 1138-4EB to do some tests (#70), but it seems he is too busy.
I have Win10 in a VM only, and docker does not run in it (nested virtualization issue), so I am missing some final checks.

@sandrokeil
Copy link
Contributor Author

If you happen to have a Windows 10 installation (on host, not in VM), you could run some tests for me.

I'm sorry, I don't have a Windows machine.

@mviereck
Copy link
Owner

mviereck commented Aug 18, 2018

@sandrokeil
Copy link
Contributor Author

@mviereck I just want to let you know that I have upgraded my Arch Linux system and Docker images to latest versions and current x11docker master does not work, but x11docker version 5.2 works fine. It can't connect to pulseaudio server. Nothing special in the logs.

Do you have made any changes in master for pulseaudio since version 5.2?

mviereck added a commit that referenced this issue Oct 2, 2018
@mviereck
Copy link
Owner

mviereck commented Oct 2, 2018

Thanks for reporting! It is fixed now.

Do you have made any changes in master for pulseaudio since version 5.2?

I did a great code change putting the long linear code flow into functions() and creating a short main() routine that gives an easier overview of x11docker code flow.
Accidently I've deleted a pulseaudio check during this operation that changes auto mode into tcp or socket.

Nothing special in the logs.

I got this in terminal without the logs: ;-)

x11docker WARNING: Unknown pulseaudio mode: auto
  Allowed are --pulseaudio=socket or --pulseaudio=tcp
  Fallback: disabling option --pulseaudio

@sandrokeil
Copy link
Contributor Author

Thanks for reporting! It is fixed now.

Thank you for fixing it. :-) I didn't noticed this warning. It works now with current master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants