Difference between revisions of "MPD Show Stopper"

Wiki.TerraBase.info
Jump to navigation Jump to search
(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...")
 
m
 
(One intermediate revision by the same user not shown)
Line 18: Line 18:
daemon.err mpd[5585]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
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
daemon.err mpd[5866]: exception: failed to open log file "/var/log/mpd.log" (config line 7): Permission denied
</syntaxhighlight>'''Solution:''' Place the following two lines in <syntaxhighlight lang="text">
</syntaxhighlight>'''Solution:''' Place the following two lines in /etc/init.d/mpd; <syntaxhighlight lang="text">
touch /tmp/log/mpd.log
touch /tmp/log/mpd.log
chown mpd:mpd /tmp/log/mpd.log
chown mpd:mpd /tmp/log/mpd.log
Line 26: Line 26:
USER="mpd"
USER="mpd"
GROUP="mpd"
GROUP="mpd"
OR change the following items from above, to what is below;
USER="root"
GROUP="root"
</syntaxhighlight>'''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.
</syntaxhighlight>'''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.
'''...but this error will persist in /tmp/log/mpd.log:''' RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
And that's because when running as mpd:mpd, permissions aren't granted for 'realtime scheduling', nor is the ability to use setcap to allow for mpd:mpd (user:group) to have those permissions.  So better off just setting the User and Group to ROOT for what MPD runs as.

Latest revision as of 10:02, 19 November 2024

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 /etc/init.d/mpd;

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"

OR change the following items from above, to what is below;

USER="root"
GROUP="root"

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.

...but this error will persist in /tmp/log/mpd.log: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted

And that's because when running as mpd:mpd, permissions aren't granted for 'realtime scheduling', nor is the ability to use setcap to allow for mpd:mpd (user:group) to have those permissions. So better off just setting the User and Group to ROOT for what MPD runs as.