-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No audio on headless machine (CentOS) #577
Comments
I just set up a similar configuration on a Raspberry Pi with Raspbian. I have PulseAudio set as a system-level service and then have spotifyd, shairport-sync and PulseAudio's Bluetooth modules set up as playback sources. A slight difference with my setup is I'm running spotifyd and shairport-sync under their own system users (no home directories) and the SystemD services are system services, not user services. For troubleshooting PulseAudio I recommend looking at the output of For PulseAudio, I have this in autospawn = no
default-server = /var/run/pulse/native This is my [Unit]
Description=PulseAudio system server
# Putting this dependency in here instead of modifying the packaged shairport-sync.service file
Before=shairport-sync.service
[Service]
Type=notify
ExecStart=pulseaudio --daemonize=no --system --realtime --disallow-exit=yes
Restart=on-failure
[Install]
WantedBy=multi-user.target Then enabled with Then I have this for [Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd
Wants=sound.target
After=sound.target
Wants=network-online.target
After=network-online.target
Wants=pulseaudio.service
After=pulseaudio.service
[Service]
ExecStart=/usr/local/bin/spotifyd --no-daemon
Restart=on-failure
RestartSec=12
User=spotifyd
Group=nogroup
[Install]
WantedBy=multi-user.target Having the explicit dependency between the system-level PulseAudio daemon and the later playback applications is an important detail. I also moved the installation back a little bit (from I have the playback users ( In If you want to use ALSA and run spotifyd as a service, you might need to add a If you're running spotifyd as a system service and attempt to use D-Bus things will probably end badly unless you make the changes mentioned in #244. |
I don't know what's wrong with adding users to the audio group. Yes, they can get exclusive access, yes, it might break some stuff when switching between seats a lot but if you don't, I think it's totally fine to do it then. Instead of fiddling with configs and commands around. |
Thanks for all the info. I spent some time trying to get this working again last night, but no dice. I recompiled spotifyd and now pulseaudio shows up as a backend; not sure why that didn't work before. I also set up the pulseaudio system service; however, it doesn't seem to want to start when the system boots. Not sure what I am doing wrong there as I was able to get a system-wide pulseaudio instance running before. I am able to force it to start after the system boots though. Last issue I have is that if I do get everything started manual, I can cast to spotifyd, but no audio plays. No errors are thrown by the command; it signals that it is playing a song and sits until then next track starts, signals that is running, then sits again. I don't know if I broke something in all my testing from my OP, so I'll try again this weekend. Thanks again. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hello all,
I'm trying to get this package running on a CentOS 8 system. The machine is headless, i.e., no local logins. I have the package installed, and it runs fine as a user service, but I get no audio.
Digging through the interwebs, it seems to be that users gain access to audio cards when they login at the machine; however, there is no access to audio cards through systemd. I read the user running spotifyd to the audio group is not a good idea, but I can't seem to figure out how to get the user (spotify) to grab control of audio.
Some updates
Over the past few days I've been trying a bunch of different thing to get this working, which are outlined below
What I'm trying to do is connect a sound system to my 'headless' server and have it appear in Spotify to cast to. I would like spotifyd to be loaded at boot so that it is always available for casting. However, I can't seem to get the service to take control of audio.
System
--features pulseaudio_backend
(note that pulseaudio does not appear in the--help
message)I am trying to run
spotifyd
under a user I created name spotify.I am trying to do all of this over ssh.
spotifyd.service file
This file is installed at
~/home/spotify/.config/systmed/user
and is started usingsystemctl --user start spotifyd
If I start this service, or try to run the daemon from command-line over ssh, I get the following:
I have also tried setting
device = sysdefault
as mentioned in #87, but this doesn't work either.Here is the output from
aplay -Ll
What I have tried
Adding spotify user to audio group
So, if I add the spotify user to the audio group (I know, bad to do), sound cards appear when running
aplay -l
, and I can play audio files usingaplay -D sysdefault
(using thedefault
device does not work) and thespotifyd
works just fine. However, if I try to run the service again, I get the same issue as above where it cannot read the alsa device. After some testing, I noticed that when the service runs, theaudio
group does not appear under theid
command, so the user's groups do not seem to be honored in services and access to soundcards is not possible.System-wide pulseaudio
I have tried a few times to create a system-wide pulse audio instance by:
systemctl --global disable pulseaudio.service pulseaudio.socket
,autospawn = no
in/etc/pulse/client.conf
pulse-audio
access groupHowever, this still does not work. I just cannot seem to get the service to grab hold of pulseaudio when it runs. If I log into the machine locally so that the GUI environment grabs audio, then run the service, then log out locally, it does seem to work. However, I have not had much luck any other way.
Shell script for more information
Running the following script as the
ExecStart
parameter in thespotifyd.service
file:Gives the following
Note that changing the
--device
flag todefault
orsysdefault
produces similar errors.Has anyone had this issue or have any ideas that I could try. I am out of ideas and at this point think the only way this will work is if I run the daemon under root to have full sound card access, but I don't really want to do that for security sake.
The text was updated successfully, but these errors were encountered: