Running mpd with local config on Linux Mint

1

1

I'm trying to set the mpd daemon to run as the local logged on user under Linux Mint (Cinnamon). I have set the following folder structure:

$ cp /usr/share/doc/mpd/mpdconf.example ~/.config/mpd/mpd.conf
$ mkdir ~/.config/mpd/playlists
$ touch ~/.config/mpd/{database,pid,state,log,sticker.sql}

I've edited ~/.config/mpd/mpd.conf to use the above and I executed $ mpd ~/.config/mpd/mpd.conf successfully. Follows an excerpt of the config file as I set it up:

music_directory       "~/Music"
playlist_directory    "~/.config/mpd/playlists"
db_file               "~/.config/mpd/database"
log_file              "~/.config/mpd/log"
pid_file              "~/.config/mpd/pid"
state_file            "~/.config/mpd/state"
sticker_file          "~/.config/mpd/sticker.sql"
user                  "[my_username]"

The problem is that on every reboot, mpd stubbornly refuses to use my user config file and reverts to the default /etc/mpd.conf, even when I disable mpd from the Startup Applications panel in Cinnamon.

Every time I boot, I have to open a terminal as su and issue mpd --kill. Then, back as a normal user, I can finally start mpd and use it normally.

~$ su
password:
# mpd --kill
# exit
exit
~$ mpd
server_socket: bind to '0.0.0.0:6600' failed: Address already in use (continuing anyway, because binding to '[::]:6600' succeeded)

Only now I can use mpd normally. How can I force mpd to use my local configuration on every reboot and avoid going through all this trouble?

A Dwarf

Posted 2015-10-05T05:35:01.120

Reputation: 17 756

Answers

2

It sounds like you have mpd running as a system service. Check and see if that is the case by running service mpd status. If it is running, then you want to turn it off with service mpd stop && service mpd disable. (Note: you may need to run these commands as root or su as root like you did before.)

The reason this doesn't read your user configuration is system services run at boot before you log in. These services generally run as root. To fix this you need to disable the system service so it doesn't conflict with your user level daemon. Then you can set mpd to run automatically when you log in.

To make mpd run as your user on startup add it to ~/.profile. This script is run automatically on every login.

dangerginger

Posted 2015-10-05T05:35:01.120

Reputation: 54

Thank you. That was exactly the problem. After a little investigation, the command to remove the service in Linux Mint is different. So I had to issue update-rc.d -f mpd remove as root. But now everything is fine. I've added mpd to start as user automatically on startup and it is behaving as I want. ` – A Dwarf – 2015-10-05T06:46:59.320