No sound .... sometimes

Dear all,
I have an odd issue : On Manjaro Xfce, sometimes, when my Dell XPS 13 boots up, I cannot get any audio. and sometimes it will work.
Although the issue seems to be random, I can force the issue being 100% reproducible , depending on the settings of my previous boot and the headphones being plugged in or not currently.

Notes: I only use the laptop speakers or eventually the headphones attached to the laptop (same source)

01. Sound Test

paplay /usr/share/sounds/freedesktop/stereo/audio-test-signal.oga

  1. When it works:
    Sound could be heard successfully

  2. When it does NOT work:
    No sound could be heard, and paplay gives:

Connection failure: Connection refused
pa_context_connect() failed: Connection refused

02. Audio Mixer to change the output

pavucontrol

  1. When it works:
    pavucontrol GUI loaded successfully, and I can change the volume or the outputs for instance:

  2. When it does NOT work:
    pavucontrol GUI loaded, but it would not work:
    pavucontrol-issue_2023-03-06_08-36-53

03. The pulseaudio service

systemctl --user status pulseaudio.service

  1. When it works:
● pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-03-05 09:43:45 GMT; 8min ago
   Main PID: 1701 (pulseaudio)
      Tasks: 11 (limit: 18822)
     Memory: 40.8M
        CPU: 18.473s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pulseaudio.service
             β”œβ”€1701 /usr/bin/pulseaudio --daemonize=no --log-target=journal
             └─1803 /usr/lib/pulse/gsettings-helper

Mar 05 09:43:44 Loki systemd[1694]: Starting Sound Service...
Mar 05 09:43:45 Loki pulseaudio[1701]: stat('/etc/pulse/default.pa.d'): No such file or directory
Mar 05 09:43:45 Loki systemd[1694]: Started Sound Service.
Mar 05 09:43:45 Loki pulseaudio[1701]: Could not find org.bluez.BatteryProviderManager1.RegisterBatteryProvider(), is bluetoothd started with experimental features enabled (-E flag)?
  1. When it does NOT work:
● pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; enabled; preset: enabled)
     Active: deactivating (stop-sigkill) (Result: timeout)
   Main PID: 1608 (pulseaudio)
      Tasks: 1 (limit: 18822)
     Memory: 8.6M
        CPU: 128ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pulseaudio.service
             └─1608 /usr/bin/pulseaudio --daemonize=no --log-target=journal

Mar 06 11:08:52 Loki systemd[1601]: Starting Sound Service...
Mar 06 11:10:22 Loki systemd[1601]: pulseaudio.service: start operation timed out. Terminating.
Mar 06 11:11:52 Loki systemd[1601]: pulseaudio.service: State 'stop-sigterm' timed out. Killing.
Mar 06 11:11:52 Loki systemd[1601]: pulseaudio.service: Killing process 1608 (pulseaudio) with signal SIGKILL.

04. The pipewire service

systemctl --user status pipewire.service

  1. When it works:
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; disabled; preset: enabled)
     Active: active (running) since Sun 2023-03-05 09:43:47 GMT; 8min ago
TriggeredBy: ● pipewire.socket
   Main PID: 2137 (pipewire)
      Tasks: 2 (limit: 18822)
     Memory: 2.0M
        CPU: 16ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─2137 /usr/bin/pipewire

Mar 05 09:43:47 Loki systemd[1694]: Started PipeWire Multimedia Service.
Mar 05 09:43:47 Loki pipewire[2137]: mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
Mar 05 09:43:47 Loki pipewire[2137]: mod.rt: found session bus but no portal
  1. When it does NOT work:
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; disabled; preset: enabled)
     Active: active (running) since Mon 2023-03-06 11:08:55 GMT; 3min 29s ago
TriggeredBy: ● pipewire.socket
   Main PID: 1986 (pipewire)
      Tasks: 2 (limit: 18822)
     Memory: 1.9M
        CPU: 12ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─1986 /usr/bin/pipewire

