Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] mpd error: Connection refused

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

[Solved] mpd error: Connection refused

#1 Post by bester69 »

Hi,

Im getting this error with mpc client, Im using mpd as not a daemon service ..

Do you know how to use (connect) mpc with mpd as not a service? :?

My /etc/mpd.conf
music_directory "/home/myuser/Música/"
playlist_directory "/home/myuser/.mpd/playlists"
db_file "/home/myuser/.mpd/tag_cache"
log_file "/home/myuser/.mpd/mpd.log"
pid_file "/home/myuser/.mpd/pid"
state_file "/home/myuser/.mpd/state"
sticker_file "/home/myuser/.mpd/sticker.sql"
user "myuser"
bind_to_address "192.168.1.128"

audio_output {
type "pulse"
name "My Pulse Output"
device "/dev/dsp"
mixer_type "hardware"
}
Thanks.
Last edited by bester69 on 2018-12-11 11:40, edited 1 time in total.
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

shep
Posts: 423
Joined: 2011-03-15 15:22

Re: mpd error: Connection refused

#2 Post by shep »

You will get that message if mpd is not running. Usually it fails to start due to a missing or incorrect mpd config file.
Also be aware that Debian will enable mpd.service with mpd installation. You can disable it with

Code: Select all

# systemctl disable mpd.service
The mpd version is a little dated in Debian 9 and by default only looks at configuration files in
FILES
~/.mpdconf
User configuration file.

/etc/mpd.conf
Global configuration file.
Since you did not make an ~/.mpdconf, and did not specify disabling mpd.service, you may have mpd trying to use the playlist and Music directories specified in /etc/mpd.conf. It will basically fail to start and output the results to mpd.log (where ever that is).
You can specify the config file when you start mpd by

Code: Select all

$ mpd /path/to/mpd.conf
.
My ~/.config/openbox/autostart

Code: Select all

# Start volume system tray applet
(sleep 2.5 && volumeicon) &
# Start Tint2 dock
(sleep 3.0 && tint2 -c ~/.config/tint2/launcher.tint2rc) &
# Start MPD
(sleep 3.5 && mpd ~/.config/mpd/mpd.conf)
If you do this from the command line, any errors in the config file will be output.
An alternative is to set up a unix socket for mpd. The Arch Linux mpd wiki is a good guide for setting up an mpd socket.
Last edited by shep on 2018-12-12 13:55, edited 2 times in total.

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: mpd error: Connection refused

#3 Post by bester69 »

Hi shep,

First, thanks a lot for you help :)

I shoud tell you My mpd is working well, only mpc client isnt able to connect to mpd, see music directories such as I posted in my mpd.conf (im using Cantata and others graphicall clients), but mpc client keeps reporting that message.. I need a command client (mpc) in order to pause or stop music within a script or perhaps you know a better way or Workaround to get this and let mpd proccess running at the same time.

I disabled service and also copy mpf.conf to home and mpc still giving that problem,.. I tried to find a solution to this problem on google, but i wasnt able..

I want Stop/Pause Music before killing mpd, so when I lauched mpd back It doesnt play the previous music.

#!/bin/bash
#
killall mpd
killall cantata &
sleep 1
killall cantata -9
mpd
cantata
mpc stop/pause/toggle <<<<<<<<<<<<<<<<< I need this :idea:
killall mpd
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

shep
Posts: 423
Joined: 2011-03-15 15:22

Re: mpd error: Connection refused

#4 Post by shep »

I usually use ncmpc with a unix socket.

https://linux.die.net/man/1/mpc
-h,--host
The host to connect to; if not given, the value of the environment variable MPD_HOST is checked before defaulting to localhost. This default can be changed at compile-time.
To use a password, provide a value of the form "password@host".

If you specify an absolute path, mpc attempts a connection via Unix Domain Socket.

-p,--port
The port to connect to; if not given, the value of the environment variable MPD_PORT is checked before defaulting to 6600. This default can be changed at compile-time.
You may need to specify your host and port with mpc

Code: Select all

mpc -h 192.168.1.128
You also may be able to set MPD_HOST=192.168.1.128 in your script environment

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

[Solved] Re: mpd error: Connection refused

#5 Post by bester69 »

shep wrote:
If you specify an absolute path, mpc attempts a connection via Unix Domain Socket.

-p,--port
The port to connect to; if not given, the value of the environment variable MPD_PORT is checked before defaulting to 6600. This default can be changed at compile-time.
You may need to specify your host and port with mpc

Code: Select all

mpc -h 192.168.1.128
You also may be able to set MPD_HOST=192.168.1.128 in your script environment
Ok, Thanks a lot Shep, have a nice day :o

both thinks made it work:
mpc -h 192.168.1.128 stop
or
export MPD_HOST=192.168.1.128 && mpc stop
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

Post Reply