[aur-general] Sound in systemd service
NicoHood
archlinux at nicohood.de
Tue Jan 1 23:56:24 UTC 2019
Hi,
I currently try to create a system-wide spotifyd service that can play
music from a dedicated user/group. I used the spotifyd package from AUR
as a base:
https://aur.archlinux.org/packages/spotifyd/
I added a user directory for the user and added it to the audio group:
u spotifyd - "Spotify daemon user" /var/lib/spotifyd
m spotifyd audio
The directory is created like this:
d /var/lib/spotifyd 0750 spotifyd spotifyd -
I've added to the system service to start with a config file in
/etc/sptoifyd.conf and start with:
User=spotifyd
Group=spotifyd
Now the service is running fine in the background, I can select it in
spotify. But no sound will play. I am also running a gnome desktop
environment with pulseaudio on the machine. And I dont know how to get
audio working within this service. The software supports alsa backend
and pulseaudio backend, but none of them seem to give me a sound.
The spotifyd config looks like this:
$ cat /etc/spotifyd.conf
[global]
#username = USER
#password = PASS
#backend = alsa
#device = alsa_audio_device # Given by `aplay -L`
#mixer = PCM
#volume-control = alsa # or alsa_linear, or softvol
#onevent = command_run_on_playback_event
device_name = Nico_Spotifyd # Cannot contain spaces
#bitrate = 96|160|320
#cache_path = cache_directory
#volume-normalisation = true
#normalisation-pregain = -10
If I run locally, I get:
$ sudo -u spotifyd -g spotifyd /usr/bin/spotifyd --no-daemon --config
/etc/spotifyd.conf
```
No protocol specified
xcb_connection_has_error() returned true
ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
00:42:24 [ERROR] Alsa error PCM open -2
00:42:24 [ERROR] Could not start audio: Alsa error: PCM open failed
```
This does not happen with my local user, even with `sudo -u nicohood`.
Using a more simpler command gives me the same problem:
$ sudo -u spotifyd -g spotifyd aplay /usr/share/sounds/alsa/Front_Center.wav
No protocol specified
xcb_connection_has_error() returned true
ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
aplay: main:828: audio open error: No such file or directory
Can anyone give me a hint how to get audio running with this separated
user/service?
~Nico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-general/attachments/20190102/e001b382/attachment.asc>
More information about the aur-general
mailing list