MPD Show Stopper

Revision as of 09:53, 19 November 2024 by Root (talk | contribs) (Created page with "'''Question:''' Why won't MPD work 'right out of the box'? '''Answer:''' It doesn't have permissions to create its log file;<syntaxhighlight lang="text"> daemon.err mpd[4369]: exception: failed to open log file "/tmp/mpd.log" (config line 2): Permission denied daemon.err mpd[4478]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied daemon.err mpd[4540]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permissio...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Question: Why won't MPD work 'right out of the box'?

Answer: It doesn't have permissions to create its log file;

daemon.err mpd[4369]: exception: failed to open log file "/tmp/mpd.log" (config line 2): Permission denied
daemon.err mpd[4478]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
daemon.err mpd[4540]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
daemon.err mpd[4594]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
daemon.err mpd[4648]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
daemon.err mpd[4702]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
daemon.err mpd[4756]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
daemon.err mpd[4830]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
soxr: soxr converter 'high'
vorbis: Xiph.Org libVorbis 1.3.7
opus: libopus 1.3.1-fixed
simple_db: reading DB
curl: version 8.7.1
curl: with mbedTLS/2.28.9
daemon.err mpd[5585]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
daemon.err mpd[5866]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied

Solution: Place the following two lines in

touch /tmp/log/mpd.log
chown mpd:mpd /tmp/log/mpd.log

OR remove the following items (MPD will run as ROOT);

USER="mpd"
GROUP="mpd"

Why does it have to be this difficult!?: Maybe because OpenWRT is oriented around a 'one user' mentality? /etc/var/log is really /etc/tmp/log which has its owner set to ROOT and other users only have read permissions, so if a service is run under its own user name and / or group (MPD:MPD), then it won't work. And some nice person at OpenWRT missed this and used generic MPD /etc/init.d/mpd settings in the file without considering the unique nuances of OpenWRT. Oh, well.