mpd ignores the "port" in config by default

Bug #1639544 reported by Antti Laiti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mpd (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

mpd ignores the "port" and port section in "listen_to_address" in configuration file by default, listens always to port 6600 and fails to tell user about the situation. If I have 'bind_to_address "192.168.0.1:16600"' or 'port "16600"' (or both) in my /etc/mpd.conf, mpd just ignores them and listens to default port (6600).

# lsof|grep mpd|grep TCP
mpd 20791 mpd 9u IPv4 269974 0t0 TCP moot:6600 (LISTEN)
io 20791 20793 mpd 9u IPv4 269974 0t0 TCP moot:6600 (LISTEN)
player 20791 20794 mpd 9u IPv4 269974 0t0 TCP moot:6600 (LISTEN)
decoder:f 20791 20795 mpd 9u IPv4 269974 0t0 TCP moot:6600 (LISTEN)
output:Al 20791 20796 mpd 9u IPv4 269974 0t0 TCP moot:6600 (LISTEN)

This is the only related thing I found from /var/log/mpd/mpd.log:
Nov 06 09:47 : zeroconf: No global port, disabling zeroconf
Googling that actually lead me to an URL(1) containing a solution.

To workaround the situation, I did:
systemctl disable mpd.socket
systemctl enable mpd.service
systemctl restart mpd.service

I have no idea whether that is a ideal solution or if it breaks somethinge else. Anyway, I think the "port" and "bind_to_address" options should work out of the box. I am also confused by the fact that the default port was used instead of the one I specified and no errors were shown in systemd or mpd logs about this fallback. The only thing that was perhaps somehow related was this zeroconf thing. Example config is attached.

(1) http://article.gmane.org/gmane.comp.audio.musicpd.devel/21785

Revision history for this message
Antti Laiti (pulk) wrote :
Revision history for this message
Florian Schlichting (fschlich) wrote :

What you're coming up against is a systemd feature called 'socket activation'. Address and port are opened not by mpd but by systemd on system startup, while mpd is only started when an actual connection request to that address and port is received. Hence those values have to be specified as part of the mpd.socket unit.

This is not a bug, but normal behaviour in a systemd world. Since mpd 0.19.10-1, the package-provided /etc/mpd.conf contains a note about this. I don't know if the systemd API makes it easy to query the address and port used for socket activation, so that mpd could log a helpful warning when those differ from mpd.conf. That would certainly be a nice feature.

Revision history for this message
Florian Schlichting (fschlich) wrote :

the config file now contains a helpful warning that those values are not effective when systemd socket activiation is in use

Changed in mpd (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.