Noob question about service failing to start (mpd)

Hi everybody, I’m fighting with mpd service which always fails, here it is

prompt  ~ $ systemctl status mpd.service
× mpd.service - Music Player Daemon
Loaded: loaded (/usr/lib/systemd/system/mpd.service; disabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/mpd.service.d
└─00-arch.conf
Active: failed (Result: exit-code) since Mon 2023-07-31 21:06:03 CEST; 46s ago
Docs: man:mpd(1)
man:mpd.conf(5)
Process: 70885 ExecStart=/usr/bin/mpd --systemd (code=exited, status=1/FAILURE)
Main PID: 70885 (code=exited, status=1/FAILURE)
CPU: 54ms

juil. 31 21:06:03 jesscomp systemd[1]: Starting Music Player Daemon…
juil. 31 21:06:03 jesscomp mpd[70885]: Ignoring the ‘pid_file’ setting in systemd mode
juil. 31 21:06:03 jesscomp mpd[70885]: exception: Failed to bind to ‘[::]:6600’; Failed to bind socket: Address already in use
juil. 31 21:06:03 jesscomp systemd[1]: mpd.service: Main process exited, code=exited, status=1/FAILURE
juil. 31 21:06:03 jesscomp systemd[1]: mpd.service: Failed with result ‘exit-code’.
juil. 31 21:06:03 jesscomp systemd[1]: Failed to start Music Player Daemon.

what am I missing, I don’t understand why socket failing to bind and how to know with what it is in conflict ?

Thx to all and HF

I am not using mpd so I couldn’t be of much help but are you starting the service as your user?

The mpd package provides a user service file. The service starts the process as user, there is no need to change permission nor use the user and group variables in the MPD configuration file.

Start/enable the user unit mpd.service (i.e. with the --user flag).

https://wiki.archlinux.org/title/Mpd#Autostart_with_systemd

systemctl --user enable --now mpd.service

3 Likes

mpd.service seems to be triggered by mpd.socket, so you might need to stop the socket first before trying to start the service again. The reason the service keeps failing to start is probably because a socket file already exists.

Try to run:

$ sudo systemctl stop mpd.socket

After that, try to start the service again:

$ sudo systemctl start mpd.service
1 Like

As @pebcak pointed out above, it’s a user service file; you use --user when starting and/or enabling it:

Start/enable the user unit mpd.service (i.e. with the --user flag).

So the command would be:

systemctl --user start mpd.service

To enable the service, so that it autostarts at boot:

systemctl --user enable mpd.service

IMPORTANT - Note that you do not replace --user with a user name, you literally use the word “user” here.

4 Likes

Hi, thanx for answers guys, but there is a problem

first I want to say that in my mpd.conf, I still have the user "user" commented (commented or not, it does not change anything)

second, I stopped, then started mpd.service, but these commands still return :


$ systemctl status mpd

○ mpd.service - Music Player Daemon
Loaded: loaded (/usr/lib/systemd/system/mpd.service; disabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/mpd.service.d
└─00-arch.conf
Active: inactive (dead)
Docs: man:mpd(1)
man:mpd.conf(5)
$ systemctl status mpd
○ mpd.service - Music Player Daemon
Loaded: loaded (/usr/lib/systemd/system/mpd.service; disabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/mpd.service.d
└─00-arch.conf
Active: inactive (dead)
Docs: man:mpd(1)
man:mpd.conf(5)

or

$ mpd --stdout

exception: Failed to bind to ‘0.0.0.0:6600’; Failed to bind socket: Address already in use

I repeat, these stdout are the same, after I just stoped the mpd.socket, after I stoped it and restarted it.

See what is listening on 6600 with:
sudo netstat -tunlp | grep 6600

Maybe you will have a look here:

https://discovery.endeavouros.com/applications/beginners-guide-to-mpd-config-and-clients/2021/08/

1 Like

Do you have something running already on that port?

Please post output of this :point_down:


Did you try to manually start MPD? i.e. by executing mpd in terminal. That could be blocking port 6600.

Running MPD manually or via service doesn’t have much difference. I prefer executing mpd upon login (automatically).

Hi,

this command returns nothing, gonna take a look at @swh doc

I became crazy :smiley:

EDIT : the link didn,'t help. I have nothing else running on that port. Insoluble problem for me (yet)

Your system beg to differ with that.
exception: Failed to bind to ‘[::]:6600’; Failed to bind socket: Address already in use

You should test if changing the port in mpd.conf to something else let it start

just after reboot : looks like mpd doesn’t autostart

jessbont  ~ $ systemctl status mpd.service
○ mpd.service - Music Player Daemon
Loaded: loaded (/usr/lib/systemd/system/mpd.service; disabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/mpd.service.d
└─00-arch.conf
Active: inactive (dead)
Docs: man:mpd(1)
man:mpd.conf(5)
so i did start it

jessbont  ~ $ systemctl start mpd
jessbont  ~ $ systemctl status mpd.service
● mpd.service - Music Player Daemon
     Loaded: loaded (/usr/lib/systemd/system/mpd.service; disabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/mpd.service.d
             └─00-arch.conf
     Active: active (running) since Thu 2023-08-03 22:43:59 CEST; 2s ago
       Docs: man:mpd(1)
             man:mpd.conf(5)
   Main PID: 3919 (mpd)
      Tasks: 3 (limit: 17665)
     Memory: 9.3M
        CPU: 72ms
     CGroup: /system.slice/mpd.service
             └─3919 /usr/bin/mpd --systemd

août 03 22:43:59 jesscomp mpd[3919]: Ignoring the 'pid_file' setting in systemd mode
août 03 22:43:59 jesscomp mpd[3919]: server_socket: bind to '0.0.0.0:6600' failed (continuing anyway, because binding to '[::]:6600' succeeded): Failed to bind socket: Address already in>
août 03 22:43:59 jesscomp mpd[3919]: decoder: Decoder plugin 'wildmidi' is unavailable: configuration file does not exist: /etc/timidity/timidity.cfg
août 03 22:43:59 jesscomp mpd[3919]: config: Found database setting without music_directory - disabling database
août 03 22:43:59 jesscomp mpd[3919]: output: No 'audio_output' defined in config file
août 03 22:43:59 jesscomp mpd[3919]: alsa_output: Error opening default ALSA device: Host is down
août 03 22:43:59 jesscomp mpd[3919]: oss_output: Error opening OSS device "/dev/dsp": No such file or directory
août 03 22:43:59 jesscomp mpd[3919]: oss_output: Error opening OSS device "/dev/sound/dsp": No such file or directory
août 03 22:43:59 jesscomp mpd[3919]: output: Successfully detected a jack audio device
août 03 22:43:59 jesscomp systemd[1]: Started Music Player Daemon.
lines 1-24/24 (END)

I changed port in both mpd and ncmpcpp configs

tere are news errors that I didn’t know and I will correct, at least

audio output

As many already has suggested, use the --user flag:

systemctl --user status mpd
systemctl --user start mpd
systemctl --user stop mpd

So to see if this can be solved, do all of this:

systemctl stop mpd
systemctl --user stop mpd
systemctl disable mpd
systemctl --user disable mpd

Copy the mpd.conf where you have changed the port in:
cp /path/to/your/mpd.conf ~/.config/mpd/

Now start mpd like this:
mpd ~/.config/mpd/mpd.conf

Does it run now?