-
-
Save awidegreen/6003640 to your computer and use it in GitHub Desktop.
| # 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 |
Wow thank you so much for the extensive description! I will try it out :)
@janvda
Hello! I have a server with 3 VMs that I want to have sound-enabled. In particular I wanted the VM running my music server to start on boot, and with sound enabled. The audio part of that solution evaded me until I found your post. I i implemented it as described, except for using a different account, and it works beautifully.
Thanks!
As im trying to do something with this there is a problem with "8 NOT NEEDED: Assure that pulseaudio socket is accessible by any user" it looks like /run/user/1041/pulse is 700 it is restored after daemon restart.
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
@koenschepens
I managed to get it working. See my Audio setup here below:
Audio setup
Setup of pulseaudio in user mode
pulseaudioat all times (also after reboot)pulseaudio(hasuid = 1041in my case)/run/user/1041/pulse/native) is active for userpulseaudiopulseaudioaccess toaudiogroup so it has access to audio hardware (/dev/snd/*)This can be checked by:
reboot the system
Following command can be used to check if pulseaudio can access audio card
(assure that no other program is accessing the audio card)
/etc/pulse/daemon.conf/etc/pulse/default.paTest pulseaudio installation (including pavucontrol)
Accessing pulseaudio server (on host) in docker container
Assure that pulseaudio server (on host) is setup as in previous sections.
Change pulseaudio profile (using hdmi / analog / digital output)
Here below the commands to change the audio profile of the card.
Note that it is also possible to do this using pavucontrol.