mpd ignores the "port" in config by default
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.
# 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/
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://
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.