Skip to main content
Topic: mpd fails to bind socket (Read 8126 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

mpd fails to bind socket

every time i run mpd i get this:

Failed to bind to '0.0.0.0:6600'; Failed to bind socket: Address already in use

it doesn't matter what i set "bind_to_address" in mpd.conf to, i get this every time, can't find any processes using them either


Re: mpd fails to bind socket

Reply #2
Have you installed and configured mpd-<your_init>?

yes, it doesn't seem to do anything

i'm also getting a "no database" error when trying to "mpc up"

Re: mpd fails to bind socket

Reply #3
Failed to bind to '0.0.0.0:6600'; Failed to bind socket: Address already in use

That message means that something else is using the port 6600, maybe is he same mpd which is running as background or maybe is something else which is listening in that port. You can check what is running with this command:
Code: [Select]
ss -putan | grep 6600
Artix Linux Colombia

Re: mpd fails to bind socket

Reply #4
Failed to bind to '0.0.0.0:6600'; Failed to bind socket: Address already in use

That message means that something else is using the port 6600, maybe is he same mpd which is running as background or maybe is something else which is listening in that port. You can check what is running with this command:
Code: [Select]
ss -putan | grep 6600

tcp   LISTEN 0      5                      *:6600                *:*
tcp   ESTAB  0      0                  [::1]:58268           [::1]:6600  users:(("mpc",pid=2503,fd=3))
tcp   ESTAB  0      0                  [::1]:6600            [::1]:58268

it might just say its failing cause i've already binded it to mpd? thought it'd report "mpd has already started", if i specify another port (not address) in mpd.conf it gives me this:

decoder: Decoder plugin 'wildmidi' is unavailable: configuration file does not exist: /etc/timidity/timidity.cfg

ncmpcpp still reports "MPD: No database"


Re: mpd fails to bind socket

Reply #6

$ mpd --no-daemon --stdout --verbose

config_file: loading file /home/m/.config/mpd/mpd.conf
exception: Default TCP listener setup failed, but this is okay because we have a $XDG_RUNTIME_DIR listener: Failed to bind to '[::]:6600'; Failed to bind socket: Address already in use
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
vorbis: Xiph.Org libVorbis 1.3.7
opus: libopus 1.3.1
sndfile: libsndfile-1.0.31
hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled
decoder: Decoder plugin 'wildmidi' is unavailable: configuration file does not exist: /etc/timidity/timidity.cfg
simple_db: reading DB
input: Input plugin 'qobuz' is not configured: No Qobuz app_id configured
curl: version 7.81.0
curl: with OpenSSL/1.1.1m
inotify: initializing inotify
event: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
inotify: watching music directory

unsure how they fixed the problem as even they didn't know

Re: mpd fails to bind socket

Reply #7
https://bbs.archlinux.org/viewtopic.php?pid=1767159#p1767159
Quote
Feb 10 22:59 : exception: Failed to bind to '[::]:6600'
Feb 10 22:59 : exception: nested: Failed to bind socket: Address already in use

https://bbs.archlinux.org/viewtopic.php?pid=1767163#p1767163
Quote
This is non-fatal. Please post details of how you have set up mpd and how you are starting it (configs, front end, etc).

https://wiki.archlinux.org/title/Music_Player_Daemon/Troubleshooting#Binding_to_IPV6_before_IPV4
Quote
Binding to IPV6 before IPV4
If on startup, mpd displays the following message:

listen: bind to '0.0.0.0:6600' failed: Address already in use (continuing anyway, because binding to '[::]:6600' succeeded)
it means mpd binds to the ipv6 interface before binding to ipv4. If you want to use your ipv4 interface, hardcode it in mpd.conf, like:

bind_to_address "0.0.0.0"
Several binds can also be specified, for example, to have mpd listen both to localhost and to the external IP of your network card:

bind_to_address "127.0.0.1"
bind_to_address "192.168.1.13"

https://bbs.archlinux.org/viewtopic.php?pid=980224#p980224
Quote
You have to update the database from the client you are using. Previous mpd versions had a --create-database commandline parameter, but this was deprecated and removed.

https://bbs.archlinux.org/viewtopic.php?pid=1862342#p1862342
Quote
About the "no database error in cantata", please provide the exact error message and also let's see

mpc stats

https://old.reddit.com/r/linuxquestions/comments/bmkcl3/mpd_error_no_database/emxfdu1/
Quote
When I first installed mpd, I made sure to touch a database file where mpd was supposed to find it. Then it worked. For example, the database file mpd looks for is located in ~/.config/mpd/db. All I did was touch ~/.config/mpd/db.

And so on. Reading is a skill.

Edit: Also:
https://github.com/MusicPlayerDaemon/MPD/discussions/1365#discussioncomment-1718911
Quote
Solved by running systemctl --user enable mpd.service because before I ran it without the user flag, causing it to run as root instead of on my user account.
So see about configuring the mpd service in your init to run it as a specific user. The database file needs to be accessible to mpd as well.

Edit 2: Just tried installing mpd + mpc in 66. Steps taken:

Code: [Select]
$ su
# pacman -S mpd mpd-suite66
# exit
$ pikaur -S mpc
$ su
# vim /etc/mpd.conf

Code: [Select]
# See: /usr/share/doc/mpd/mpdconf.example          <-- big hint here

user "mpd"          # <-- added those
group "mpd"        # <-- two lines
pid_file "/run/mpd/mpd.pid"
db_file "/var/lib/mpd/mpd.db"
state_file "/var/lib/mpd/mpdstate"
music_directory "/var/lib/mpd/music"   # <-- also this line
playlist_directory "/var/lib/mpd/playlists"
Code: [Select]
# touch /var/lib/mpd/{mpdstate,mpd.db}
# mkdir /var/lib/mpd/music
# chown mpd:mpd /var/lib/mpd/*
# 66-enable -t default -S mpd
# exit
$ mpc
volume: n/a   repeat: off   random: off   single: off   consume: off
Everything works normally, with the exception of sound output device, which I didn't configure, but that is out of the scope of the OP.

Re: mpd fails to bind socket

Reply #8
.config/mpd/mpd.conf:
Code: [Select]
music_directory         "/mnt/Music"
playlist_directory      "~/.config/mpd/playlists"

auto_update "yes"
bind_to_address "0.0.0.0"         <---- the error persisted regardless of what ipv4 i bind to
port "6600"
restore_paused "yes"
max_output_buffer_size "16384"

audio_output {
        type "pulse"
        name "pulse"
        #type  "alsa"
        #name  "ALSA"
}

audio_output {
       type     "fifo"
       name     "Visualizer feed"
       path     "/tmp/mpd.fifo"
       format   "44100:16:2"
}
/etc/mpd.conf:
Code: [Select]
# See: /usr/share/doc/mpd/mpdconf.example

user "mpd"                    <---- added user
group "mpd"                <---- added group
pid_file "/run/mpd/mpd.pid"
db_file "var/lib/mpd/mpd.db"
state_file "/var/lib/mpd/mpdstate"
music_directory "/var/lib/mpd/music"      <---- and music_directory
playlist_directory "/var/lib/mpd/playlists"

Quote

Edit 2: Just tried installing mpd + mpc in 66. Steps taken:

Code: [Select]
$ su
# pacman -S mpd mpd-suite66
# exit
$ pikaur -S mpc
$ su
# vim /etc/mpd.conf

Code: [Select]
# See: /usr/share/doc/mpd/mpdconf.example          <-- big hint here

user "mpd"          # <-- added those
group "mpd"        # <-- two lines
pid_file "/run/mpd/mpd.pid"
db_file "/var/lib/mpd/mpd.db"
state_file "/var/lib/mpd/mpdstate"
music_directory "/var/lib/mpd/music"   # <-- also this line
playlist_directory "/var/lib/mpd/playlists"
Code: [Select]
# touch /var/lib/mpd/{mpdstate,mpd.db}
# mkdir /var/lib/mpd/music
# chown mpd:mpd /var/lib/mpd/*
# 66-enable -t default -S mpd
# exit
$ mpc
volume: n/a   repeat: off   random: off   single: off   consume: off

Code: [Select]
$ su
$ vim /etc/mpd.conf             <----- added user, group, & music_directory lines
$ touch /var/lib/mpd/mpdstate
$ touch /var/lib/mpd/mpd.db
$ touch mkdir /var/lib/mpd/music
$ chown mpd:mpd /var/lib/mpd/*
$ rc-update add mpd            <---- unsure if there was any "-t" or "-S" equivalent i had to specify, unfamiliar with 66 & couldn't find a suite66/openrc cheat sheet online
$ rc-service mpd restart
$ exit
$ mpc up
Updating DB (#1) ...
volume: n/a   repeat: off   random: off   single: off   consume: off

got the same error a few times along the way but i think restarting mpd init after recreating those steps fixed it, works even after reboot

Re: mpd fails to bind socket

Reply #9
This line:
If there was no directory /var/lib/music, the command you wrote above would create a file named mkdir in the current directory (whatever that might have been at the time) and a file /var/lib/mpd/music. Instead, the command should be exactly this:
Code: [Select]
mkdir /var/lib/mpd/music
The idea with this particular command is to create a directory /var/lib/mpd/music. For more information:
Code: [Select]
man touch
man mkdir