What? Why does mpd want to access /root/.config
? What’s MPD? It’s a daemon for playing music. It runs as a service, which I connect to with either ncmp
or ncmpcpp
.
Here’s the full SETroubleshoot detail:
The version of MPD that causes this issue is: 0.20.10 on Fedora 27. I’m pretty sure it was working last week and I didn’t have to do anything. So what’s changed? Well, it seems like this could be a very old problem as reported int bug 1325502. Basically, when mpd
is started, it tries to read the MPD configuration file (mpd.conf
). According to the man page for mpd.conf
, the configuration file should be read in the following order:
When mpd
service is started (with # systemctl start mpd
), the first location MPD starts to look for its config is in /root/.config/mpd/mpd.conf
since the service is started by root
user. (Of course, $XDG_CONFIG_HOME
for root is $HOME/config
or /root/.config
.)
This can be verified by running strace
:
So how to fix this? I think there are 2 ways. The first one which I haven’t even tried yet is to add User=mpd
to the [Service]
section in /usr/lib/systemd/system/mpd.service
. Something like this:
In theory, when mpd
is started it should looks for $HOME/config/mpd.conf of mpd
user, and there should be SELinux problem with access right. However, there are other issues that prevent this method working without fixing more SELinux issue. One of them is:
So… here is the 2nd solution which is relatively easy and actually fixes problem: modify the mpd.service by explicitly appending the mpd’s configuration as the following:
Then reload the systemd daemon and start mpd as usual:
Alright, I’m gonna get back to listen to my music. 😉