You are not logged in.

#1 2020-09-22 20:43:51

paulbono
Member
Registered: 2013-07-16
Posts: 16

[SOLVED] Pulse audio access help needed from systemd service

I have a service that eventually makes a system call to pactl set-sink-volume

This works fine if I run the binary as my local user but throws a connection error if running as a service.
Sep 22 15:45:00 desktop python3[8784]: Connection failure: Connection refused
Sep 22 15:45:00 desktop python3[8784]: pa_context_connect() failed: Connection refused


When creating the service entry I also set that user.

Pulseaudio is running non daemonized.  Maybe that’s the trick here?

Pulse audio is running as the X user that is logged in.

Not sure what environment variables I would need to set or if I need to run a daemon instance of pulse audio.

Last edited by paulbono (2020-09-24 12:30:03)

Offline

#2 2020-09-23 09:11:19

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,410

Re: [SOLVED] Pulse audio access help needed from systemd service

What are you doing in your service and are you sure you need to run that as a system service? If you can just run that like pulseaudio as a user service that will immediately fix all of these issues, without having to have any special considerations.

Offline

#3 2020-09-23 11:35:44

paulbono
Member
Registered: 2013-07-16
Posts: 16

Re: [SOLVED] Pulse audio access help needed from systemd service

Again V1del you post a simple solution that fixes all my issues.  I had never written anything as a user service but after you mentioned that it was a thing adding --user and removing the user from the system file fixed everything for me.  Thank you so so much!

Offline

Board footer

Powered by FluxBB