How to run mpd on fedora server?

I’m trying to run mpd on fedora server 37. I’ve copied /etc/mpd.conf to ~/.config/mpd/mpd.conf. Then:

systemctl --user start mpd

Job for mpd.service failed because the control process exited with error code.
See “systemctl --user status mpd.service” and “journalctl --user -xeu mpd.service” for details.

The relevent lines form above command I think are:

Jan 14 15:43:54 butler mpd[2165]: exception: failed to open log file “/var/log/mpd/mpd.log” (config line 38): Permission denied
Jan 14 15:43:54 butler systemd[1080]: mpd.service: Main process exited, code=exited, status=1/FAILURE

Ok, so in ~/.config/mpd/mpd.conf I’ve commented the log file:

#log_file "/var/log/mpd/mpd.log"

The config file even mentions this:

If you use systemd, do not configure a log_file. With systemd, MPD defaults to the systemd journal, which is fine.

It still doesn’t work though. The error from journalctl now is:

Jan 14 15:46:07 butler mpd[2174]: server_socket: bind to ‘0.0.0.0:6600’ failed (continuing anyway, because binding to ‘[::]:6600’ succeeded): Failed to bind socket: Address already in use
Jan 14 15:46:07 butler mpd[2174]: exception: Failed to set group 986: Operation not permitted
Jan 14 15:46:07 butler systemd[1080]: mpd.service: Main process exited, code=exited, status=1/FAILURE

There is nothing listening on port 6600. Why does mpd think there is?

What the group 986 business is about I have no idea.

I’ve set selinux to permissive, thus it’s not selinux fault.

Something else is already listening on port 6600. Perhaps you already started the mpd service by hard at some point and then tried to start it via systemd? Check with ssh -ntulp | grep 6600.

With

ss -ltpn

nothing shows up listening on port 6600.

mpd uses UDP, so you need the -u option in ss to see it.

Nothing shows up with the -u option either.

It looks like it might have already bound on 6600 via the IPv6 equivalent of 0.0.0.0 and then tried to bind again on 0.0.0.0. Perhaps a duplicate entry in your conf?

Can you grep 986 /etc/group ? On my box, that group is geoclue, so it’s possible that it’s trying to using the incorrect gid. Since you’re now doing this as user, I presume you want to maybe be using grep -P "^$USER:" /etc/group | cut -d':' -f 3 for the gid (run as the user for the systemd process).

I managed to run mpd now. I had the change the user in mpd.conf to my username and the database path to ~/.config/mpd/mpd.conf.

The port 6600 issue still perists in the journal, but it seems to be only a warning. I can connect with a remote client in an IPv4 network.

1 Like

Yup. By default sysctl net.ipv6.bindv6only is set to 0, so binding to [::] includes 0.0.0.0 (IPv4) so it’s effectively already bound. Glad you got it working!