Database persistence

Need help with MPD?
Post Reply
langrock
Posts: 6
Joined: May 17th, 2020, 6:39 pm

Database persistence

Post by langrock »

Hi,

Sorry to trouble you again. It appears that the 'database' disappears once mpd restarts. My configuration is below. I am using an SMB share for the storage location of the music and a local file for the database. When I run 'mpc update', it appears that the database is being populated, but upon reboot or restart of mpc, looking with myMPD, there are no longer any entries. I am sure that this isn't how it's supposed to be;-) I am pretty sure mpd is run as a system daemon, and the configuration file is at /etc/mpd.conf.

I would really appreciate if someone with more insight could point out how I need to modify the configuration file to have the database be persistent.

Looking at the mpd.log file during an 'mpc update' run, I see lines like
mkdir failed on directory /var/run/samba: Permission denied
Not sure why the process tries to create anything trough samba, though, since the database is supposed to be a local file on the RaspberryPI's SD card. Weird thing is, of course, that I can browse and play from the scanned items until I restart the program. So, there must be some sort of temporary database at least ...

Thanks


music_directory "smb://10.0.1.29/MusicCloud/Music"
playlist_directory "/mnt/dietpi_userdata/Music"
log_file "/var/log/mpd/mpd.log"
pid_file "/run/mpd/pid"
state_file "/mnt/dietpi_userdata/.mpd_cache/state"
sticker_file "/mnt/dietpi_userdata/.mpd_cache/sticker.sql"

database {
plugin "simple"
path "/mnt/dietpi_userdata/.mpd_cache/db_file"
cache_directory "/mnt/dietpi_userdata/.md_cache"
}

neighbors {
plugin "smbclient"
}
bind_to_address "/run/mpd/socket"
bind_to_address "10.0.1.47"

log_level "default"
metadata_to_use "artist,album,title,track,name,genre,date"
auto_update "yes"

zeroconf_enabled "yes"
zeroconf_name "DietPi MPD"

input {
plugin "curl"
}

connection_timeout "30"
max_connections "4"
filesystem_charset "UTF-8"

# Audio Output / Processing

audio_buffer_size "2048"

audio_output {
type "alsa"
name "DietPi Alsa"
device "hw:1,0"
format "44100:16:2"
mixer_type "hardware"

# Disable DSD DoP MPD 0.19
dop "no"
}


The output from mpd --version is

Music Player Daemon 0.21.5 (0.21.5)

Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2018 Max Kellermann <max.kellermann@gmail.com>
This is free software; see the source for copying conditions. There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
simple proxy upnp

Storage plugins:
local smbclient udisks nfs curl

Neighbor plugins:
smbclient upnp udisks

