Open Drexel2k opened 7 months ago
I already commented on that topic in your PR, but what's happening, is the following.
When running without --no-daemon
, spotifyd
forks itself into the background, so the main process terminates. (That's why systemd
displays the service as exited. So when using systemd
, you should use --no-daemon
, since systemd
should take care of daemonizing and watching the application.
In either case, spotifyd
will log to journald
(the syslog) and its messages should appear in journalctl --follow
or journalctl --user --follow
in user sessions.
When running without
--no-daemon
,spotifyd
forks itself into the background, so the main process terminates. (That's whysystemd
displays the service as exited. So when usingsystemd
, you should use--no-daemon
, sincesystemd
should take care of daemonizing and watching the application.
Ah ok, I wasn't fully aware what the --no-daemon flag does, I read somewhere that it is just about logging output redirection. Maybe this is also an info, which could be in the docs. ;)
I thought when running as a daemon, it would make sense to leave out the --no-daemon flag... But I think I remember when you leave the flag out as daemon, there is no spotifyd process at all running at startup, maybe the fork doesn't work then. But I am not sure, I will check this out in the next days.
In either case,
spotifyd
will log tojournald
(the syslog) and its messages should appear injournalctl --follow
orjournalctl --user --follow
in user sessions.
I will also check this out. As is said in the pull request, I am not really familiar with Linux, my current project is my first real touchpoint with Linux...
Thank you for your feedback.
Ok I checked now, with --no-daemon I see journal entries with journalctl. I think I wasn't aware how to use the journal, thank you. So I think the issue was a non issue. :)
Only for information: I don't know if it is an issue, but if I use spotifyd.service file as initially posted without the --no-daemon flag, this is the output and there is no spotifyd process living:
Dec 23 01:49:40 raspifm spotifyd[1948]: Loading config from "/etc/spotifyd.conf" Dec 23 01:49:40 raspifm spotifyd[1948]: No username specified. Checking username_cmd Dec 23 01:49:40 raspifm spotifyd[1948]: No username_cmd specified Dec 23 01:49:40 raspifm spotifyd[1948]: No password specified. Checking password_cmd Dec 23 01:49:40 raspifm spotifyd[1948]: No password_cmd specified Dec 23 01:49:40 raspifm spotifyd[1948]: No proxy specified Dec 23 01:49:40 raspifm spotifyd[1948]: Daemonizing running instance Dec 23 01:49:40 raspifm spotifyd[1950]: Detached from shell, now running in background. Dec 23 01:49:40 raspifm spotifyd[1950]: Using software volume controller. Dec 23 01:49:40 raspifm spotifyd[1950]: no usable credentials found, enabling discovery Dec 23 01:49:40 raspifm systemd[1]: spotifyd.service: Deactivated successfully.
I understood that I should use it with --no-daemon in systemd service and only without on the command line. On the command line it workd without the --no-daemon flag, there I see also the forked process with ps aux | grep spot
That's good to know. I suspect, this might be a systemd thing then and they might be killing everything, when the parent process dies? A fix for this would probably be to set Type=forking
or something similar in the .service
file.
Description Hello,
when I configure spotifyd as a system service on a Raspberry Pi as described here: https://docs.spotifyd.rs/config/services/Systemd.html with
I can't get it to write any logs. Either I have --no-daemon argument for ExecStart, then it works fine with logging, or I leave the argument out, then the daemon starts and stops immediately without any error.
On Raspberry syslog ist not installed, instead journald and spotifyd needs a syslog for writing logs from my understanding, therefore I also installed syslog, but it did make no change. Sorry I am not so deep in Linux topics...
Some kind of Journal support would be nice for the future.
To Reproduce
Expected behavior The process should be running
Logs
Click to show logs
``` spotifyd.service - A spotify playing daemon Loaded: loaded (/etc/systemd/system/spotifyd.service; enabled; preset: enabled) Active: inactive (dead) since Fri 2023-12-08 14:28:37 CET; 47s ago Duration: 214ms Docs: https://github.com/Spotifyd/spotifyd Process: 891 ExecStart=/usr/bin/spotifyd (code=exited, status=0/SUCCESS) Main PID: 891 (code=exited, status=0/SUCCESS) CPU: 24ms Dec 08 14:28:37 raspifm systemd[1]: Started spotifyd.service - A spotify playing daemon. Dec 08 14:28:37 raspifm spotifyd[891]: Loading config from "/etc/spotifyd.conf" Dec 08 14:28:37 raspifm spotifyd[891]: No username specified. Checking username_cmd Dec 08 14:28:37 raspifm spotifyd[891]: No username_cmd specified Dec 08 14:28:37 raspifm spotifyd[891]: No password specified. Checking password_cmd Dec 08 14:28:37 raspifm spotifyd[891]: No password_cmd specified Dec 08 14:28:37 raspifm spotifyd[891]: No proxy specified Dec 08 14:28:37 raspifm spotifyd[891]: Daemonizing running instance Dec 08 14:28:37 raspifm spotifyd[899]: Detached from shell, now running in background. Dec 08 14:28:37 raspifm systemd[1]: spotifyd.service: Deactivated successfully. ```Compilation flags
Versions (please complete the following information):
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" cat: command: No such file or directory
spotifyd:https://github.com/Spotifyd/spotifyd/commit/5565f24b5adb0665c5e17de842019727e7456571 cargo: 1.74.1 (ecb9851af 2023-10-18)
Thank you in advance for any help!