Mar 06 11:08:55 Loki systemd[1601]: Started PipeWire Multimedia Service.
Mar 06 11:08:55 Loki pipewire[1986]: mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
Mar 06 11:08:55 Loki pipewire[1986]: mod.rt: found session bus but no portal

05. The pulseaudio journalctl

journalctl --user -xeu pulseaudio.service

  1. When it works:
Mar 05 09:43:44 Loki systemd[1694]: Starting Sound Service...
β–‘β–‘ Subject: A start job for unit UNIT has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://forum.manjaro.org/c/support
β–‘β–‘ 
β–‘β–‘ A start job for unit UNIT has begun execution.
β–‘β–‘ 
β–‘β–‘ The job identifier is 25.
Mar 05 09:43:45 Loki pulseaudio[1701]: stat('/etc/pulse/default.pa.d'): No such file or directory
Mar 05 09:43:45 Loki systemd[1694]: Started Sound Service.
β–‘β–‘ Subject: A start job for unit UNIT has finished successfully
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://forum.manjaro.org/c/support
β–‘β–‘ 
β–‘β–‘ A start job for unit UNIT has finished successfully.
β–‘β–‘ 
β–‘β–‘ The job identifier is 25.
Mar 05 09:43:45 Loki pulseaudio[1701]: Could not find org.bluez.BatteryProviderManager1.RegisterBatteryProvider(), is bluetoothd started with experimental features enabled (-E flag)?
  1. When it does NOT work:
Mar 06 11:08:52 Loki systemd[1601]: Starting Sound Service...
β–‘β–‘ Subject: A start job for unit UNIT has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://forum.manjaro.org/c/support
β–‘β–‘ 
β–‘β–‘ A start job for unit UNIT has begun execution.
β–‘β–‘ 
β–‘β–‘ The job identifier is 26.
Mar 06 11:10:22 Loki systemd[1601]: pulseaudio.service: start operation timed out. Terminating.
Mar 06 11:11:52 Loki systemd[1601]: pulseaudio.service: State 'stop-sigterm' timed out. Killing.
Mar 06 11:11:52 Loki systemd[1601]: pulseaudio.service: Killing process 1608 (pulseaudio) with signal SIGKILL.

06. Check Pulseaudio

pulseaudio -v --check

  1. When it works:
I: [pulseaudio] main.c: Daemon running as PID 1701
  1. When it does NOT work:
I: [pulseaudio] main.c: Daemon running as PID 1608

10. Additional details

The command inxi -A gives:

Audio:
  Device-1: Intel Tiger Lake-LP Smart Sound Audio
    driver: sof-audio-pci-intel-tgl
  Device-2: Realtek USB Audio type: USB driver: snd-usb-audio
  Sound API: ALSA v: k6.1.9-1-MANJARO running: yes
  Sound Server-1: PulseAudio v: 16.1 running: yes
  Sound Server-2: PipeWire v: 0.3.65 running: yes

pulseaudio.service should be disabled (same as pipewire.service) so it is controlled by pulseaudio.socket

/usr/lib/systemd/user/pulseaudio.service

# We require pulseaudio.socket to be active before starting the daemon, because
# while it is possible to use the service without the socket, it is not clear
# why it would be desirable.
#
# A user installing pulseaudio and doing `systemctl --user start pulseaudio`
# will not get the socket started, which might be confusing and problematic if
# the server is to be restarted later on, as the client autospawn feature
# might kick in. Also, a start of the socket unit will fail, adding to the
# confusion.

Requires=pulseaudio.socket
systemctl --user disable pulseaudio.socket

Also suggest deleting PulseAudio user databases and cookie to get rid of any old settings

