Audio not working on first login of one user

Using the KDE edition, I have two users. For user A, audio works correctly in all cases. As of recently, for user B, on the first login after booting, no audio plays, and KDE shows no audio devices connected. pulseaudio --check confirms it is running, and running aplay -l shows a list of all the correct audio hardware. I can get audio to play and all audio devices to show up in KDE's settings if I log out of user B and then log back in, or if I kill pulseaudio and restart the daemon. Once the pulseaudio daemon has been restarted once, there won't be any more issues until I reboot again.

Also possibly worth noting--about once in every 20 or so times, audio works correctly on the first login for user B, but only once in every 20 or so times.

Here's what I've tried so far with no success:

  • Deleting ~/.config/pulse
  • Adding user B to the 'audio' group
  • Reinstalling plasma-pa
  • Reinstalling pulseaudio

If anyone has any ideas of other things to try, I'm keen to hear them.

Also, in case it is relevant:

Is pulseaudio both enabled and started in systemd services?

regards

install and run paprefs and enable this setting:

OR

the Archwiki way - https://wiki.archlinux.org/index.php/PulseAudio/Examples#Allowing_multiple_users_to_use_PulseAudio_at_the_same_time

I checked systemctl --user status pulseaudio.service pulseaudio.socket and see that they failed to start:

● pulseaudio.service - Sound Service
   Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-11-04 09:45:27 EST; 11min ago
  Process: 1828 ExecStart=/usr/bin/pulseaudio --daemonize=no (code=exited, status=1/FAILURE)
 Main PID: 1828 (code=exited, status=1/FAILURE)

Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Service RestartSec=100ms expired, scheduling restart.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Scheduled restart job, restart counter is at 5.
Nov 04 09:45:27 manjaro systemd[1274]: Stopped Sound Service.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Start request repeated too quickly.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Failed with result 'exit-code'.
Nov 04 09:45:27 manjaro systemd[1274]: Failed to start Sound Service.

● pulseaudio.socket - Sound System
   Loaded: loaded (/usr/lib/systemd/user/pulseaudio.socket; enabled; vendor preset: enabled)
   Active: failed (Result: service-start-limit-hit) since Mon 2019-11-04 09:45:27 EST; 11min ago
   Listen: /run/user/1000/pulse/native (Stream)

Nov 04 09:45:24 manjaro systemd[1274]: Listening on Sound System.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.socket: Failed with result 'service-start-limit-hit'.

I also do see 'pulseaudio' as a process with ps aux, which lead me to check journalctl --user. It seems that systemd tries and fails to start the pulseaudio service a bunch of times intermixed with a bunch of messages about the pulseaudio daemon already running and it also failing to create some file or something.

Here's the log stuff from when I logged in after a fresh reboot. I'm still struggling to find a way to troubleshoot what to do, though.

