mpd being killed by systemd on startup

System: RPi B+ (trying to reuse an old Pi I had laying around)
Software: Volumio 2.692

I have a new install of volumio and a very large music library (35K+ songs) on my NAS. The initial scan over ethernet works fine, but when I switched to WiFi only I was finding that mpd was never starting up. When running an strace of mpd, I found that it was trying stat every file in my library on startup. From journalctl output I see that mpd is eventually getting killed, for example this is from earlier this afternoon:

Jan 04 12:30:27 masterbath systemd[1]: mpd.service stop-final-sigterm timed out. Killing. Jan 04 12:30:27 masterbath systemd[1]: mpd.service: main process exited, code=killed, status=9/KILL Jan 04 12:30:27 masterbath systemd[1]: Failed to start Music Player Daemon. Jan 04 12:30:27 masterbath systemd[1]: Unit mpd.service entered failed state. Jan 04 12:30:27 masterbath systemd[1]: Starting Music Player Daemon...

It looks like it is taking so long to scan my collection for new files that systemd kills mpd since it is taking too long to send a notify. This then starts the scan again, which causes mpd to get killed again, in a never-ending loop. Since the scan never finishes, volumio never becomes usable.

I found a workaround in this thread: github.com/MusicPlayerDaemon/MPD/issues/259, but that really seems like a hack (setting the Type to simple instead of notify). However, this does get me up and running and makes the system usable. Has anyone else run into this, and are there any other suggestions for a fix? I think the obvious fix would be to have mpd do the scan in a separate thread, but that’s really outside the scope of volumio.

Hi,

I have same situation, my volumio is on odroid C2, connected to router ( NAS) with TCP/IP cable. As the music library grows, there will be a point where on startup mpd get killed because of time out. And as You realized there will be a newer ending loop of start -> timeout -> start …
So, until now I cannot find any another solution except to change mpd.service type from notify to simple …

Hi,

I thing I have found the best and simplies solution for timing out mpd service on start up ( for large databases) : there is a need to be disabled the auto update feature of mpd !

You can do this by editing /etc/mpd.conf and changing auto_update “yes” to auto_update “no”, but this file is owerwritten on every volumio process start up with this file : /volumio/app/plugins/music_service/mpd/mpd.conf.tmpl. So edit and change both file.
There is no need to touch /lib/systemd/system/mpd.service file.

I did this on PC version and odroid-C2 version of volumio 2.698. Both start up really fast, Auto Play from NAS works like a charm …

I hope this solution will be stable enough to keep it for a while ( currently is is 2 hours old :slight_smile: )

Hi.

Thanks for your answer - disabling auto update really helped me.
My fresh install of volumio 2.699 was not usable any more after first reboot on big music collection on Samba/CIFS/NAS Share with 200k+ songs.

I updated volumio after 2 years to a new version. I hat to do a fresh install, scanning for CIFS share and mounting it worked fine out ot the box. Library was scanned and playing worked. After reboot the library was gone and even webradio did not work. There were no error messages at all.
I thougt about mount issues and the journalctl (-f) messages were not that helpful. mpc status alwas timed out and here I am. Any indication that MPD is not working would be great and would have saved me an evening of debugging…

Thanks again