Skip to content

Instantly share code, notes, and snippets.

@awidegreen
Last active October 13, 2024 14:20
Show Gist options
  • Save awidegreen/6003640 to your computer and use it in GitHub Desktop.
Save awidegreen/6003640 to your computer and use it in GitHub Desktop.
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
@lennartack
Copy link

lennartack commented Oct 13, 2024

To ensure systemd knows when PulseAudio has finished starting, you can use Type=dbus. This is necessary if you need to start other services that depend on PulseAudio (for example receivers for streaming audio).

[Unit]
Description=Pulseaudio sound server
After=avahi-daemon.service network.target

[Service]
Type=dbus
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disallow-module-loading --daemonize=no
ExecReload=/bin/kill -HUP $MAINPID
BusName=org.pulseaudio.Server

[Install]
WantedBy=multi-user.target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment