September 29, 2014
 
 
RSSRSS feed

Ubuntu Tip: Turning PulseAudio On and Off - page 2

Overlapping Controls and Confusion

  • July 22, 2010
  • By Carla Schroder
pulseaudio is a stubborn little daemon. man pulseaudio says you can turn it off with the command pulseaudio --kill. But it won't stay killed-- it respawns itself. There is a normal init script to start it at boot, /etc/rc2.d/S50pulseaudio. But when you try controlling this the normal Linux way it doesn't work, because running /etc/init.d/pulseaudio stop doesn't stop it. Removing /etc/rc2.d/S50pulseaudio doesn't prevent it from starting at boot.

To stop its respawning habit, open /etc/pulse/client.conf, change autospawn = yes to autospawn = no, and set daemon-binary to /bin/true. Make sure these lines are uncommented, like this:

autospawn = no
daemon-binary = /bin/true 
Now we can deal with the normal Linux startup files. First delete /etc/rc2.d/S50pulseaudio. Or you may rename it to a kill command, which preserves the link in case you ever want it again:
# mv /etc/rc2.d/S50pulseaudio /etc/rc2.d/K50pulseaudio
This link may be named something else, like /etc/rc2.d/S03pulseaudio or some such, so verify the exact file name.

There may be one more startup file to dispense with: /etc/X11/Xsession.d/70pulseaudio. This starts Pulse when a Gnome session starts. Delete it or copy it to a different directory in case you want to save it, and again verify the exact file name.

A useful trick, when you find scripts that start PulseAudio, is to change the binary that they call from /usr/bin/pulseaudio to /bin/true. This is a nice little executable whose only job is to "do nothing, successfully". It keeps the scripts happy, and it's a convenient placeholder if you ever want to change it back.

Now that you have purged all the startup and respawning scripts, how do you stop and start PulseAudio? Easy as pie:

$ pulseaudio --kill
$ pulseaudio --start
Now you are in charge, and that is the way it should be.

Carla Schroder is the author of the Linux Cookbook and the Linux Networking Cookbook (O'Reilly Media), the upcoming "Book of Audacity" (NoStarch Press), a lifelong book lover, and the managing editor of Linux Planet and Linux Today.

Sitemap | Contact Us