To start with, this bug only happens when I load module-x11-bell. I'm starting pulseaudio immediately so that it can handle X11 bell events immediately. When socket activation is on, though, pulseaudio fails to start. These are the first few error messages: Nov 25 10:54:28 lazarus slim[433]: E: [pulseaudio] socket-server.c: bind(): Address already in use Nov 25 10:54:28 lazarus slim[433]: E: [pulseaudio] module.c: Failed to load module "module-native-protocol-unix" (argument: ""): initialization failed. Nov 25 10:54:28 lazarus slim[433]: E: [pulseaudio] main.c: Module load failed. Nov 25 10:54:28 lazarus systemd[471]: Starting Sound Service... Nov 25 10:54:28 lazarus slim[433]: E: [pulseaudio] main.c: Failed to initialize daemon. This happens with slim and with startx. Delaying pulseaudio's start by about 2 seconds resolves the race condition for both. Disabling socket activation also resolves the race condition: mkdir -p ~/.config/systemd/user systemctl --user mask pulseaudio.socket I'll come back with the -vvvvv output.
Created attachment 120123 [details] startup log with -vvvvv
(In reply to Eric Toombs from comment #0) > I'm starting pulseaudio immediately so that it can handle X11 bell events > immediately. What does this mean? How do you start pulseaudio?
(In reply to Tanu Kaskinen from comment #2) > (In reply to Eric Toombs from comment #0) > > I'm starting pulseaudio immediately so that it can handle X11 bell events > > immediately. > > What does this mean? How do you start pulseaudio? Oh, I meant I put pulseaudio & in my .xinitrc. The same thing also happens when I start pulseaudio from the
Sorry, I accidentally posted before finishing the sentence. The same thing also happens when I start pulseaudio from the "Application Autostart" tab of XFCE's "Session and Startup" application.
If pulseaudio is managed by systemd, others shouldn't try to start it. If you need to load module-x11-bell automatically when the X session starts, it should be sufficient to just load the module with pactl. The socket activation should ensure that pactl will be able talk to the server even if it's not running.
(In reply to Tanu Kaskinen from comment #5) > If pulseaudio is managed by systemd, others shouldn't try to start it. > > If you need to load module-x11-bell automatically when the X session starts, > it should be sufficient to just load the module with pactl. The socket > activation should ensure that pactl will be able talk to the server even if > it's not running. I just tried that. I put this line pactl load-module module-x11-bell sample=x11-bell in my .xinitrc. It didn't work. The error messages about the socket are gone now, though. Now, the first error is this: Nov 26 15:07:27 lazarus pulseaudio[544]: E: [pulseaudio] x11wrap.c: XOpenDisplay() failed Nov 26 15:07:27 lazarus pulseaudio[544]: E: [pulseaudio] module.c: Failed to load module "module-x11-bell" (argument: "sample=x11-bell"): initialization failed. Nov 26 15:07:27 lazarus slim[438]: Failure: Module initialization failed I'm attaching the rest of the startup log.
Created attachment 120153 [details] the systemd log of events leading up to the pactl module load failure.
So XOpenDisplay() failed. That must be because the DISPLAY environment variable is not set in the context of systemd, and since pulseaudio is started by systemd, pulseaudio will inherit the environment variables from systemd. I think there's some way to "upload" environment variables to systemd, but in this case you could also pass the "display" argument to module-x11-bell.
I am getting the same error, I am running Ubuntu and simply doing xset b 100 pactl load-module module-x11-bell display=:0.0 sample=bell.ogg pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg In my .xprofile. The server is running (I confirmed that using "pidof pulseaudio"). When I retry the second command, it always fails. The third always succeeds.
(In reply to Janus Troelsen from comment #9) > I am getting the same error, I am running Ubuntu and simply doing Which error? "bind(): Address already in use" or "XOpenDisplay() failed"? Does Ubuntu start pulseaudio via systemd's socket activation or the old autospawn mechanism?
Regarding comment #8, I think what you're looking for is: dbus-update-activation-environment --systemd --all
Regarding comment #10: The error I was talking about is "Failure: Module initialization failed". I don't know how PulseAudio is started.
"Failure: Module initialization failed" can happen for many reasons. Let's not debug it here, since there doesn't seem to be any real connection to the original bug report. You can either send a help request to the mailing list, or if you think it really is a bug in pulseaudio rather than just misconfiguration on your part, file a new bug report.
Sorry, my previous message wasn't really appropriate. I misremembered what had been said before. So you get "Failure: Module initialization failed" when you try to load module-x11-bell with pactl. Does the "XOpenDisplay() failed" error appear in /var/log/syslog? Are you sure that :0.0 is the right display string? I'm on Debian, and I have just :0 in $DISPLAY.
You were right, Tanu. The error is due to the fact that pulseaudio didn't know which display to use. The following two lines in .xinitrc work fine: pactl upload-sample /usr/share/sounds/freedesktop/stereo/bell.oga x11-bell pactl load-module module-x11-bell sample=x11-bell display=:0.0 It is pretty clear that the method of having the following lines ### Load something into the sample cache load-sample-lazy x11-bell /usr/share/sounds/freedesktop/stereo/bell.oga ### Load X11 bell module load-module module-x11-bell sample=x11-bell uncommented in /etc/pulse/default.pa was supposed to work, since those lines are provided by pulseaudio. Either pulseaudio should be modified so that uncommenting those lines does work, or else those lines should be changed or removed. Adding display=:0.0 to the arguments of module-x11-bell would work for the vast majority of cases.
(In reply to Eric Toombs from comment #15) > It is pretty clear that the method of having the following lines > > ### Load something into the sample cache > load-sample-lazy x11-bell /usr/share/sounds/freedesktop/stereo/bell.oga > ### Load X11 bell module > load-module module-x11-bell sample=x11-bell > > uncommented in /etc/pulse/default.pa was supposed to work, since those lines > are provided by pulseaudio. Either pulseaudio should be modified so that > uncommenting those lines does work, or else those lines should be changed or > removed. Adding display=:0.0 to the arguments of module-x11-bell would work > for the vast majority of cases. It's not possible to put any X11 examples to default.pa that would reliably work, therefore I prefer removing the examples. Patch submitted: https://patchwork.freedesktop.org/patch/72830/
The patch is now applied, I'm marking this bug as fixed.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.