rm ~/.config/pulse/*.tdb ~/.config/pulse/cookie

reboot system so PulseAudio is restarted to create new database files

If audio is not working as expected check pulseaudio.socket and pulseaudio.service

systemctl --user -l --no-pager status pulseaudio.socket pulseaudio.service

Warning messages about /etc/pulse/default.pa.d folder and org.bluez.BatteryProviderManager1 are not critical and would not cause PulseAudio to fail

1 Like

Thanks for your quick response @nikgnomic
I have marked your answer as Solution, as it seems to work at first sight.

I have to say that the commands have returned the following:
systemctl --user disable pulseaudio.socket gave me:

Unit /home/chris/.config/systemd/user/pulseaudio.socket is masked, ignoring.

and systemctl --user -l --no-pager status pulseaudio.socket pulseaudio.service gave me :

β—‹ pulseaudio.socket
     Loaded: masked (Reason: Unit pulseaudio.socket is masked.)
     Active: inactive (dead)

● pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; enabled; preset: enabled)
     Active: active (running) since Mon 2023-03-06 14:22:12 GMT; 3h 41min ago
   Main PID: 1605 (pulseaudio)
      Tasks: 14 (limit: 18822)
     Memory: 43.4M
        CPU: 7.250s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pulseaudio.service
             β”œβ”€1605 /usr/bin/pulseaudio --daemonize=no --log-target=journal
             └─1712 /usr/lib/pulse/gsettings-helper

Mar 06 14:22:11 Loki systemd[1598]: Starting Sound Service...
Mar 06 14:22:12 Loki pulseaudio[1605]: stat('/etc/pulse/default.pa.d'): No such file or directory
Mar 06 14:22:12 Loki systemd[1598]: Started Sound Service.
Mar 06 14:22:12 Loki pulseaudio[1605]: Could not find org.bluez.BatteryProviderManager1.RegisterBatteryProvider(), is bluetoothd started with experimental features enabled (-E flag)?

Hope this was the intended behavior.

Command to disable pulseaudio.service was ignored because pulseaudio.socket has been masked

Usual status of systemd units should look like this:

systemctl --user -l --no-pager status pulseaudio.{socket,service}
● pulseaudio.socket - Sound System
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.socket; enabled; preset: enabled)
     Active: active (running) since Tue 2023-03-07 07:31:20 GMT; 55min ago
      Until: Tue 2023-03-07 07:31:20 GMT; 55min ago
   Triggers: ● pulseaudio.service
     Listen: /run/user/1000/pulse/native (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pulseaudio.socket

Mar 07 07:31:20 gnomic systemd[1044]: Listening on Sound System.

● pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; preset: enabled)
     Active: active (running) since Tue 2023-03-07 07:31:23 GMT; 55min ago
TriggeredBy: ● pulseaudio.socket
   Main PID: 1138 (pulseaudio)
      Tasks: 2 (limit: 19078)
     Memory: 31.4M
        CPU: 23.376s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pulseaudio.service
             └─1138 /usr/bin/pulseaudio --daemonize=no --log-target=journal

Mar 07 07:31:22 gnomic systemd[1044]: Starting Sound Service...
Mar 07 07:31:23 gnomic systemd[1044]: Started Sound Service.

I suggest using the following commands to use both systemd units

systemctl --user stop pulseaudio.service
systemctl --user unmask pulseaudio.socket
systemctl --user disable pulseaudio.service
systemctl --user enable pulseaudio.socket
systemctl --user restart pulseaudio
1 Like

Similar output :

systemctl --user -l --no-pager status pulseaudio.{socket,service}
$ systemctl --user -l --no-pager status pulseaudio.{socket,service}
● pulseaudio.socket - Sound System
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.socket; enabled; preset: enabled)
     Active: active (running) since Tue 2023-03-07 15:25:02 GMT; 1h 54min ago
      Until: Tue 2023-03-07 15:25:02 GMT; 1h 54min ago
   Triggers: ● pulseaudio.service
     Listen: /run/user/1000/pulse/native (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pulseaudio.socket

Mar 07 15:25:02 Loki systemd[1658]: Listening on Sound System.

● pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; preset: enabled)
     Active: active (running) since Tue 2023-03-07 15:25:03 GMT; 1h 54min ago
TriggeredBy: ● pulseaudio.socket
   Main PID: 1751 (pulseaudio)
      Tasks: 14 (limit: 18822)
     Memory: 37.2M
        CPU: 3min 23.500s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pulseaudio.service
             β”œβ”€1751 /usr/bin/pulseaudio --daemonize=no --log-target=journal
             └─1775 /usr/lib/pulse/gsettings-helper

Mar 07 15:25:02 Loki systemd[1658]: Starting Sound Service...
Mar 07 15:25:03 Loki pulseaudio[1751]: stat('/etc/pulse/default.pa.d'): No such file or directory
Mar 07 15:25:03 Loki systemd[1658]: Started Sound Service.
Mar 07 15:25:03 Loki pulseaudio[1751]: Could not find org.bluez.BatteryProviderManager1.RegisterBatteryProvider(), is bluetoothd started with experimental features enabled (-E flag)?

and no more sound issues during the last 5 reboots.
You’re truly a star, Thanks

1 Like

Dear @nikgnomic and all,
I do not think this requires a new thread. But I am happy to do so , if required.

I started my computer this evening. and I got no sound , plus this output:

systemctl --user -l --no-pager status pulseaudio.{socket,service}
$ systemctl --user -l --no-pager status pulseaudio.{socket,service}
● pulseaudio.socket - Sound System
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.socket; enabled; preset: enabled)
     Active: active (running) since Wed 2023-03-08 16:47:33 GMT; 2min 45s ago
      Until: Wed 2023-03-08 16:47:33 GMT; 2min 45s ago
   Triggers: ● pulseaudio.service
     Listen: /run/user/1000/pulse/native (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pulseaudio.socket

Mar 08 16:47:33 Loki systemd[1642]: Listening on Sound System.

● pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; preset: enabled)
     Active: deactivating (stop-sigterm) (Result: timeout)
TriggeredBy: ● pulseaudio.socket
   Main PID: 1735 (pulseaudio)
      Tasks: 4 (limit: 18822)
     Memory: 5.8M
        CPU: 91ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pulseaudio.service
             └─1735 /usr/bin/pulseaudio --daemonize=no --log-target=journal

Mar 08 16:47:33 Loki systemd[1642]: Starting Sound Service...
Mar 08 16:49:04 Loki systemd[1642]: pulseaudio.service: start operation timed out. Terminating.

where one can see that pulseaudio.service is struggling for some reason.
So I decided to stop and restart pulseaudio with :

systemctl --user stop pulseaudio.service
$ systemctl --user stop pulseaudio.service
Warning: Stopping pulseaudio.service, but it can still be activated by:
  pulseaudio.socket

Note: that command above froze firefox for 10+ min.

Then I ran :

systemctl --user restart pulseaudio
$ systemctl --user restart pulseaudio
Job for pulseaudio.service failed because the control process exited with error code.
See "systemctl --user status pulseaudio.service" and "journalctl --user -xeu pulseaudio.service" for details.

For details , I ran the 2 commands, but I am not convinced they truly provide the right details:

systemctl --user -l --no-pager status pulseaudio.service
$ systemctl --user -l --no-pager status pulseaudio.service
● pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; preset: enabled)
     Active: activating (start) since Wed 2023-03-08 17:01:44 GMT; 1min 7s ago
TriggeredBy: ● pulseaudio.socket
   Main PID: 4446 (pulseaudio)
      Tasks: 4 (limit: 18822)
     Memory: 4.1M
        CPU: 48ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pulseaudio.service
             └─4446 /usr/bin/pulseaudio --daemonize=no --log-target=journal

Mar 08 17:01:44 Loki systemd[1642]: Starting Sound Service...
Mar 08 17:01:44 Loki pulseaudio[4446]: Stale PID file, overwriting.

and:

journalctl --user -xeu pulseaudio.service
$ journalctl --user -xeu pulseaudio.service
β–‘β–‘ 
β–‘β–‘ A start job for unit UNIT has finished with a failure.
β–‘β–‘ 
β–‘β–‘ The job identifier is 422 and the job result is failed.
Mar 08 17:01:44 Loki systemd[1642]: pulseaudio.service: Scheduled restart job, restart counter is at 1.
β–‘β–‘ Subject: Automatic restarting of a unit has been scheduled
β–‘β–‘ Defined-By: systemd
β–‘β–‘ 
β–‘β–‘ Automatic restarting of the unit UNIT has been scheduled, as the result for
β–‘β–‘ the configured Restart= setting for the unit.
Mar 08 17:01:44 Loki systemd[1642]: Stopped Sound Service.
β–‘β–‘ Subject: A stop job for unit UNIT has finished
β–‘β–‘ Defined-By: systemd
β–‘β–‘ 
β–‘β–‘ A stop job for unit UNIT has finished.
β–‘β–‘ 
β–‘β–‘ The job identifier is 501 and the job result is done.
Mar 08 17:01:44 Loki systemd[1642]: Starting Sound Service...
β–‘β–‘ Subject: A start job for unit UNIT has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ 
β–‘β–‘ A start job for unit UNIT has begun execution.
β–‘β–‘ 
β–‘β–‘ The job identifier is 501.
Mar 08 17:01:44 Loki pulseaudio[4446]: Stale PID file, overwriting.
Mar 08 17:03:14 Loki systemd[1642]: pulseaudio.service: start operation timed out. Terminating.

If pulseaudio.service only is restarted (2nd command in post #6) and not pulseaudio.socket the service fails in similar manner to post #1 ( deactivating (stop-sigterm) (Result: timeout) )
PulseAudio sound server also fails and is not available to support audio from Firefox
So audio and video playback does not work in Firefox

The 5 commands in post #4 were to remediate masked pulseaudio.socket and correct configuration of socket and service

Under normal conditions, only the final command is needed to restart both PulseAudio systemd units:

  1.  systemctl --user restart pulseaudio
    

if a user wants to stop PulseAudio (to use ALSA only) both systemd units should be stopped:

  1. systemctl --user stop pulseaudio.socket pulseaudio.socket
    
status of pulseaudio systemd units when stopped
systemctl --user -l --no-pager status pulseaudio.{socket,service}
β—‹ pulseaudio.socket - Sound System
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.socket; enabled; preset: enabled)
     Active: inactive (dead) since Fri 2023-03-10 10:07:34 GMT; 36s ago
   Duration: 2h 57min 15.787s
   Triggers: ● pulseaudio.service
     Listen: /run/user/1000/pulse/native (Stream)

Mar 10 07:10:18 gnomic systemd[1037]: Listening on Sound System.
Mar 10 10:07:34 gnomic systemd[1037]: Closed Sound System.

β—‹ pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; preset: enabled)
     Active: inactive (dead) since Fri 2023-03-10 10:07:34 GMT; 36s ago
   Duration: 2h 57min 12.570s
TriggeredBy: β—‹ pulseaudio.socket
    Process: 1131 ExecStart=/usr/bin/pulseaudio --daemonize=no --log-target=journal (code=exited, status=0/SUCCESS)
   Main PID: 1131 (code=exited, status=0/SUCCESS)
        CPU: 1min 12.026s

Mar 10 07:10:21 gnomic systemd[1037]: Starting Sound Service...
Mar 10 07:10:21 gnomic systemd[1037]: Started Sound Service.
Mar 10 10:07:34 gnomic systemd[1037]: Stopping Sound Service...
Mar 10 10:07:34 gnomic systemd[1037]: Stopped Sound Service.
Mar 10 10:07:34 gnomic systemd[1037]: pulseaudio.service: Consumed 1min 12.026s CPU time.

use first command to restart systemd units

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.