Nov 04 09:45:25 manjaro plasma_session[1335]: org.kde.plasma.session: Starting autostart service  "/etc/xdg/autostart/pulseaudio.desktop" ("/usr/bin/start-pulseaudio-x11")
Nov 04 09:45:25 manjaro pulseaudio[1392]: E: [pulseaudio] pid.c: Daemon already running.
Nov 04 09:45:25 manjaro pulseaudio[1392]: E: [pulseaudio] main.c: pa_pid_file_create() failed.
Nov 04 09:45:25 manjaro systemd[1274]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 09:45:25 manjaro systemd[1274]: pulseaudio.service: Failed with result 'exit-code'.
Nov 04 09:45:25 manjaro systemd[1274]: pulseaudio.service: Service RestartSec=100ms expired, scheduling restart.
Nov 04 09:45:25 manjaro systemd[1274]: pulseaudio.service: Scheduled restart job, restart counter is at 1.
Nov 04 09:45:25 manjaro pulseaudio[1537]: E: [pulseaudio] pid.c: Daemon already running.
Nov 04 09:45:25 manjaro pulseaudio[1537]: E: [pulseaudio] main.c: pa_pid_file_create() failed.
Nov 04 09:45:25 manjaro systemd[1274]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 09:45:25 manjaro systemd[1274]: pulseaudio.service: Failed with result 'exit-code'.
Nov 04 09:45:26 manjaro systemd[1274]: pulseaudio.service: Service RestartSec=100ms expired, scheduling restart.
Nov 04 09:45:26 manjaro systemd[1274]: pulseaudio.service: Scheduled restart job, restart counter is at 2.
Nov 04 09:45:26 manjaro pulseaudio[1656]: E: [pulseaudio] pid.c: Daemon already running.
Nov 04 09:45:26 manjaro pulseaudio[1656]: E: [pulseaudio] main.c: pa_pid_file_create() failed.
Nov 04 09:45:26 manjaro systemd[1274]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 09:45:26 manjaro systemd[1274]: pulseaudio.service: Failed with result 'exit-code'.
Nov 04 09:45:26 manjaro systemd[1274]: pulseaudio.service: Service RestartSec=100ms expired, scheduling restart.
Nov 04 09:45:26 manjaro systemd[1274]: pulseaudio.service: Scheduled restart job, restart counter is at 3.
Nov 04 09:45:26 manjaro pulseaudio[1750]: E: [pulseaudio] pid.c: Daemon already running.
Nov 04 09:45:26 manjaro pulseaudio[1750]: E: [pulseaudio] main.c: pa_pid_file_create() failed.
Nov 04 09:45:26 manjaro systemd[1274]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 09:45:26 manjaro systemd[1274]: pulseaudio.service: Failed with result 'exit-code'.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Service RestartSec=100ms expired, scheduling restart.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Scheduled restart job, restart counter is at 4.
Nov 04 09:45:27 manjaro pulseaudio[1828]: E: [pulseaudio] pid.c: Daemon already running.
Nov 04 09:45:27 manjaro pulseaudio[1828]: E: [pulseaudio] main.c: pa_pid_file_create() failed.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Failed with result 'exit-code'.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Service RestartSec=100ms expired, scheduling restart.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Scheduled restart job, restart counter is at 5.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Start request repeated too quickly.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.service: Failed with result 'exit-code'.
Nov 04 09:45:27 manjaro systemd[1274]: pulseaudio.socket: Failed with result 'service-start-limit-hit'.
Nov 04 09:45:27 manjaro pulseaudio[1846]: [pulseaudio] pid.c: Daemon already running.
Nov 04 09:45:29 manjaro pulseaudio[1894]: [pulseaudio] pid.c: Daemon already running.
``

I'm easily confused. Are you running pulseaudio as a system service or user service (--user)?

regards

Sorry, as a user service.

Or at least, that's the intention.

this article usually has the best information about internals of Pulseaudio:
https://gavv.github.io/articles/pulseaudio-under-the-hood/#about-pulseaudio
but a lot of the content is beyond my understanding
i do not see anything about multi-users in there, only appears to show other network protocols

not much in archwiki either
wiki.archlinux.org/PulseAudio/Examples-Switching_the_PulseAudio_server_used_by_local_X_clients
and next part 'when all else fails' suggests using paprefs

from what i know as XFCE user:

need to install pasystray to see Pulseaudio server internals

Normally with Manjaro running within systemd service, my default server is:
unix:/run/user/1000/pulse/native tcp:gnomic:4713 tcp6:gnomic:4713
plus another server for user - gnomic

but if pulseaudio --kill command is used
pulseaudio restarts with just - gnomic

pulseaudio --kill also causes loss of some Pulseaudio modules

  • module-x11-publish (has it's own manpage! man pax11publish)
  • module-x11-smp
  • module-device-manager

last one is only loaded for KDE

freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/
This module was primary written to enable the routing system employed in KDE to work at a lower level

I have posted before about using systemctl --user restart pulseaudio instead of pulseaudio --kill
but i don't think it causes a problem for users not on KDE or using network audio

reboot normally resets Pulseaudio right within systemd service again

startup script '/usr/bin/start-pulseaudio-x11.sh' at boot time loads the 3 modules above

running in system mode is not recommended for desktop use:
freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/

hope some of this helps

In case it is of help to future searchers, I have solved the problem on my machine. I use i3 on top of KDE, and I had forgotten that my i3 config (copied from a non-KDE install) was also set to start pulseaudio, which seemed to somehow be conflicting with KDE trying to also start it.

It is odd in my case that the config was set that way for ages without problem, but removing the line in my i3config that was starting pulseaudio seems to have remedied the problem.

Of note, the reason only one of my users was having issues is because only one uses i3.

Forum kindly sponsored by