Music Player Daemon/Troubleshooting

From ArchWiki
< Music Player Daemon
Revision as of 00:30, 29 March 2012 by Thestinger (Talk | contribs) (inherit categories)

Jump to: navigation, search

Go back to Music Player Daemon.


Autodetection failed

During the start of MPD, it tries to autodetect your set-up and configure output and volume control accordingly. Though this mostly goes well, it will fail for some systems. It may help to tell MPD specifically what to use as output and mixer control. If you copied /etc/mpd.conf over from /etc/mpd.conf.example as mentioned above, you can simply uncomment:

Example for alsa output type and alsa mixer:

audio_output {
	type			"alsa"
	name			"My ALSA Device"
	device			"hw:0,0"	# optional
	format			"44100:16:2"	# optional
	mixer_type		"hardware"
	mixer_device		"default"
	mixer_control		"PCM"

Note: in case of permission problems when using ESD with MPD run this as root:

# chsh -s /bin/true mpd

MPD hangs on first startup

This is a common error that's caused by corrupt mp3 tags. Here is an experimental way to solve this issue. Requirements:

  • kid3
  • easytag

This method is very tedious, especially with a huge database. Just as a baseline it took 2.5h to fix a 16Gb DB.

Easy Tag

The purpose of easytag here is that easytag detects the error in the tags, but like MPD it hangs and dies. The trick here is that easy tags actually tells you what file is causing the problem on the status bar. Before starting easytag make sure to have a terminal close to be ready to kill easy tag to avoid a hang. Once you are ready, on the tree view select the directory where all your music is located. By default easytag starts to search all subdirectories for mp3 files. Once you notice that easytag stopped scanning for songs, make note of the culprit and kill easytag.


Here's where kid3 comes in handy. With kid3 go to the offending song and rewrite one of the tags. then save the file. This should force kid3 to rewrite the whole tag again fixing the problem with MPD and easy tag hanging.

Repeat this procedure until your music library is done.

Cannot connect to mpd: host "localhost" not found: Temporary failure in name resolution

Cannot connect to MPD (with ncmpcpp), if you are disconnected from network. Solution is disable IPv6 or add line to /etc/hosts

::1 localhost.localdomain localhost

Other issues when attempting to connect to mpd with a client

Some have reported being unable to access mpd with various clients, for example seeing errors like these:

$ ncmpcpp
Cannot connect to mpd: Connection closed by the server
$ sonata
2011-02-13 18:33:05  Connection lost while reading MPD hello
2011-02-13 18:33:05  Not connected
2011-02-13 18:33:05  Not connected

Please see posts on ncmpcpp on the Arch Forums HERE and HERE. Also see FS#22071.

First fix

Check mpd.conf for a line like mpd.error and remove it. The mpd error file is deprecated and has been removed.

Second fix

Note: I'm not so sure this is a good idea. There is a warning about changing the address to bind to in the default mpd.conf. If this does not help, you might want to comment out the changes.

If that doesn't help, add the following to mpd.conf:

 bind_to_address ""
 port "6600"

Afterwards, instruct your client to connect via For example, add the following to the ncmpcpp config file:

 mpd_host ""
 mpd_port "6600"

Binding to IPV6 before IPV4

If on startup, mpd displays the following message:

listen: bind to '' failed: Address already in use (continuing anyway, because binding to '[::]:6600' succeeded)

MPD is attempting to bind to the ipv6 interface before binding to ipv4. If you want to use your ipv4 interface, hardcode it in mpd.conf, like so:

bind_to_address ""

Several binds can also be specified, for example, to have MPD listen on localhost and the external IP of your network card:

bind_to_address ""
bind_to_address ""

daemon: cannot setgid for user "mpd": Operation not permitted

The error is stating that the user starting the process does not have permissions to become another user (mpd) which the configuration has told the process to run as.

To solve the issue, simply start mpd as root.

$ su -c "rc.d start mpd"


# rc.d start mpd


Sometimes, when using other audio outputs, e.g: some web pages containing Flash applets, MPD is rendered unable to play (until it is restarted). The error comes up in mpd's log:

Error opening alsa device "hw:0,0": Device or resource busy

Reasons for this may be:

  • The sound card does not support hardware mixing (uses dmix plugin)
  • An application does not work with ALSA's default settings

For a detailed description, it is recommended to take a look at this link.

This problem may be solved by adding the following lines to mpd.conf:

audio_output {
        type                    "alsa"
        name                    "Sound Card"
        options                 "dev=dmixer"
        device                  "plug:dmix"

To make the changes have effect, restart mpd (e.g. /etc/rc.d/mpd restart, if it is a global configuration).

High CPU usage with ALSA

When using MPD with ALSA, users may experience MPD taking up lots of CPU (around 20-30%). This is caused by most sound cards supporting 48kHz and most music being 44kHz, thus forcing MPD to resample it. This operation takes lots of CPU cycles and results into high usage.

For most users the problem should be solved by telling MPD not to use resampling by adding auto_resample "no" into audio_output-part of /etc/mpd.conf. This will degrade quality slightly, however.

audio_output {
   type			"alsa"
   name			"My ALSA Device"
   auto_resample	"no"

Although it may not give as drastic a speedup, enabling mmap may still speed things up:

audio_output {
   type			"alsa"
   name			"My ALSA Device"
   use_mmap		"yes"

Some users might also want to tell dmix to use 44kHz as well. More info about tuning performance of your MPD can be found on the MPD wiki