Decoders plugins:
[mad] mp3 mp2
[mpg123] mp3
[vorbis] ogg oga
[oggflac] ogg oga
[flac] flac
[opus] opus ogg oga
[sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
[audiofile] wav au aiff aif
[dsdiff] dff
[dsf] dsf
[hybrid_dsd] m4a
[faad] aac
[mpcdec] mpc
[wavpack] wv
[modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm
[mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm
[sidplay] sid mus str prg P00
[wildmidi] mid
[fluidsynth] mid
[adplug] amd d00 hsc laa rad raw sa2
[ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve
[gme] ay gbs gym hes kss nsf nsfe sap spc vgm vgz
[pcm]

Filters:
libsamplerate soxr

Tag plugins:
id3tag

Output plugins:
shout null fifo pipe alsa ao oss openal pulse jack httpd recorder

Encoder plugins:
null vorbis opus lame wave flac

Archive plugins:
[bz2] bz2
[zzip] zip
[iso] iso

Input plugins:
file archive alsa tidal qobuz curl ffmpeg smbclient nfs mms cdio_paranoia

Playlist plugins:
extm3u m3u pls xspf asx rss soundcloud flac cue embcue

Protocols:
file:// alsa:// tidal:// qobuz:// http:// https:// gopher:// rtp:// rtsp:// rtmp:// rtmpt:// rtmps:// smb:// nfs:// mms:// mmsh:// mmst:// mmsu:// cdda://

Other features:
avahi dbus udisks epoll icu inotify ipv6 systemd tcp un
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: Database persistence

Post by max »

Your MPD version is badly outdated.
langrock
Posts: 6
Joined: May 17th, 2020, 6:39 pm

Re: Database persistence

Post by langrock »

Thanks. The repository I was using (http://raspbian.raspberrypi.org) didn't have a more current version, so I followed the instructions on the 'Unofficial Debian packages' site to add the kaliko.me repo. It then installed the 0.21.22 version of MPD, which is much newer than the 0.21.5 I had before. Sadly, this version fails on startup as shown below. Not really sure yet why ... The old mpd.conf file is still in /etc/, but maybe it's now expecting such a file in the user directory? I need to sleep on that, unless you have an idea.

Thanks.

mpd[802]: May 18 09:55 : exception: Input plugin 'qobuz' is unavailable: No Qobuz app_id configured
systemd[1]: Started Music Player Daemon (DietPi).
systemd[1]: mpd.service: Current command vanished from the unit file, execution of the command list won't be resumed.
systemd[1]: Stopping Music Player Daemon...
systemd[1]: mpd.service: Succeeded.
systemd[1]: Stopped Music Player Daemon.
systemd[1]: mpd.service: Failed to load environment files: No such file or directory

systemd[1]: mpd.service: Failed to run 'start' task: No such file or directory
systemd[1]: mpd.service: Failed with result 'resources'.
systemd[1]: Failed to start Music Player Daemon.
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: Database persistence

Post by max »

Apparently, you deleted /etc/default/mpd, which is part of the "mpd" package.
langrock
Posts: 6
Joined: May 17th, 2020, 6:39 pm

Re: Database persistence

Post by langrock »

Thanks. While I most certainly didn't delete that file, I uninstalled MPD and did an autoremove of all associate packages before installing once more using
sudo apt-get install mpd/stable-backports
At the end of the installation, I get messages that already seem to indicate problems

Setting up mpd (0.21.22-1~bpo10+1) ...
mpd.service is a disabled or a static unit not running, not starting it.
mpd.socket is a disabled or a static unit not running, not starting it.
Processing triggers for systemd (241-7~deb10u4+rpi1) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...

The end result is exactly the same as before and there's no sign of a file / directory labeled 'mpd' inside /etc/default/
The MPD executable lives in /usr/bin/

If that file / directory is important and should have been installed, I suppose this would be a bug on the repository side of things. Is there another repo that provides a working binary armhf version that you know of?

Thanks
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: Database persistence

Post by max »

If you delete a conffile, Debian will remember that choice of yours and keep it deleted even if you uninstall and reinstall the package - just like Debian keeps modified versions of conffiles across reinstalls. That is a feature, but it may surprise you.
The easiest way to restore a conffile is to purge the package, which will remove all traces of it, including modified conffiles and the memory of deleted conffiles - e.g. "dpkg -P mpd". After that, you can reinstall the package, and you'll see those deleted conffiles again.

Btw. about "messages that already seem to indicate problems" - I don't see a problem here.
langrock
Posts: 6
Joined: May 17th, 2020, 6:39 pm

Re: Database persistence

Post by langrock »

Thanks for the explanation. I followed your advice and purged mpd and all of its dependencies and started fresh. The new sample configuration file looks much more detailed now with lots of helpful comments. I was able to recreate the settings from the old configuration file and update the database using 'mpc update'. Once that was done, I restarted mpd and the database is still there! That's awesome. Now to the next task of getting cover art and HTTPD streaming to work through myMPD ... been banging my head against the wall for a bit, but this is another topic. Thanks for the help.
Post Reply