[Pkg-mpd-maintainers] Bug#536779: mpc: Can't connect to mpd on localhost

Florian Schlichting fschlich at ZEDAT.FU-Berlin.DE
Sun Feb 24 22:23:45 UTC 2013


Control: tags 536779 +moreinfo

Hi,

> I'm mpd running on localhost (bind_to_address "localhost") and
> when I run mpc to control mpd I get the following error:
>
>     MPD_HOST and/or MPD_PORT environment variables are not set
>     error: problems getting a response from "localhost" on port 6600 : Connection refused
>
> To fix this I have to set MPD_HOST=127.0.0.1 then everything
> works fine.

this sounds like an issue with IPv6 and /etc/hosts. For a time, the
Debian installer created a hosts file that had both 127.0.0.1 and ::1
resolve to localhost. As this created problems, nowadays ::1 resolves to
ip6-localhost and only 127.0.0.1 is associated with localhost.

mpd seems to bind to either 127.0.0.1 or ::1, not both (unless several
values are specified as bind_to_address); your issue seems to come from
the above /etc/hosts, and mpd binding to 127.0.0.1 while mpc attempting
to connect on ::1.

Could you check your /etc/hosts, or try to specify both 127.0.0.1 and
::1 to bind_to_address in /etc/mpd.conf? Alternatively, the code that
binds to v4 and v6 addresses changed in mpd 0.14, so perhaps your issue
was fixed there?

Florian



More information about the Pkg-mpd-maintainers mailing list