Wikia

Music Player Daemon Community Wiki

Music Player Daemon HOWTO Troubleshoot

Talk0
520pages on
this wiki
Revision as of 02:08, November 1, 2011 by Avuton (Talk | contribs)

This article is a stub. You can help the MPD community by expanding it. Just click "Edit this page" and start typing.

How to troubleshoot MPD

MPD is difficult to troubleshoot by default. This isn't on purpose, fact is no one has done any work on improving the situation. Here's how to help you fix your daemon.

Before all else: If you're having problems starting MPD, experience tells us you're having a permissions problem. You may have checked permissions previously. That's fine and all, you didn't check them good enough. 19 out of 20 people that request support for MPD have permissions problems. Go directly to Basic Troubleshooting if this isn't your first run.

MPD won't start

This usually occurs the first time install, basically MPD, itself, isn't very user friendly.

First run: Non-existing / Bad permission daemon files

A few things to understand:

Run the following command:

# grep '^user.*' /etc/mpd.conf

Remember who you have set as the user.

Now run:

# grep '_file.*' /etc/mpd.conf

You see all the files, db_file, etc... MPD expects those files to not only exist, but to have the permissions of user

You can easily do what needs to be done by running this in the shell:

for file in $(grep '_file.*' /etc/mpd.conf | sed 's/.* //' | xargs)
do
 touch ${file}
 chown $(grep '^user.*' /etc/mpd.conf | sed 's/.* //') ${file}
done

Non-existing daemon required directories

Run the following command:

# grep '_dir' /etc/mpd.conf

These directories must be owned or have equalivent access to user

You can easily do this by:

for dir in $(grep '_dir.*' /etc/mpd.conf | sed 's/.* //' | xargs)
do
 mkdir -pv "${dir}"
 chown $(grep '^user.*' /etc/mpd.conf | sed 's/.* //') ${dir}
done

Error with http_prebuffer_size

If you have specified this option as showed in example (http_prebuffer_size=X%) than mpd won't start. You MUST specify this size by integer without "%". This is prebuffer size in KiB not in percents

Address already in use

If you get this error on startup:

 unable to bind port 6600: Address already in use
 maybe MPD is still running?
 Aborted

and mpd is not actually running (check with ps aux|grep mpd), then it's possible that mpd is attempting to bind to the same address multiple times. Check your /etc/hosts for duplicate entries. (This is being fixed in 0.15)

Basic Troubleshooting

Basic troubleshooting of MPD requires logs. There's two methods of getting these logs. The easiest most straightforward way of finding out problems is the direct way.

Starting MPD no-daemon

Start MPD:

# /usr/bin/mpd --stdout --no-daemon --verbose

Error appears here (wasn't that easy?).

Troubleshooting with logs

Sometimes the no daemon method of basic troubleshooting won't do. For this you need to change the log_level in /etc/mpd.conf to log_level "verbose" then restart MPD. You should see tons of logs in your log_file and error_file. Examine these logs closely. They provide great clues to your problem.

Can't connect to MPD

This happens in startup sometimes when some distributions, not singling out any distributions, but some bind_to_address localhost by default. For troubleshooting's sake comment this out and restart MPD.

If this didn't happen in startup, and you cannot connect this could be a bug. Make sure your MPD_HOST and MPD_PORT are correct for your client and MPD is running on the box you think it is. Then file a bug report at MPD's bug tracker.

Or change localhost in your client to 127.0.0.1.

Is MPD running on the correct IP?

We get a lot of complaints from users who misconfigured MPD's IP addresses or ports, and even more from users who don't realize that MPD isn't running. To test that, run as root:

netstat -apn|grep mpd

Check if the IPs and ports are the ones you expected. If there is no output, MPD isn't running.

Check if you can connect via telnet or netcat.

Firewall?

If attempts to connect are hanging, rather than saying "Connection Refused", your problem is likely with a firewall.

If you have a firewall, ensure that it doesn't reject/drop MPD packets.

Is loopback interface up?

If your loopback interface isn't up, you cannot connect to MPD. To change it, run as root:

ifconfig lo up

MPD hangs

If MPD hangs, we need a back trace of all MPD processes (0.13.x) / threads (git / 0.14+). To do that, install gdb, and attach it to the MPD process(es):

gdb /usr/sbin/mpd PID

Get the PID from "top" or "ps". For the back trace, enter:

thread apply all bt

If you have 0.13.x or older please upgrade to 0.14+ and try to reproduce the bug.

Problems with ALSA

If you're using ALSA version 1.0.15 or less as output plugin this problem might be related to bug #2243. Disabling dmix may solve the problem.

I can't hear anything

If mpd is playing your audio files but you can't hear anything first make sure your sound card is configured properly (use another tool like madplay or ALSA's "speaker-test" to see if you can hear anything from your sound card).

Next step: Are all necessary channels of your sound card unmuted (sounds simple but is sometime the problem).

Check whether the user mpd runs under (see Configuration directive "user") has the permission to access the sound card. Usually this means that this user is part of the "audio" group.

How to debug MPD (with corefile)

  1. You need to make sure MPD is built with debug support. This varies in how to get this done. Most binary distributions, you need to have *-debug installed. If installing from source compile with CFLAGS='-g'
  2. Ensure that ulimit (the size limit of your dump information) is set to unlimited. This can be done with the command: ulimit -c unlimited
  3. Run MPD with mpd --stdout --no-daemon --verbose and duplicate the crash. This will leave you with a core file in the directory you started MPD in.
  4. Run gdb against the binary as such gdb /usr/bin/mpd core, after doing this gdb console will be brought up.
  5. In the gdb console, type "thread apply all bt". This should give you a back trace.
  6. File a bug, or join us in irc, with as much information as you can about it. Tell us how to duplicate it, give us the information from the back trace (copy and paste).

How to debug MPD (in gdb)

  1. You need to make sure MPD is built with debug support. This varies in how to get this done. Most binary distributions, you need to have *-debug installed. If installing from source compile with CFLAGS='-g'
  2. Run gdb mpd
  3. Type run --stdout --no-daemon --verbose and duplicate the crash
  4. Now type "thread apply all bt". This should give you a back trace.
  5. File a bug, or join us in irc, with as much information as you can about it. Tell us how to duplicate it, give us the information from the back trace (copy and paste).

MPD is slow

See Tuning

Around Wikia's network

Random Wiki