Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
systemd definition for pulseaudio in system-mode (example for archlinux). The pulseaudio developers explicitly recommend to NOT run pulseaudo system-mode!
# systemd service spec for pulseaudio running in system mode -- not recommended though!
# on arch, put it under /etc/systemd/system/pulseaudio.service
# start with: systemctl start pulseaudio.service
# enable on boot: systemctl enable pulseaudio.service
[Unit]
Description=Pulseaudio sound server
After=avahi-daemon.service network.target
[Service]
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disallow-module-loading
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
@Jille

This comment has been minimized.

Copy link

@Jille Jille commented Jul 2, 2017

You should add --daemonize=no.

@rodrigoaguilera

This comment has been minimized.

Copy link

@rodrigoaguilera rodrigoaguilera commented Dec 8, 2017

I use pulseaudio over a network and I need to wait for the interface to be up. I can't seem to be able to do it with systemd so instead I restart the pulseaudio service when it fails to start at boot

    [Service]
    Restart=always
    RestartSec=30
@ashutoshtripathi123

This comment has been minimized.

Copy link

@ashutoshtripathi123 ashutoshtripathi123 commented Apr 25, 2018

Thanks a million. This is exactly what I was looking for. The pulseaudio stopped working on our system after the introduction of systemd, and I needed the place where I can include the flag --system in systemd for pulseaudio.

@bxabi

This comment has been minimized.

Copy link

@bxabi bxabi commented Sep 12, 2018

Pulseadio configured correctly forks and drops root privileges, and runs under the user pulse.
If the service is not adapted, pulseaudio simply exits.

Type=forking
ExecStart=/usr/bin/pulseaudio --realtime --no-cpu-limit --system --disallow-exit --daemon

https://gist.github.com/bxabi/5295beadbfce8f4e697733e7244c4402#file-pulseaudio-service-L10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.