If rc_parallel="YES" and bind_to_address is set to localhost, mpd fails to listen on the port 6600 when booting. Once the system is started, when you run '/etc/init.d/mpd restart' mpd works correctly. Reproducible: Sometimes Steps to Reproduce: 1. Set rc_parallel="YES" in /etc/rc.conf 2. Add mpd to default rc 3. Add: bind_to_address "localhost" to /etc/mpd.conf 4. Reboot Actual Results: mpd starts but you cannot connect to it.
Created attachment 204608 [details, diff] Patch for /etc/init.d/mpd Adding net as a dependancy solves the problem.
But it doesn't really need net...
(In reply to comment #2) > But it doesn't really need net... > I agree. But there were weird things as when I set 'bind_to_address "127.0.0.1"' I was getting the error "Address familly or hostname not supported" when mpd was starting. Adding net as dependancy was the first thing I thought of that worked. By the way, when bind_to_address is not set everything works fine. (don't know if it might help)
How about moving net.lo from "use" to "need" ? It should be enough, but I didn't test it.
No, it didn't fix the problem.
This bug appears to occur when the status of net.wlan0 is starting and mpd starts. If net.wlan0 finishes starting before mpd is run, everything works fine.
can you retry this with 0.15.5?
Hi, this bug is present in 0.15.5, or at least it seems to be it. However it does not seem to be affected by rc_parallel (I have it turned off) Mpd is not started during boot (added in default runlevel), but when i restart it manually later, it works just fine. Just a notice: net.lo is started in boot runlevel, mpd is in default, so net.lo should be already started when mpd is starting - and it needs only net.lo (in default configuration), so I'm not sure if dep on net will solve it (as net.lo is statically configured to 127.0.0.1, it does not take a long time). I have no idea why is this happening. Just tried with soundcard muted, but seemed to make no difference. Also, there is nothing obviously wrong in /var/log/mpd/mpd.log (except one error about state file missing, but I have tried removing that and it recreates it correctly). Maybe something causes mpd to crash after it starts?
Does adding "after net" or "after net.lo" to the init script fix this problem?
(In reply to comment #9) > Does adding "after net" or "after net.lo" to the init script fix this problem? > No, it does not. For me, mpd starts after net.wlan0, which uses wpa_supplicant and is backgrounded (don't know if it may help). But when I don't start net.wlan0, mpd works.
Well, yes, but that doesn't make any sense to me... all mpd needs is net.lo unless you bind it to some public ip address
(In reply to comment #11) > Well, yes, but that doesn't make any sense to me... all mpd needs is net.lo > unless you bind it to some public ip address > Yes it is strange... After running some tests, every time my wireless network connection (wlan0) is starting and before the interface gets an address (using dhcpcd), if I start mpd in a terminal in verbose mode I get: # mpd --stdout --verbose --no-daemon config: loading file /etc/mpd.conf listen: binding to address for 127.0.0.1 listen: Failed to listen on 127.0.0.1 (line 70): Failed to look up host "127.0.0.1": Address family for hostname not supported Aborted
Same problem here, and I'm using net.wlan0 with wpa_supplicant. is adding "need net", like the patch says, working??
(In reply to comment #13) > Same problem here, and I'm using net.wlan0 with wpa_supplicant. > > is adding "need net", like the patch says, working?? > It works fine as long as you have a connection that is set during the boot. Otherwise, the script is just waiting.
just to be sure, you guys do have "127.0.0.1 localhost" in /etc/hosts, right?
(In reply to comment #15) > just to be sure, you guys do have "127.0.0.1 localhost" in /etc/hosts, right? > I have it.
can you please show me your mpd.conf?
Created attachment 233321 [details] My mpd.conf (without comments) Here is my mpd.conf file.
This seems to be related to ipv6. I don't know if it's specifically an mpd bug, or an indication of some larger bug with the handling of ipv6 vs. ipv4 loopback. What happens, for me, when bind_to_address is "localhost", mpd attaches to ::1 (ipv6 loopback) when no non-lo network interface is up, and 127.0.0.1 when any non-lo network interface is up. It also *cannot* bind to 127.0.0.1 unless a non-lo network interface is up, even if bind_to_address is "127.0.0.1" (causing the error in comment #12). I can correctly ping/ping6 localhost on "localhost", "127.0.0.1", and "::1" no matter the state of non-lo network connections, so I think this is more likely an mpd bug. A workaround, that seems to let it start properly and always be correctly connected to, no matter the state of other network links, is to use bind_to_address = "any". Mind you, this might be less secure (possibly allowing non-localhost computers to connect to and control mpd), but that should be fixable using some basic iptables rules. You might also be able to work around it by setting USE="-ipv6" for mpd -- I didn't try this.
Please try this with 0.16 and add your /etc/hosts if it does not work
Please reopen if this still happens with 0.16. I cannot reproduce it.
Created attachment 265157 [details] /etc/hosts
(In reply to comment #21) > Please reopen if this still happens with 0.16. I cannot reproduce it. Still happening with 0.16.1-r2. I have also added my hosts file. I also tried to add -ipv6 for mpd, but it changed nothing.
Could you please retry with the first line of your hosts changed to "127.0.0.1 chris-glaptop localhost", i.e. hostnames switched? Also, did anyone report this upstream already?
(In reply to comment #24) > Could you please retry with the first line of your hosts changed to "127.0.0.1 > chris-glaptop localhost", i.e. hostnames switched? > Also, did anyone report this upstream already? Changing the order of hostnames changed nothing. I don't thing that has been reported upstream.
16/220142 <@cirrus> I'm looking at your bug report. can't reproduce. 16/220202 < angelos> me neither, but those in the gentoo bug seem to be able to reproduce it 16/220217 <@cirrus> mpd asks the libc resolver to convert "127.0.0.1" into a sockaddr. the resolver fails. 16/220218 < angelos> I was hoping you had an idea 16/220222 <@cirrus> I say it's a libc bug. toolchain: Any idea?
works fine for me. run it through strace and post the log as an attachment: strace -s 4096 -o log -v mpd --stdout --verbose --no-daemon
Must have been fixed in 0.16, because I reinstalled it completely and it starts normally.
Created attachment 266639 [details] getaddrinfo.c