263

Sometimes the pulseaudio service stops and it doesn't restart itself when I open an audio file with banshee or totem.

How I can make pulseaudio start again without having to logout?

Kevin Bowen
  • 20,055
  • 57
  • 82
  • 84
gourgi
  • 5,398

10 Answers10

257

I solved my problem.

  1. Check if any pulseaudio instance is running:

     pulseaudio --check
    

It normally prints no output, just exit code. 0 means running. Mine were not running, so I just advanced to step 3.

  1. If any instance is running, kill it:

     pulseaudio -k
    
  2. Finally, start pulseaudio again as a daemon:

     pulseaudio -D
    
  3. Start banshee again and enjoy!

redseven
  • 842
  • 1
  • 8
  • 14
gourgi
  • 5,398
122

Pulseaudio is a user service, so:

systemctl --user restart pulseaudio.service

Also there is this:

systemctl --user restart pulseaudio.socket

For checks replace restart with status.

Rolf
  • 2,229
63

In a standard setup running pulseaudio -k restarts the daemon. Nothing else to do.

In case pulseaudio is not running typing pulseaudio without further options will start the daemon using defaults in /etc/pulse/daemon.conf and /etc/pulse/default.pa.

User-defined settings in ~/.pulse/ or ~/.config/pulse/ will override system-wide settings. In case of issues it will often help to delete these directories before restarting pulseaudio.

For details see PulseAudio Wiki.

Udi
  • 133
Takkat
  • 144,580
18

Following works for me on Ubuntu 18.04:

pulseaudio -k && sudo alsa force-reload
wuarmin
  • 339
16

Use the service command (Ubuntu 14.04 or older only):

sudo service pulseaudio restart
PowerKiKi
  • 954
11

Run the following commands:

pulseaudio --check
pulseaudio --kill
pulseaudio --start
9

Here's how to do it in Ubuntu 15.10:

  1. Launch Terminal
  2. Run pulseaudio -k to kill the running daemon. You will get an error only if no daemon was running, otherwise no messages will appear.
  3. Ubuntu will attempt to restart the daemon automatically assuming there are no problems with the configuration. You can run pulseaudio --check to check that Pulseaudio is running. A clean exit (no message) from the check command indicates that the daemon has started successfully. Otherwise, run pulseaudio --start to launch the daemon. If you recently changed your configuration file and the daemon fails to start, check your file for errors and check the syslog (with the SystemLog app) for any messages from Pulseaudio.
phip
  • 191
  • 1
  • 3
8

If the pulseaudio failing to work is related to S3 sleep (Suspend to RAM), the real cause may be audio hardware problem and then you have to do heavy-handed full reset:

pulseaudio -k && sudo alsa force-reload && sleep 2 && pulseaudio -k && sudo alsa force-reload

Yeah, it needs to be done twice with small delay. I don't know why but this seems to work every time.

If you have multiple desktop environments in parallel (fast user switching)

sudo killall pulseaudio && sudo alsa force-reload && sleep 2 && sudo killall pulseaudio && sudo alsa force-reload
Pablo Bianchi
  • 17,371
5

You would run this command to restart PulseAudio in Ubuntu 2020 releases:

systemctl --user restart pulseaudio
kas
  • 442
5

I'd like to add my penny's worth to my namesake @rolf's systemDanswer.
The scenario:
Pulseaudio is locked up tight

You've tried:

systemctl --user stop pulseaudio.service pulseaudio.socket
systemctl --user restart pulseaudio.service
systemctl --user reset-failed pulseaudio.service

Still stubbonly it shows:

● pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Sun 2022-08-07 17:43:39 CEST; 8min ago
TriggeredBy: ● pulseaudio.socket
    Process: 6598 ExecStart=/usr/bin/pulseaudio --daemonize=no --log-target=journal (code=exited, status=1/FAILURE)
   Main PID: 6598 (code=exited, status=1/FAILURE)

Aug 07 17:43:39 pc1 systemd[1063]: pulseaudio.service: Failed with result 'exit-code'. Aug 07 17:43:39 pc1 systemd[1063]: Failed to start Sound Service. Aug 07 17:43:39 pc1 systemd[1063]: pulseaudio.service: Scheduled restart job, restart counter is at 5. Aug 07 17:43:39 pc1 systemd[1063]: Stopped Sound Service. Aug 07 17:43:39 pc1 systemd[1063]: pulseaudio.service: Start request repeated too quickly. Aug 07 17:43:39 pc1 systemd[1063]: pulseaudio.service: Failed with result 'exit-code'. Aug 07 17:43:39 pc1 systemd[1063]: Failed to start Sound Service.

The key here is that the restart counter has been exceeded.
If you manually run:
pulseaudio -vvvv

You may find the final lines say:

E: [pulseaudio] pid.c: Daemon already running.
E: [pulseaudio] main.c: pa_pid_file_create() failed.

Here, you need to find your user id's /run/user/1000/pulse directory, where the number 1000 is my user id number

Get your uid from the command: id

In the the pulse run directory is a file called pid , delete it!

Try starting pulseaudio -vvvv again, only to discover that it's bound to the Dbus or the bind Address already in use

E: [pulseaudio] main.c: D-Bus name org.PulseAudio1 already taken.
or
E: [pulseaudio] socket-server.c: bind(): Address already in use

So: ps -ef | grep pulseaudio to find any process still running it and kill it with

kill -15 pid number from grep

Now you can restart pulseaudio:

systemctl --user start pulseaudio.service pulseaudio.socket

or:

You could logout and log back in again :)

zoechi
  • 127
  • 1
  • 6