You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We cannot play sound in systemd service + no login normally.
this is because pulseaudio starts when user log in.
when you login to some user, the pulseaudio user service starts and /run/user/{u-id}/pulse will be created.
but without login, /run/user/{u-id}/pulse will not created, so sound_play cannot play the sound.
i found a solution and there are 2 things to do in the solution.
run pulseaudio in system wide mode (not user mode)
set XDG_RUNTIME_DIR properly in your service
run pulseaudio in system wide mode (not user mode)
Yes, there is a solution.
We cannot play sound in systemd service + no login normally.
this is because
pulseaudio
starts when user log in.when you login to some user, the
pulseaudio
user service starts and/run/user/{u-id}/pulse
will be created.but without login,
/run/user/{u-id}/pulse
will not created, sosound_play
cannot play the sound.i found a solution and there are 2 things to do in the solution.
pulseaudio
in system wide mode (not user mode)XDG_RUNTIME_DIR
properly in your servicerun
pulseaudio
in system wide mode (not user mode)disable user
pulseaudio
serviceenable system
pulseaudio
serviceput the following
pulseaudio.service
file in/etc/systemd/system
change
/etc/pulse/default.pa
and/etc/pulse/system.pa
set this in
default.pa
andsystem.pa
change
/etc/pulse/client.conf
set this in
/etc/pulse/client.conf
change
/etc/pulse/daemon.conf
set this in
/etc/pulse/daemon.conf
add all users in
audio
,bluetooth
pulse-access
groupsset
XDG_RUNTIME_DIR
properly in your serviceset
XDC_RUNTIME_DIR
in your service fileReboot
Then you can now play sound from
systemd
ref. https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/
The text was updated successfully, but these errors were encountered: