Page 1 of 1

pulseaudio start on boot?

Posted: Wed Aug 03, 2016 10:58 pm
by EchoEum
how do i get pulseaudio to start on boot?

Right now I have to execute

Code: Select all

pulseaudio -D
manualy at the start of each laumch

Re: pulseaudio start on boot?

Posted: Thu Aug 04, 2016 9:33 am
by pcmanbob
Hi.

A quick google search suggest this may be the required.

/etc/pulse/client.conf change "autospawn=no" to "autospawn=yes."

Re: pulseaudio start on boot?

Posted: Thu Aug 04, 2016 2:27 pm
by EchoEum
pcmanbob wrote:Hi.

A quick google search suggest this may be the required.

/etc/pulse/client.conf change "autospawn=no" to "autospawn=yes."
I found that article before I posted. I looked in that file and didn't see those options at all.

Do you think I should just add them in?

Re: pulseaudio start on boot?

Posted: Thu Aug 04, 2016 2:31 pm
by EchoEum
Actually I just looked again and it seems the option is there and already set to "yes"

Re: pulseaudio start on boot?

Posted: Thu Aug 04, 2016 2:35 pm
by EchoEum

Code: Select all

# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.

## Configuration file for PulseAudio clients. See pulse-client.conf(5) for
## more information. Default values are commented out.  Use either ; or # for
## commenting.

; default-sink =
; default-source =
; default-server =
; default-dbus-server =

 autospawn = yes
; daemon-binary = /usr/bin/pulseaudio
; extra-arguments = --log-target=syslog

; cookie-file =

; enable-shm = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB

; auto-connect-localhost = no
; auto-connect-display = no

Re: pulseaudio start on boot?

Posted: Thu Aug 04, 2016 4:05 pm
by pcmanbob
found this don't know if it will help but it talks about setting up the daemon to auto start .

In their zeal to discourage anyone from running Pulseaudio in system mode, the Pulseaudio maintainers do not ship any startup script in the distribution packages – this ensures that users who don’t know what they are doing don’t stray off the beaten path of orthodox desktop usage and end up on a forum complaining that Pulseaudio doesn’t work. But it also annoys the other users, who actually need Pulseaudio to run at system startup – but that is easily fixable thanks to another creation of Lennart’s gang: all we need is a single file called a systemd unit… I copied one from this guy who also plays with Pulseaudio network streaming (but in a different way – more on that later). This systemd unit was written for Fedora, but it works just as well for Raspbian… Copy this and paste it in /etc/systemd/system/pulseaudio.service :

[Unit]
Description=PulseAudio Daemon

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
PrivateTmp=true
ExecStart=/usr/bin/pulseaudio –system –realtime –disallow-exit –no-cpu-limit

Then ‘systemctl enable pulseaudio’ and ‘systemctl start pulseaudio’ – you now have a properly set up Pulseaudio daemon.

this is were I found it.
http://serendipity.ruwenzori.net/index. ... e-easy-way

Re: pulseaudio start on boot?

Posted: Thu Aug 04, 2016 5:35 pm
by EchoEum
hmmm... did this work for you?

I just gave it a go and had no luck.

Re: pulseaudio start on boot?

Posted: Fri Aug 05, 2016 9:40 am
by pcmanbob
Its been a while since I played with pulseaudio and never had it running automatically as far as I can remember, may be the answer is to just start it at boot using crontab -e and adding the line @reboot pulseaudio -D.

you may need to add the full path before the pulseaudio.

If that does not work then I am out of ideas.

Re: pulseaudio start on boot?

Posted: Fri Aug 05, 2016 1:58 pm
by Douglas6
I run PulseAudio in system-wide mode and start it with a service unit. I followed the instructions here: https://github.com/davidedg/NAS-mod-con ... Audio5.txt. Remember PA will be running as root, so you need to give root pulse-access permissions.

Re: pulseaudio start on boot?

Posted: Sat Jan 12, 2019 2:26 am
by Tac0boutit
EchoEum wrote:
Thu Aug 04, 2016 5:35 pm
hmmm... did this work for you?

I just gave it a go and had no luck.
I know this is old, but the problem still exists and there is no solution here, but I have found it. Since the service file code provided was not in a 'code' block, the double '-'s were converted to the special double hyphen character. You probably received a 'Too many arguments' error like I did. Edit your own file and convert the leading hyphens to two regular ones, or copy the pre-formatted code below:

Code: Select all

[Unit]
Description=PulseAudio Daemon

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
PrivateTmp=true
ExecStart=/usr/bin/pulseaudio --system --realtime --disallow-exit --no-cpu-limit

Re: pulseaudio start on boot?

Posted: Sun Nov 10, 2019 10:59 pm
by nopnop2002
I tried this.
It work fine.


[autoConnect.sh]

Code: Select all

#!/bin/bash
sudo -u pi pulseaudio --start << EOF
raspberry
EOF

sudo -u pi bluetoothctl << EOF
raspberry
connect 54:14:8E:38:A8:28
EOF

[crontab -l]

Code: Select all

@reboot sleep 15 && /home/pi/autoConnect.sh

Re: pulseaudio start on boot?

Posted: Mon Nov 11, 2019 2:51 am
by RossDv8
Just in case anyone is still having trouble getting the pulseaudio daemon to run automatically on startup, I found the easiest was ti install pasystray (using the Raspbian software installer), or sudo apt-get install pasystray. Ypu might have to add it to the panel (as an applet) to actually see it. For some reason 'pa' or 'pulseaudio' is not listed in the name on the available applets list. It just says 'systray'.

Once you add it, you should get a second Volume control icon, and clicking it gives some pulse options - but it doesn;t work as a volume control in itself. (no slider).

However, after it was installed, and on every boot since, if I check the system monitor, pulseaudio is running, and if I open a Terminal and type pulseaudio then enter I get:

pi@raspberrypi:~ $ pulseaudio
E: [pulseaudio] pid.c: Daemon already running.
E: [pulseaudio] main.c: pa_pid_file_create() failed.
pi@raspberrypi:~ $

I use pulse a lot and this was the easiest way I found to autostart it..

Re: pulseaudio start on boot?

Posted: Mon May 25, 2020 11:21 am
by jnihil
I tried many different suggestions, but the followingworks for me with the latest Raspbian (as of May 2020).
Put the line below in your login user's crontab:

@reboot /usr/bin/pulseaudio --start --verbose