> > and tracked it down to mpd is installed as both a system service (which
> > I've configured, and been using for a while) and a systemd user service,
> 
> are you sure this is the systemd user service, rather than
> /etc/xdg/autostart/mpd.desktop?

Yes. Here is a fuller excerpt from the journal:

Nov 09 04:12:06 Watt systemd[1]: Starting User Manager for UID 1000...
Nov 09 04:12:06 Watt systemd-logind[952]: New session 2 of user anthony.
Nov 09 04:12:06 Watt systemd[1]: Started Session 2 of user anthony.
Nov 09 04:12:06 Watt systemd[3999]: pam_unix(systemd-user:session): session 
opened for user anthony by (uid=0)
Nov 09 04:12:07 Watt systemd[3999]: Listening on GnuPG cryptographic agent and 
passphrase cache (restricted).
Nov 09 04:12:07 Watt systemd[3999]: Listening on GnuPG cryptographic agent and 
passphrase cache.
Nov 09 04:12:07 Watt systemd[3999]: Starting D-Bus User Message Bus Socket.
Nov 09 04:12:07 Watt systemd[3999]: Reached target Timers.
Nov 09 04:12:07 Watt mpd[4010]: exception: failed to open log file 
"/var/log/mpd/mpd.log" (config line 38): Permission denied
Nov 09 04:12:07 Watt systemd[3999]: Reached target Paths.
Nov 09 04:12:07 Watt systemd[3999]: Listening on GnuPG network certificate 
management daemon.
Nov 09 04:12:07 Watt systemd[3999]: Listening on Sound System.
Nov 09 04:12:07 Watt systemd[3999]: Listening on GnuPG cryptographic agent 
(ssh-agent emulation).
Nov 09 04:12:07 Watt systemd[3999]: Listening on GnuPG cryptographic agent and 
passphrase cache (access for web browsers).
Nov 09 04:12:07 Watt systemd[3999]: Listening on D-Bus User Message Bus Socket.
Nov 09 04:12:07 Watt systemd[3999]: Reached target Sockets.
Nov 09 04:12:07 Watt systemd[3999]: Reached target Basic System.
Nov 09 04:12:07 Watt systemd[1]: Started User Manager for UID 1000.
Nov 09 04:12:07 Watt systemd[3999]: Starting Music Player Daemon...
Nov 09 04:12:07 Watt systemd[3999]: mpd.service: Main process exited, 
code=exited, status=1/FAILURE
Nov 09 04:12:07 Watt systemd[3999]: mpd.service: Failed with result 'exit-code'.
Nov 09 04:12:07 Watt systemd[3999]: Failed to start Music Player Daemon.
Nov 09 04:12:07 Watt systemd[3999]: Reached target Default.
Nov 09 04:12:07 Watt systemd[3999]: Startup finished in 743ms.
Nov 09 04:12:07 Watt systemd[3999]: Started D-Bus User Message Bus.

So that's clearly the systemd user service.

(I'm not sure the weird setup I have on that machine even pays attention
to /etc/xdg/autostart)

> 
> > which I'm not sure what it's for, but it (obviously) fails to write to
> > system-wide logs.
> > 
> > Seems like only one of the two ways should run on a given machine. Or at
> > least the user service ought to use a different config file.
> 
> There are many ways MPD can be started. The default nowadays is when a
> user is logging into a desktop environment, as most users have their own
> music collection and their desktop session starts a pulseaudio instance
> that needs to be used as output. This works best with a personal
> ~/.mpdconf containing adjusted paths etc.

I wonder if it wouldn't make sense to add a
ConditionPathExists=%h/.mpdconf (or even Assert…) to the user unit. I'm
not sure it makes sense to try to start from both XDG autostart and
systemd... one of those is going to fail, and probably in an
unpredictable race — but I'm not sure what the best way to fix that is
(since of course systemd and the systemd user session are optional).

(I'm running mpd for yet another purpose — its handling the library
management for a remote mpd running on a Raspberry Pi, which is what
does all the actual music playing.)

Reply via email to